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
|
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for libg2
# Author: Andreas Tille <tille@debian.org>
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
pkglib=libg20
pkgdev=libg2-dev
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Using C 2023 and beyond causes build failures problematic to get fixed
# properly, because the structure dynamically accomodates for functions
# with variable number of arguments. See #1096666.
export DEB_CFLAGS_MAINT_APPEND = -std=gnu17
%:
dh $@
# Compile with -fPIC on all platforms
#override_dh_auto_configure:
# dh_auto_configure -- CFLAGS="$(dpkg-buildflags --get CFLAGS) -fPIC" FFLAGS="$(dpkg-buildflags --get FFLAGS) -fPIC"
# Use the latest version number in the CHANGES file
version:=$(shell head -n 1 CHANGES | \
awk '{if (match($$0,/^[0-9]+\.[0-9]+[A-Za-z]/)) print substr($$0,RSTART,RLENGTH)}')
rversion:=$(shell head -n 1 CHANGES | \
awk '{if (match($$0,/^[0-9]+\.[0-9]+/)) print substr($$0,RSTART,RLENGTH)}')
major:=$(shell head -n 1 CHANGES | \
awk '{if (match($$0,/^[0-9]+/)) print substr($$0,RSTART,RLENGTH)}')
# Locate autogenerated files that may need preservation.
infiles:=$(shell \
find $(CURDIR) -name '*.in' \
| sed 's/\.in//' \
| xargs -I'{}' sh -c 'test ! -e {} || echo {}' \
)
execute_before_dh_autoreconf:
# Preserve files that will be regenerated from .in files.
set -e $(foreach infile,$(infiles),; cp -v $(infile) $(infile).orig)
override_dh_auto_build:
$(MAKE) depend
$(MAKE) libg2.a DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)"
# clean up and build the shared lib
-rm -f src/*.o src/*/*.o
$(MAKE) \
PICFLAG="-fPIC" \
RVERSION=$(rversion) \
MVERSION=$(major) \
DEBCFLAGS="$(CPPFLAGS) $(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
shared
dh_auto_configure --sourcedirectory=g2_perl -- LIBS="-L$(CURDIR) -lg2"
$(MAKE) -C ./g2_perl LD_RUN_PATH=""
override_dh_auto_install:
$(MAKE) RVERSION=$(rversion) MVERSION=$(major) install prefix=$(CURDIR)/debian/libg2-dev
mv $(CURDIR)/debian/$(pkgdev)/usr/lib/lib*.so.0* $(CURDIR)/debian/$(pkglib)/usr/lib
$(MAKE) -C ./g2_perl install DESTDIR=$(CURDIR)/debian/libg2$(major)-perl
execute_after_dh_auto_clean:
# Restore files that were erased by previous autoreconfiguration.
set -e $(foreach infile,$(infiles), \
; test ! -e $(infile).orig \
|| mv -v $(infile).orig $(infile) \
)
|