glib/build-dll
Tor Lillqvist 77866eaf9b makefile.mingw.in tests/makefile.mingw.in Rename makefile.cygwin(.in) to
2000-05-13  Tor Lillqvist  <tml@iki.fi>

* makefile.mingw.in
* tests/makefile.mingw.in
* build-dll: Rename makefile.cygwin(.in) to
makefile.mingw(.in), which better describes what it is. Move the
build of gmodule, gthread and gobject DLLs to makefiles in those
directories. Move resource file handling and build number bump to
build-dll, where it sits much cleaner.

* README.win32
* Makefile.am (EXTRA_DIST): Update accordingly.

* glib.h: Add G_PI, G_PI_2, G_PI_4, G_E, G_LN2, G_LN10 and
G_SQRT2. M_PI etc aren't necessarily in <math.h> in strict ISO C
implementations.

* glib.def: Add g_strcanon.

* gtree.c (g_tree_node_rotate_left): Remove unused variables.

* gwin32.c (g_win32_opendir): Remove unneeded statement.

gmodule:

* makefile.mingw.in: New file, with gmodule stuff
moved from ../makefile.mingw.in.

* Makefile.am: Add to EXTRA_DIST, and add rule to make makefile.mingw.

gobject:
* makefile.mingw.in
* gobject.def
* gobject.rc.in: New files, for Win32 (mingw) build.

* Makefile.am: Add to EXTRA_DIST. Add rules to produce the
corresponding non-*.in files.

* gtype.h: (Win32:) Mark _g_type_fundamental_last for
export/import from DLL.

gthread:
* makefile.mingw.in: New file, with gthread stuff moved from
../makefile.mingw.in.

* Makefile.am: Add to EXTRA_DIST, add rule to build makefile.mingw.
2000-05-13 19:30:58 +00:00

76 lines
2.3 KiB
Bash

#!/bin/bash
# Temporary hack until building dlls is easier with gcc -mno-cygwin
# ("mingw32").
# This is usable with cygwin b20.1 and gcc-2.95.2 as distributed by
# Mumit Khan. For other combinations, no idea.
GCC="gcc"
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
*.[ao]) objs="$objs $F";;
esac
done
# Check if we have a resource file for this DLL.
resfile=""
if [ -f $library.rc ]; then
# Kludge to get the path to the win32 headers. Should work for both
# gcc running on cygwin, and bare mingw gcc, even if the make is
# running on cygwin (whew).
WIN32APIHEADERS=`echo "\#include <winver.h>" | $GCC -M -E - | tail -1 | sed -e 's![\\/]winver.h!!' | tr -d '\015'`
resfile=$library-win32res.o
objs="$objs $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 --include-dir $WIN32APIHEADERS $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 -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
# 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
rm $library.base $library.exp 2>/dev/null