summaryrefslogtreecommitdiff
path: root/w32-dll/build-dll
blob: 153ddf60aa4171be345c85f60e921db02183700c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# Run this to generate the libgcrypt W32 DLL
#
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

AS=`mingw32 --get-path as`
OBJS=

grep "#define HAVE_DOSISH_SYSTEM" ../config.h
if [ $? = 1 ]; then
    exit
fi

for i in $(ls ../cipher/*.o); do
	OBJS="$OBJS $i"
done
for i in $(ls ../mpi/*.o); do
	OBJS="$OBJS $i"
done
for i in $(ls ../src/*.o); do
	OBJS="$OBJS $i"
done

# add asm code which is postfixed with .lo
OBJS="$OBJS ../mpi/mpih-sub1.lo ../mpi/mpih-add1.lo ../mpi/mpih-lshift.lo"
OBJS="$OBJS ../mpi/mpih-mul2.lo ../mpi/mpih-mul1.lo ../mpi/mpih-rshift.lo"
OBJS="$OBJS ../mpi/mpih-mul3.lo"

echo 'running dlltool the first time' >&2
mingw32 dlltool --nodelete  \
	--as $AS \
	--def libgcrypt.def \
	--output-exp libgcrypt.exp \
	--output-lib libgcrypt.imp \
	--dllname libgcrypt.dll $OBJS
echo 'doing dummy link to create the base file' >&2
mingw32 gcc -mdll -Wl,--base-file -Wl,libgcrypt.base \
   			-o libgcrypt.dll libgcrypt.exp $OBJS
echo 'running dlltool the second time' >&2
mingw32 dlltool --nodelete \
		--as $AS \
		--def libgcrypt.def \
		--output-exp libgcrypt.exp \
        --output-lib libgcrypt.imp \
		--base-file libgcrypt.base \
		--dllname libgcrypt.dll $OBJS

echo 'doing final link' >&2
mingw32 gcc -mdll -o libgcrypt.dll libgcrypt.exp $OBJS
mingw32 strip libgcrypt.dll

mingw32 dlltool --def libgcrypt.def \
			--as $AS \
			--dllname libgcrypt.dll \
			--output-lib libgcrypt.lib

echo 'clean up'
rm -f dh.o dh.s dt.o dt.s
rm -f libgcrypt.base libgcrypt.exp libgcrypt.imp tlibgcrypt.exp