Test for sched_yield as the native yield function first. Corrected typo
[platform/upstream/glib.git] / build-dll
1 #!/bin/bash
2
3 # Temporary hack until building dlls is easier with gcc -mno-cygwin
4 # ("mingw32").
5
6 # This is usable with cygwin b20.1 and egcs-2.91.66 19990314
7 # (egcs-1.1.2 release) or gcc-2.95(.2) as distributed by Mumit Khan. For
8 # other combinations, 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         *.[ao]) objs="$objs $F";;
29     esac
30 done
31
32 $GCC -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 -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 # Finally, also build import libraries for the Microsoft linker. You
40 # will either need to have some decent version of MSVC, or get lib.exe
41 # (and link.exe) from the (freely downloadable) Microsoft Platform SDK.
42
43 if type -p lib.exe && [ -n "$def" -a "$def" != '-' ]; then
44     lib -name:$libname.dll -def:$def -out:$libname.lib
45 fi
46
47 rm $library.base $library.exp 2>/dev/null