Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # debian/rules for libg2
4 # Author: Andreas Tille <[email protected]>
5
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
8
9 pkglib=libg20
10 pkgdev=libg2-dev
11
12 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
13 # Using C 2023 and beyond causes build failures problematic to get fixed
14 # properly, because the structure dynamically accomodates for functions
15 # with variable number of arguments. See #1096666.
16 export DEB_CFLAGS_MAINT_APPEND = -std=gnu17
17
18 %:
19 dh $@
20
21 # Compile with -fPIC on all platforms
22 #override_dh_auto_configure:
23 # dh_auto_configure -- CFLAGS="$(dpkg-buildflags --get CFLAGS) -fPIC" FFLAGS="$(dpkg-buildflags --get FFLAGS) -fPIC"
24
25 # Use the latest version number in the CHANGES file
26 version:=$(shell head -n 1 CHANGES | \
27 awk '{if (match($$0,/^[0-9]+\.[0-9]+[A-Za-z]/)) print substr($$0,RSTART,RLENGTH)}')
28 rversion:=$(shell head -n 1 CHANGES | \
29 awk '{if (match($$0,/^[0-9]+\.[0-9]+/)) print substr($$0,RSTART,RLENGTH)}')
30 major:=$(shell head -n 1 CHANGES | \
31 awk '{if (match($$0,/^[0-9]+/)) print substr($$0,RSTART,RLENGTH)}')
32
33 # Locate autogenerated files that may need preservation.
34 infiles:=$(shell \
35 find $(CURDIR) -name '*.in' \
36 | sed 's/\.in//' \
37 | xargs -I'{}' sh -c 'test ! -e {} || echo {}' \
38 )
39
40 execute_before_dh_autoreconf:
41 # Preserve files that will be regenerated from .in files.
42 set -e $(foreach infile,$(infiles),; cp -v $(infile) $(infile).orig)
43
44 override_dh_auto_build:
45 $(MAKE) depend
46 $(MAKE) libg2.a DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)"
47 # clean up and build the shared lib
48 -rm -f src/*.o src/*/*.o
49 $(MAKE) \
50 PICFLAG="-fPIC" \
51 RVERSION=$(rversion) \
52 MVERSION=$(major) \
53 DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" \
54 LDFLAGS="$(LDFLAGS)" \
55 shared
56 dh_auto_configure --sourcedirectory=g2_perl -- LIBS="-L$(CURDIR) -lg2"
57 $(MAKE) -C ./g2_perl LD_RUN_PATH=""
58
59 override_dh_auto_install:
60 $(MAKE) RVERSION=$(rversion) MVERSION=$(major) install prefix=$(CURDIR)/debian/libg2-dev
61 mv $(CURDIR)/debian/$(pkgdev)/usr/lib/lib*.so.0* $(CURDIR)/debian/$(pkglib)/usr/lib
62 $(MAKE) -C ./g2_perl install DESTDIR=$(CURDIR)/debian/libg2$(major)-perl
63
64 execute_after_dh_auto_clean:
65 # Restore files that were erased by previous autoreconfiguration.
66 set -e $(foreach infile,$(infiles), \
67 ; test ! -e $(infile).orig \
68 || mv -v $(infile).orig $(infile) \
69 )