Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 include /usr/share/dpkg/pkg-info.mk
3
4 DOPACKAGES := $(shell dh_listpackages)
5 BUILD_TARGETS :=
6
7 ifneq ($(filter libcrypt1,$(DOPACKAGES)),)
8 BUILD_DEB1 := 1
9 BUILD_DEV_VER := 1
10 BUILD_TARGETS += build-deb1/.stamp
11 endif
12 ifneq ($(filter libcrypt2,$(DOPACKAGES)),)
13 BUILD_DEB2 := 1
14 BUILD_DEV_VER := 2
15 BUILD_TARGETS += build-deb2/.stamp
16 endif
17 ifneq ($(filter libcrypt1-udeb,$(DOPACKAGES)),)
18 BUILD_UDEB := 1
19 BUILD_TARGETS += build-udeb/.stamp
20 endif
21
22 ifeq ($(filter noudeb, $(DEB_BUILD_PROFILES)), noudeb)
23 BUILD_UDEB :=
24 NO_PACKAGE := --no-package=libcrypt1-udeb
25 endif
26
27 D := $(CURDIR)/debian/libcrypt1
28 DD := $(CURDIR)/debian/libcrypt-dev
29 D2 := $(CURDIR)/debian/libcrypt2
30 DU := $(CURDIR)/debian/libcrypt1-udeb
31 DS := $(CURDIR)/debian/libxcrypt-source
32
33 CONFFLAGS = --disable-werror --prefix=/usr \
34 --disable-xcrypt-compat-files --enable-obsolete-api=glibc
35 CONFFLAGS_deb1 = $(CONFFLAGS) \
36 $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \
37 dpkg-buildflags --export=configure || true) \
38 --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
39 CONFFLAGS_deb2 = $(subst api=glibc,api=no,$(CONFFLAGS_deb1)) \
40 --includedir=/usr/include/$(DEB_HOST_MULTIARCH)
41 CONFFLAGS_udeb = $(CONFFLAGS) \
42 $(subst -O2,-Os -fomit-frame-pointer,$(shell DEB_BUILD_MAINT_OPTIONS="hardening=-all" \
43 dpkg-buildflags --export=configure || true)) \
44 --libdir=/usr/lib
45
46 ##############################################################################
47 %:
48 dh $@ --reload-all-buildenv-variables $(NO_PACKAGE)
49
50 override_dh_clean:
51 rm -rf build-deb* build-udeb*
52 dh_clean debian/copyright
53
54 build-deb1/config.status:
55 dh_auto_configure --builddir=build-deb1 -- $(CONFFLAGS_deb1)
56 sh debian/patch_libtool build-deb1
57
58 build-deb2/config.status:
59 dh_auto_configure --builddir=build-deb2 -- $(CONFFLAGS_deb2)
60
61 build-udeb/config.status:
62 dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb)
63 sh debian/patch_libtool build-udeb
64
65 override_dh_auto_configure:
66
67 build-deb1/.stamp: build-deb1/config.status
68 dh_auto_build --builddir=build-deb1
69 touch $@
70
71 build-deb2/.stamp: build-deb2/config.status
72 dh_auto_build --builddir=build-deb2
73 touch $@
74
75 build-udeb/.stamp: build-udeb/config.status
76 # ignore the blhc false positives (see CONFFLAGS_udeb)
77 @echo 'blhc: ignore-line-regexp: libtool: compile: +[^ ]*gcc .+ -Os -fomit-frame-pointer .+'
78 @echo 'blhc: ignore-line-regexp: [^ ]*gcc .+ -Os -fomit-frame-pointer .+'
79 dh_auto_build --builddir=build-udeb
80 touch $@
81
82 override_dh_auto_build: $(BUILD_TARGETS)
83
84 override_dh_auto_test:
85 ifdef BUILD_DEB1
86 dh_auto_test --builddir=build-deb1 -- check
87 else
88 ifdef BUILD_DEB2
89 dh_auto_test --builddir=build-deb2 -- check
90 endif
91 endif
92
93 override_dh_auto_install:
94 ifdef BUILD_DEB1
95 cd build-deb1/ && \
96 $(MAKE) install DESTDIR=$D
97
98 ifeq ($(BUILD_DEV_VER), 1)
99 dh_movefiles -plibcrypt-dev --sourcedir=debian/libcrypt1/
100 else
101 cd $D && echo $(shell sed -re 's#^/##' $(CURDIR)/debian/libcrypt-dev.files) | xargs echo rm -rf
102 endif
103 rm $D/usr/lib/*/*.la
104 rmdir --parents --ignore-fail-on-non-empty \
105 $$(find $D -type d -empty) $$(find $(DD) -type d -empty)
106 endif
107
108 ifdef BUILD_DEB2
109 cd build-deb2/ && \
110 $(MAKE) install DESTDIR=$(D2)
111
112 ifeq ($(BUILD_DEV_VER), 2)
113 dh_movefiles -plibcrypt-dev --sourcedir=debian/libcrypt2/
114 else
115 cd $(D2) && echo $(shell sed -re 's#^/##' $(CURDIR)/debian/libcrypt-dev.files) | xargs echo rm -rf
116 endif
117 rm $(D2)/usr/lib/*/*.la
118 rmdir --parents --ignore-fail-on-non-empty \
119 $$(find $(D2) -type d -empty) $$(find $(DD) -type d -empty)
120 endif
121
122 ifdef BUILD_UDEB
123 cd build-udeb/ && \
124 $(MAKE) install-exec DESTDIR=$(DU)
125 rm $(DU)/usr/lib/*.a $(DU)/usr/lib/*.la $(DU)/usr/lib/*.so
126 endif
127
128 mkdir -p $(DS)/usr/src/libxcrypt/
129 find * -print0 | \
130 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$$))' | \
131 LC_ALL=C sort -z | \
132 tar cf - \
133 --no-recursion --null --files-from=- \
134 --clamp-mtime --mtime "@$(SOURCE_DATE_EPOCH)" \
135 --mode=go=rX,u+rw,a-s \
136 --owner=root --group=root --numeric-owner \
137 | tar xf - -C $(DS)/usr/src/libxcrypt/
138
139 execute_before_dh_installdocs:
140 cat debian/copyright.in LICENSING > debian/copyright
141
142 override_dh_installchangelogs:
143 dh_installchangelogs -XChangeLog NEWS
144
145 override_dh_makeshlibs:
146 ifdef BUILD_DEB1
147 dh_makeshlibs -plibcrypt1 -- -c4
148 endif
149 ifdef BUILD_DEB2
150 dh_makeshlibs -plibcrypt2 -- -c4
151 endif
152
153 override_dh_shlibdeps:
154 dh_shlibdeps -- --warnings=7
155
156 override_dh_gencontrol:
157 dh_gencontrol $@ -- -VLIBPKG=libcrypt$(BUILD_DEV_VER)
158