Add G_GNUC_PURE macro (but don't use it anywhere).
[platform/upstream/glib.git] / build-dll
index ef3aa73..61efb01 100644 (file)
--- a/build-dll
+++ b/build-dll
@@ -1,14 +1,13 @@
 #!/bin/bash
 
-# Temporary hack until building dlls or executables with exported
-# entry points is easier with gcc -mno-cygwin ("mingw32").
+# Temporary hack until building dlls is easier with gcc -mno-cygwin
+# ("mingw32").
 
-# This is usable with cygwin b20.1 and egcs-2.91.66 19990314
-# (egcs-1.1.2 release) or gcc-2.95 as distributed by Mumit Khan. For
-# other combinations, no idea.
+# This is usable with cygwin 1.1.x and gcc-2.95.2 for mingw as
+# distributed by Mumit Khan. For other combinations, no idea.
 
-GCC=gcc
-DLLTOOL=dlltool
+GCC="gcc"
+DLLTOOL="dlltool"
 AS=as
 
 library=$1; shift
@@ -29,9 +28,34 @@ for F in $ldargs; do
     esac
 done
 
-$GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
+# Check if we have a resource file for this DLL.
+resfile=""
+if [ -f $library.rc ]; then
+    resfile=$library-win32res.o
+    objs="$objs $resfile"
+    ldargs="$ldargs $resfile"
+
+    # Check if we have a build number stamp file.
+    if [ -f $library-build.stamp ]; then
+       read number <$library-build.stamp
+       buildnumber=$[number+1]
+       echo Build number is $buildnumber
+       echo $buildnumber >$library-build.stamp
+    else
+       echo Using zero as build number
+        buildnumber=0
+    fi
+
+    m4 -DBUILDNUMBER=$buildnumber <$library.rc >$library-win32res.rc
+    windres $library-win32res.rc $library-win32res.o
+    rm $library-win32res.rc
+fi
+
+# Build the DLL.
+
+$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
-$GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
+$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
 $GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs