chiark / gitweb /
Import debian/ directory from 2:8.38-3.1
[pcre3.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # These are used for cross-compiling and for saving the configure script
9 # from having to guess our platform (since we know it already)
10 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
11 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
12 DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
13
14 INSTALL = install
15 INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
16 INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
17 INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
18 INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
19
20 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
21 INSTALL_PROGRAM += -s
22 endif
23
24 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
25   NJOBS = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
26 endif
27
28 ENABLE_JIT=$(shell . debian/jit-test)
29
30 configure-stamp:
31         dh_testdir
32         # Add here commands to configure the package.
33         dh_autoreconf
34         CC_FOR_BUILD=cc ./configure \
35                 --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
36                 --prefix=/usr --mandir=\$${prefix}/share/man \
37                 --infodir=\$${prefix}/share/info \
38                 --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
39                 --enable-utf8 --enable-unicode-properties \
40                 --disable-silent-rules \
41                 $(ENABLE_JIT) \
42                 --enable-pcre16 \
43                 --enable-pcre32 \
44                 $(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --export=configure)
45         touch configure-stamp
46
47 build: build-arch build-indep
48 build-arch: build-stamp
49 build-indep: build-stamp
50 build-stamp:  configure-stamp
51         dh_testdir
52
53         # Add here commands to compile the package.
54         $(MAKE) $(NJOBS)
55 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
56         $(MAKE) check VERBOSE=1
57 endif
58
59         touch build-stamp
60
61 clean:
62         dh_testdir
63         dh_testroot
64         rm -f configure-stamp build-stamp
65         # Add here commands to clean up after the build process.
66         [ ! -f Makefile ] || $(MAKE) distclean
67 ###     -test -r /usr/share/misc/config.sub && \
68 ###       cp -f /usr/share/misc/config.sub config.sub
69 ###     -test -r /usr/share/misc/config.guess && \
70 ###       cp -f /usr/share/misc/config.guess config.guess
71         rm -f dftables testsavedregex
72         rm -f debian/libpcre3.symbols
73         rm -f debian/libpcre16-3.symbols
74         rm -f debian/libpcre32-3.symbols
75         dh_autoreconf_clean
76         dh_clean
77
78 install: build
79         dh_testdir
80         dh_testroot
81         dh_clean -k
82         dh_installdirs
83
84         # Add here commands to install the package into debian/tmp
85         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
86
87 # Build architecture-dependent files here.
88 binary-arch: build install
89         dh_testdir -a
90         dh_testroot -a
91         dh_install -a
92         # This man page is in the main package, don't want it in -dev
93         rm debian/libpcre3-dev/usr/share/man/man3/pcrepattern.3
94         # Move actual library to /lib
95         mkdir -p debian/libpcre3/lib/$(DEB_HOST_MULTIARCH)
96         mv debian/libpcre3/usr/lib/$(DEB_HOST_MULTIARCH)/libpcre.so.* debian/libpcre3/lib/$(DEB_HOST_MULTIARCH)
97         ln -sf /lib/$(DEB_HOST_MULTIARCH)/libpcre.so.3 debian/libpcre3-dev/usr/lib/$(DEB_HOST_MULTIARCH)/libpcre.so
98         # we never need to reference the library path in pcre-config on
99         # Debian, so clip it out so that the script will be multiarch-safe.
100         sed -i -e"s,/$(DEB_HOST_MULTIARCH),,g" debian/libpcre3-dev/usr/bin/pcre-config
101
102         dh_link -a
103
104 #       dh_installdebconf -a
105         dh_installdocs -a
106         dh_installexamples -a
107 #       dh_installmenu -a
108 #       dh_installlogrotate -a
109 #       dh_installemacsen -a
110 #       dh_installpam -a
111 #       dh_installmime -a
112 #       dh_installinit -a
113 #       dh_installcron -a
114         dh_installman -a
115         dh_installinfo -a
116 #       dh_undocumented -a
117         dh_installchangelogs -a ChangeLog
118         dh_strip -a --dbg-package=libpcre3-dbg
119         # Don't include pcregrep or libraries from udeb in debug package
120         rm -r debian/libpcre3-dbg/usr/lib/debug/usr/bin 
121         rm debian/libpcre3-dbg/usr/lib/debug/usr/lib/libpcre*
122         dh_compress -a
123         dh_fixperms -a
124 ifneq (,$(ENABLE_JIT))
125         sed -e 's/JIT//' debian/libpcre3.symbols.in > debian/libpcre3.symbols
126         sed -e 's/JIT//' debian/libpcre16-3.symbols.in > debian/libpcre16-3.symbols
127         sed -e 's/JIT//' debian/libpcre32-3.symbols.in > debian/libpcre32-3.symbols
128 else
129         sed -e 's/JIT/#/' debian/libpcre3.symbols.in > debian/libpcre3.symbols
130         sed -e 's/JIT/#/' debian/libpcre16-3.symbols.in > debian/libpcre16-3.symbols
131         sed -e 's/JIT/#/' debian/libpcre32-3.symbols.in > debian/libpcre32-3.symbols
132 endif
133         dh_makeshlibs -plibpcre3 --add-udeb="libpcre3-udeb" -V 'libpcre3 (>= 1:8.35)' -- -c4
134         dh_makeshlibs -plibpcrecpp0v5 -V 'libpcrecpp0v5 (>= 7.7)' -- -c4
135         dh_makeshlibs -plibpcre16-3 -plibpcre32-3 -- -c4
136         dh_installdeb -a
137 #       dh_perl -a
138         dh_shlibdeps -a -ldebian/libpcre3/usr/lib/$(DEB_HOST_MULTIARCH)
139         dh_gencontrol -a
140         dh_md5sums -a
141         dh_builddeb -a
142
143 binary-indep:
144
145 binary: binary-arch binary-indep
146 .PHONY: build clean binary-arch binary install