File: rl-deb-build.dpatch

package info (click to toggle)
bash 2.05b-2-26
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,336 kB
  • ctags: 50
  • sloc: sh: 45,451; makefile: 446; ansic: 268
file content (85 lines) | stat: -rw-r--r-- 2,226 bytes parent folder | download | duplicates (3)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /bin/sh -e

if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $pdir -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

# DP: Debian specific patches that allow libreadline to be built
# DP: as a static _and_ a shared library.

--- ./lib/readline/Makefile.in~	Thu Feb 18 18:12:41 1999
+++ ./lib/readline/Makefile.in	Thu Nov 11 13:35:06 1999
@@ -5,7 +5,8 @@
 #############################################################################
 
 srcdir = @srcdir@
-VPATH = .:@srcdir@
+vpath %.c $(srcdir)
+vpath %.h $(srcdir)
 topdir = @top_srcdir@
 BUILD_DIR = @BUILD_DIR@
 
@@ -32,12 +33,16 @@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 
-DEFS = @DEFS@
+ifndef NOFPIC
+PICFLAGS = -fPIC
+endif
+
+DEFS = @DEFS@ -D_REENTRANT
 LOCAL_DEFS = @LOCAL_DEFS@
 
 INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
 
-CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS) $(PICFLAGS)
 
 .c.o:
 	${RM} $@
@@ -86,7 +91,22 @@
 
 ##########################################################################
 
-all: libreadline.a libhistory.a
+all: libreadline.so libhistory.so staticlibs
+
+staticlibs:
+	test -d static || mkdir static
+	$(MAKE) -C static -f $(BUILD_DIR)/lib/readline/Makefile \
+		srcdir=$(srcdir) NOFPIC=1 libreadline.a libhistory.a
+
+libreadline.so: $(OBJECTS)
+	$(RM) -f $@
+	$(CC) $(LDFLAGS) -shared -Wl,-soname,libreadline.so.$(SOVERSION) \
+		-o libreadline.so $(OBJECTS) -lncurses
+
+libhistory.so: history.o
+	$(RM) -f $@
+	$(CC) $(LDFLAGS) -shared -Wl,-soname,libhistory.so.$(SOVERSION) \
+		-o libhistory.so $(HISTOBJ) xmalloc.o
 
 libreadline.a: $(OBJECTS)
 	$(RM) $@
@@ -117,7 +137,8 @@
 	$(CTAGS) $(CSOURCES) $(HSOURCES)
 
 clean:	force
-	$(RM) $(OBJECTS) *.a
+	-$(RM) $(OBJECTS) *.a *.so
+	-$(RM) -r static
 	-( cd doc && $(MAKE) $(MFLAGS) $@ )
 
 mostlyclean: clean