]>
Commit | Line | Data |
---|---|---|
54a3cb1d JR |
1 | #!/bin/sh -e |
2 | # 01-libtoolise.dpatch by Peter Collingbourne <peter@peter.uk.to> | |
3 | # DP: Libtoolises the makefiles, removes -lm where not necessary. | |
4 | # DP: Original version by Heinz Wiesinger <pprkut@liwjatan.at> | |
5 | ||
6 | PATCHED_DIRS=". apps.src ladr mace4.src provers.src test.src" | |
7 | ||
8 | if [ "x$2" = "x" ]; then | |
9 | DIR=. | |
10 | else | |
11 | DIR="$2" | |
12 | fi | |
13 | ||
14 | # $1 = path to source directory ($DIR) | |
15 | do_patch(){ | |
16 | sed -i "s/\$(MAKE) lib/\$(MAKE) lib XFLAGS+=-D_REENTRANT/" "$1/Makefile" | |
17 | ||
18 | for i in apps.src mace4.src; do | |
19 | sed -i "s|/bin/mv|libtool --mode=install /bin/cp|" "$1/$i/Makefile" | |
20 | done | |
21 | ||
22 | for i in apps.src mace4.src provers.src; do | |
23 | sed -i "s| ../bin| \`pwd\`/../bin|" "$1/$i/Makefile" | |
24 | done | |
25 | ||
26 | for i in apps.src ladr mace4.src provers.src test.src; do | |
27 | if [ "$i" = "provers.src" ]; then | |
28 | sed -i "s|/bin/rm -f \*.o|libtool --mode=clean /bin/rm -f \*.o|g" "$1/$i/Makefile" | |
29 | sed -i "s|/bin/cp|libtool --mode=install /bin/cp|" "$1/$i/Makefile" | |
30 | else | |
31 | sed -i "s|/bin/rm -f|libtool --mode=clean /bin/rm -f|g" "$1/$i/Makefile" | |
32 | fi | |
33 | ||
34 | if [ "$i" = "mace4.src" ]; then | |
35 | sed -i "s/libladr.a/libladr.la/" "$1/$i/Makefile" | |
36 | else | |
37 | sed -i "s/\.a/\.la/g" "$1/$i/Makefile" | |
38 | fi | |
39 | ||
40 | if [ "$i" = "ladr" ]; then | |
41 | sed -i "s/\.o/\.lo/g" "$1/$i/Makefile" | |
42 | else | |
43 | sed -i "s/\$(CC)/libtool --mode=link --tag=CC \$(CC) \$(LDFLAGS)/" "$1/$i/Makefile" | |
44 | fi | |
45 | done | |
46 | ||
47 | sed -i "s/-lm //" "$1/provers.src/Makefile" | |
48 | ||
49 | patch -p1 -d "$1" <<"EOP" | |
50 | diff -U 3 -H -b -B -d -r -N -- LADR-2008-06A-orig/ladr/Makefile LADR-2008-06A/ladr/Makefile | |
51 | --- LADR-2008-06A-orig/ladr/Makefile 2008-06-12 16:39:09.000000000 +0200 | |
52 | +++ LADR-2008-06A/ladr/Makefile 2008-08-03 15:23:06.214318210 +0200 | |
53 | @@ -36,7 +36,10 @@ | |
54 | $(INFE_OBJ) $(MODL_OBJ) $(MISC_OBJ) | |
55 | ||
56 | libladr.la: $(OBJECTS) | |
57 | - $(AR) rs libladr.la $(OBJECTS) | |
58 | + libtool --mode=link --tag=CC $(CC) $(LDFLAGS) -rpath /usr/lib -version-info 4:0:0 -o libladr.la $(OBJECTS) -lm | |
59 | + | |
60 | +%.lo: %.c | |
61 | + libtool --mode=compile --tag=CC $(CC) -c $(CFLAGS) $(XFLAGS) -o $@ $< | |
62 | ||
63 | ############################################################################## | |
64 | ||
65 | EOP | |
66 | ||
67 | } | |
68 | ||
69 | # $1 = path to source directory ($DIR) | |
70 | # $2 = from | |
71 | # $3 = to | |
72 | move_makefiles(){ | |
73 | if [ "$2" = "Makefile" ]; then | |
74 | CMD="cp" | |
75 | else | |
76 | CMD="mv" | |
77 | fi | |
78 | for i in . apps.src ladr mace4.src provers.src test.src; do | |
79 | $CMD "$1/$i/$2" "$1/$i/$3" | |
80 | done | |
81 | ||
82 | } | |
83 | ||
84 | if [ "$1" = "-patch" ]; then | |
85 | move_makefiles $DIR "Makefile" "Makefile.pre-libtool-patch" | |
86 | do_patch $DIR | |
87 | elif [ "$1" = "-unpatch" ]; then | |
88 | move_makefiles $DIR "Makefile.pre-libtool-patch" "Makefile" | |
89 | elif [ "$1" = "--patch" ]; then | |
90 | do_patch $DIR | |
91 | else | |
92 | echo "Unrecognised parameter: $1" | |
93 | fi |