Correct URL for mingw runtime sources.
[platform/upstream/glib.git] / build-dll
1 #!/bin/sh
2
3 # Temporary hack until building dlls or executables with exported
4 # entry points is easier with gcc -mno-cygwin.
5
6 # This is usable with cygwin b20.1 and egcs-2.91.66 19990314
7 # (egcs-1.1.2 release) as distributed by Mumit Khan. For other combinations,
8 # no idea.
9
10 GCC=gcc
11 DLLTOOL=dlltool
12 AS=as
13
14 library=$1; shift
15 version=$1; shift;
16 def=$1; shift
17 ldargs="$*"
18
19 defswitch=""
20 [ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
21
22 libname=$library
23 [ $version != '-' ] && libname=$library-$version
24 dllfile=$libname.dll
25
26 for F in $ldargs; do
27     case $F in
28         *.o)    objs="$objs $F";;
29     esac
30 done
31
32 $GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
33 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
34 $GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
35 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
36 $GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
37 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
38
39 rm $library.base $library.exp 2>/dev/null