3 # Temporary hack until building dlls is easier with gcc -mno-cygwin
6 # This is usable with cygwin 1.1.x and gcc-2.95.2 for mingw as
7 # distributed by Mumit Khan. For other combinations, no idea.
19 [ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
22 [ $version != '-' ] && libname=$library-$version
27 *.[ao]) objs="$objs $F";;
31 # Check if we have a resource file for this DLL.
33 if [ -f $library.rc ]; then
34 resfile=$library-win32res.o
36 ldargs="$ldargs $resfile"
38 # Check if we have a build number stamp file.
39 if [ -f $library-build.stamp ]; then
40 read number <$library-build.stamp
41 buildnumber=$[number+1]
42 echo Build number is $buildnumber
43 echo $buildnumber >$library-build.stamp
45 echo Using zero as build number
49 m4 -DBUILDNUMBER=$buildnumber <$library.rc >$library-win32res.rc
50 windres $library-win32res.rc $library-win32res.o
51 rm $library-win32res.rc
56 $GCC -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
57 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
58 $GCC -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
59 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
60 $GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
61 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
63 # Finally, also build import libraries for the Microsoft linker. You
64 # will either need to have some decent version of MSVC, or get lib.exe
65 # (and link.exe) from the (freely downloadable) Microsoft Platform SDK.
67 if type -p lib.exe && [ -n "$def" -a "$def" != '-' ]; then
68 lib -name:$libname.dll -def:$def -out:$libname.lib
71 rm $library.base $library.exp 2>/dev/null