Support added for building using a GNU toolchain on Win32,
[platform/upstream/glib.git] / build-dll
1 #!/bin/sh
2
3 # Temporary hack until building dlls with gcc -mno-cygwin is easier
4
5 LD=ld
6 DLLTOOL=dlltool
7 AS=as
8
9 library=$1; shift
10 version=$1; shift;
11 def=$1; shift
12 ldargs="$*"
13
14 defswitch=""
15 [ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
16
17 libname=$library
18 [ $version != '-' ] && libname=$library-$version
19 dllfile=$libname.dll
20
21 for F in $ldargs; do
22     case $F in
23         *.o)    objs="$objs $F";;
24     esac
25 done
26
27 $LD -s --base-file $library.base --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
28 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs
29 $LD -s --base-file $library.base $library.exp --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
30 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs
31 $LD $library.exp --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
32 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
33 rm $library.base $library.exp