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