1999-07-31 23:45:21 +02:00
|
|
|
#!/bin/bash
|
1999-04-24 15:52:51 +02:00
|
|
|
|
1999-04-25 22:52:42 +02:00
|
|
|
# Temporary hack until building dlls or executables with exported
|
1999-07-21 21:18:03 +02:00
|
|
|
# entry points is easier with gcc -mno-cygwin ("mingw32").
|
1999-04-24 15:52:51 +02:00
|
|
|
|
1999-06-28 08:06:34 +02:00
|
|
|
# This is usable with cygwin b20.1 and egcs-2.91.66 19990314
|
1999-07-21 21:18:03 +02:00
|
|
|
# (egcs-1.1.2 release) or gcc-2.95 as distributed by Mumit Khan. For
|
|
|
|
# other combinations, no idea.
|
1999-06-28 08:06:34 +02:00
|
|
|
|
1999-04-25 22:52:42 +02:00
|
|
|
GCC=gcc
|
1999-04-24 15:52:51 +02:00
|
|
|
DLLTOOL=dlltool
|
|
|
|
AS=as
|
|
|
|
|
|
|
|
library=$1; shift
|
|
|
|
version=$1; shift;
|
|
|
|
def=$1; shift
|
|
|
|
ldargs="$*"
|
|
|
|
|
|
|
|
defswitch=""
|
|
|
|
[ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
|
|
|
|
|
|
|
|
libname=$library
|
|
|
|
[ $version != '-' ] && libname=$library-$version
|
|
|
|
dllfile=$libname.dll
|
|
|
|
|
|
|
|
for F in $ldargs; do
|
|
|
|
case $F in
|
1999-07-21 21:18:03 +02:00
|
|
|
*.[ao]) objs="$objs $F";;
|
1999-04-24 15:52:51 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
1999-10-05 01:04:34 +02:00
|
|
|
$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
|
1999-04-25 22:52:42 +02:00
|
|
|
$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
|
1999-10-05 01:04:34 +02:00
|
|
|
$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
|
1999-04-25 22:52:42 +02:00
|
|
|
$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
|
1999-07-13 01:11:27 +02:00
|
|
|
$GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
|
1999-04-24 15:52:51 +02:00
|
|
|
$DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
|
1999-04-25 22:52:42 +02:00
|
|
|
|
1999-07-31 23:45:21 +02:00
|
|
|
# Finally, also build import libraries for the Microsoft linker. You
|
|
|
|
# will either need to have some decent version of MSVC, or get lib.exe
|
|
|
|
# (and link.exe) from the (freely downloadable) Microsoft Platform SDK.
|
|
|
|
|
|
|
|
if type -p lib.exe && [ -n "$def" -a "$def" != '-' ]; then
|
|
|
|
lib -name:$libname.dll -def:$def -out:$libname.lib
|
|
|
|
fi
|
|
|
|
|
1999-04-25 22:52:42 +02:00
|
|
|
rm $library.base $library.exp 2>/dev/null
|