--- Python-3.12.4/Modules/makesetup.orig	2024-06-06 20:26:44.000000000 +0200
+++ Python-3.12.4/Modules/makesetup	2024-07-05 21:08:47.722675100 +0200
@@ -90,13 +90,10 @@
 # Setup to link with extra libraries when making shared extensions.
 # Currently, only Cygwin needs this baggage.
 case `uname -s` in
-CYGWIN*) if test $libdir = .
-	 then
-	 	ExtraLibDir=.
-	 else
-	 	ExtraLibDir='$(LIBPL)'
-	 fi
-	 ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
+CYGWIN*)
+	 ExtraLibDir=.
+	 ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)"
+	 ExtraLibDepends='$(LIBRARY_DEPS)';;
 esac
 
 # Main loop
@@ -285,7 +282,7 @@
 				BUILT_SHARED="$BUILT_SHARED $mod"
 				;;
 			esac
-			rule="$file: $objs"
+			rule="$file: $objs $ExtraLibDepends"
 			rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
 			echo "$rule" >>$rulesf
 		done
