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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
DOPACKAGES := $(shell dh_listpackages)
BUILD_TARGETS :=
ifneq ($(filter libcrypt1,$(DOPACKAGES)),)
BUILD_DEB1 := 1
BUILD_DEV_VER := 1
BUILD_TARGETS += build-deb1/.stamp
endif
ifneq ($(filter libcrypt2,$(DOPACKAGES)),)
BUILD_DEB2 := 1
BUILD_DEV_VER := 2
BUILD_TARGETS += build-deb2/.stamp
endif
ifneq ($(filter libcrypt1-udeb,$(DOPACKAGES)),)
BUILD_UDEB := 1
BUILD_TARGETS += build-udeb/.stamp
endif
ifeq ($(filter noudeb, $(DEB_BUILD_PROFILES)), noudeb)
BUILD_UDEB :=
NO_PACKAGE := --no-package=libcrypt1-udeb
endif
D := $(CURDIR)/debian/libcrypt1
DD := $(CURDIR)/debian/libcrypt-dev
D2 := $(CURDIR)/debian/libcrypt2
DU := $(CURDIR)/debian/libcrypt1-udeb
DS := $(CURDIR)/debian/libxcrypt-source
CONFFLAGS = --disable-werror --prefix=/usr \
--disable-xcrypt-compat-files --enable-obsolete-api=glibc
CONFFLAGS_deb1 = $(CONFFLAGS) \
$(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \
dpkg-buildflags --export=configure || true) \
--libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
CONFFLAGS_deb2 = $(subst api=glibc,api=no,$(CONFFLAGS_deb1)) \
--includedir=/usr/include/$(DEB_HOST_MULTIARCH)
CONFFLAGS_udeb = $(CONFFLAGS) \
$(subst -O2,-Os -fomit-frame-pointer,$(shell DEB_BUILD_MAINT_OPTIONS="hardening=-all" \
dpkg-buildflags --export=configure || true)) \
--libdir=/usr/lib
##############################################################################
%:
dh $@ --reload-all-buildenv-variables $(NO_PACKAGE)
override_dh_clean:
rm -rf build-deb* build-udeb*
dh_clean debian/copyright
build-deb1/config.status:
dh_auto_configure --builddir=build-deb1 -- $(CONFFLAGS_deb1)
sh debian/patch_libtool build-deb1
build-deb2/config.status:
dh_auto_configure --builddir=build-deb2 -- $(CONFFLAGS_deb2)
build-udeb/config.status:
dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb)
sh debian/patch_libtool build-udeb
override_dh_auto_configure:
build-deb1/.stamp: build-deb1/config.status
dh_auto_build --builddir=build-deb1
touch $@
build-deb2/.stamp: build-deb2/config.status
dh_auto_build --builddir=build-deb2
touch $@
build-udeb/.stamp: build-udeb/config.status
# ignore the blhc false positives (see CONFFLAGS_udeb)
@echo 'blhc: ignore-line-regexp: libtool: compile: +[^ ]*gcc .+ -Os -fomit-frame-pointer .+'
@echo 'blhc: ignore-line-regexp: [^ ]*gcc .+ -Os -fomit-frame-pointer .+'
dh_auto_build --builddir=build-udeb
touch $@
override_dh_auto_build: $(BUILD_TARGETS)
override_dh_auto_test:
ifdef BUILD_DEB1
dh_auto_test --builddir=build-deb1 -- check
else
ifdef BUILD_DEB2
dh_auto_test --builddir=build-deb2 -- check
endif
endif
override_dh_auto_install:
ifdef BUILD_DEB1
cd build-deb1/ && \
$(MAKE) install DESTDIR=$D
ifeq ($(BUILD_DEV_VER), 1)
dh_movefiles -plibcrypt-dev --sourcedir=debian/libcrypt1/
else
cd $D && echo $(shell sed -re 's#^/##' $(CURDIR)/debian/libcrypt-dev.files) | xargs echo rm -rf
endif
rm $D/usr/lib/*/*.la
rmdir --parents --ignore-fail-on-non-empty \
$$(find $D -type d -empty) $$(find $(DD) -type d -empty)
endif
ifdef BUILD_DEB2
cd build-deb2/ && \
$(MAKE) install DESTDIR=$(D2)
ifeq ($(BUILD_DEV_VER), 2)
dh_movefiles -plibcrypt-dev --sourcedir=debian/libcrypt2/
else
cd $(D2) && echo $(shell sed -re 's#^/##' $(CURDIR)/debian/libcrypt-dev.files) | xargs echo rm -rf
endif
rm $(D2)/usr/lib/*/*.la
rmdir --parents --ignore-fail-on-non-empty \
$$(find $(D2) -type d -empty) $$(find $(DD) -type d -empty)
endif
ifdef BUILD_UDEB
cd build-udeb/ && \
$(MAKE) install-exec DESTDIR=$(DU)
rm $(DU)/usr/lib/*.a $(DU)/usr/lib/*.la $(DU)/usr/lib/*.so
endif
mkdir -p $(DS)/usr/src/libxcrypt/
find * -print0 | \
egrep --null-data --invert-match '^(INSTALL$$|Makefile\.in$$|build-|aclocal\.m4$$|autom4te\.cache(/|$$)|config\.h\.in$$|configure$$|m4/config\.guess$$|m4/config\.sub$$|debian/($$|\.|libcrypt[12]?(|-dev|-udeb)(/|$$)|libxcrypt-source(/|$$)|autoreconf\.|copyright$$|debhelper-build-stamp$$|files$$|patches(/|$$)|.+\.debhelper\.log$$|.+\.substvars$$))' | \
LC_ALL=C sort -z | \
tar cf - \
--no-recursion --null --files-from=- \
--clamp-mtime --mtime "@$(SOURCE_DATE_EPOCH)" \
--mode=go=rX,u+rw,a-s \
--owner=root --group=root --numeric-owner \
| tar xf - -C $(DS)/usr/src/libxcrypt/
execute_before_dh_installdocs:
cat debian/copyright.in LICENSING > debian/copyright
override_dh_installchangelogs:
dh_installchangelogs -XChangeLog NEWS
override_dh_makeshlibs:
ifdef BUILD_DEB1
dh_makeshlibs -plibcrypt1 -- -c4
endif
ifdef BUILD_DEB2
dh_makeshlibs -plibcrypt2 -- -c4
endif
override_dh_shlibdeps:
dh_shlibdeps -- --warnings=7
override_dh_gencontrol:
dh_gencontrol $@ -- -VLIBPKG=libcrypt$(BUILD_DEV_VER)
|