File: rules

package info (click to toggle)
cracklib2 2.9.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,228 kB
  • sloc: sh: 11,850; ansic: 2,652; xml: 365; python: 288; makefile: 218; sed: 16
file content (159 lines) | stat: -rwxr-xr-x 6,481 bytes parent folder | download
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
159
#!/usr/bin/make -f

DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/python/python.mk
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
PYVERS := $(shell pyversions -vs)
PY3VERS := $(shell py3versions -vs)
DH_WITH_PARAMETERS := python2,python3
# python2.7
export PYTHONPATH:=/usr/lib/python2.7/plat-$(DEB_HOST_MULTIARCH)$(if $(PYTHONPATH),:$(PYTHONPATH))
# python3.X, see pybuild for their meaning.
export _PYTHON_HOST_PLATFORM:=$(DEB_HOST_ARCH_OS)-$(DEB_HOST_ARCH)
export _PYTHON_SYSCONFIGDATA_NAME:=_sysconfigdata_m_$(DEB_HOST_ARCH_OS)_$(DEB_HOST_MULTIARCH)
else
NOPYTHON_OPTIONS = -Npython-cracklib -Npython3-cracklib
DH_WITH_PARAMETERS :=
endif

ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CRACKLIB_PACKER=$(CURDIR)/debian/buildtmp/base/util/cracklib-packer
else
CRACKLIB_PACKER=/usr/sbin/cracklib-packer
endif

override_dh_auto_configure:
	aclocal && libtoolize && automake --add-missing && autoreconf
	mkdir -p $(CURDIR)/debian/buildtmp/base
	cd $(CURDIR)/debian/buildtmp/base; \
	$(CURDIR)/configure \
		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr --disable-rpath --without-python \
		--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
		--with-default-dict=/var/cache/cracklib/cracklib_dict \
		CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
	for i in $(PYVERS) $(PY3VERS); do \
		mkdir -p $(CURDIR)/debian/buildtmp/python$$i; \
		cd $(CURDIR)/debian/buildtmp/python$$i; \
		$(CURDIR)/configure \
			--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
			--prefix=/usr --disable-rpath \
			--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
			--with-default-dict=/var/cache/cracklib/cracklib_dict \
			PYTHON_PREFIX=$(call py_builddir_sh,$$i) \
			PYTHON=/usr/bin/python$$i \
			CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \
	done

override_dh_auto_build:
	$(MAKE) -C $(CURDIR)/debian/buildtmp/base
ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
	ln -s $(CURDIR)/debian/crack.py $(CURDIR)/python; \
	for i in $(PYVERS) $(PY3VERS); do \
		cd $(CURDIR)/debian/buildtmp/python$$i; \
		rm -rf lib; ln -s $(CURDIR)/debian/buildtmp/base/lib lib; \
		cd python; \
		CFLAGS="-I$(CURDIR)/lib $(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" python$$i setup.py build ; \
	done
endif
	docbook2html -o debian/doc --nochunks debian/libcrack2.xml
	docbook2html -o debian/doc --nochunks debian/cracklib-runtime.xml

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir $(CURDIR)/debian/tmp
ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES))$(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	$(CRACKLIB_PACKER) $(CURDIR)/debian/tmp/cracklib_dict < \
	 $(CURDIR)/dicts/cracklib-small
	for i in $(PYVERS) $(PY3VERS); do \
		cd $(CURDIR)/debian/buildtmp/python$$i/python/$(call py_builddir_sh,$$i); \
		LD_LIBRARY_PATH=$(CURDIR)/debian/buildtmp/base/lib/.libs python$$i \
		-c 'import cracklib; cracklib.test(dictpath="$(CURDIR)/debian/tmp/cracklib_dict")'; \
	done
endif
endif

override_dh_auto_clean:
	rm -rf debian/buildtmp
	rm -rf debian/doc
	if [ -f Makefile ]; then $(MAKE) clean; fi
	if [ -f Makefile ]; then $(MAKE) distclean; fi
	# remove files created or modified by autogen.sh
	rm -f config.guess config.sub Makefile.in aclocal.m4 configure		\
	 dicts/Makefile.in doc/Makefile.in lib/Makefile.in m4/Makefile.in	\
	 py-compile python/Makefile.in util/Makefile.in ltmain.sh		\
	 m4/ltoptions.m4 m4/ltversion.m4 m4/libtool.m4 m4/ltsugar.m4		\
	 m4/lt~obsolete.m4 compile
	# remove files created or changed by build
	rm -rf python/crack.py python/cracklib.egg-info
	dh_auto_clean

override_dh_auto_install:
	$(MAKE) -C $(CURDIR)/debian/buildtmp/base DESTDIR=$(CURDIR)/debian/libcrack2 install
	# copy files for libcrack2-udeb
	mkdir -p $(CURDIR)/debian/libcrack2-udeb/usr/lib/$(DEB_HOST_MULTIARCH) \
		 $(CURDIR)/debian/libcrack2-udeb/usr/share/locale \
		 $(CURDIR)/debian/libcrack2-udeb/var/cache/cracklib
	cp -P $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.* \
	      $(CURDIR)/debian/libcrack2-udeb/usr/lib/$(DEB_HOST_MULTIARCH)
	cp -r $(CURDIR)/debian/libcrack2/usr/share/locale/* \
	      $(CURDIR)/debian/libcrack2-udeb/usr/share/locale
	$(CRACKLIB_PACKER) $(CURDIR)/debian/libcrack2-udeb/var/cache/cracklib/cracklib_dict < \
	    $(CURDIR)/dicts/cracklib-small
	# move files to libcrack2-dev
	mkdir -p $(CURDIR)/debian/libcrack2-dev/usr/lib/$(DEB_HOST_MULTIARCH)
	mv $(CURDIR)/debian/libcrack2/usr/include \
	   $(CURDIR)/debian/libcrack2-dev/usr
	mv $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.a \
	   $(CURDIR)/debian/libcrack2-dev/usr/lib/$(DEB_HOST_MULTIARCH)
	# move files to cracklib-runtime
	mkdir -p $(CURDIR)/debian/cracklib-runtime/usr/share/dict
	mv $(CURDIR)/debian/libcrack2/usr/sbin \
	   $(CURDIR)/debian/cracklib-runtime/usr
	mv $(CURDIR)/debian/libcrack2/usr/share/cracklib/cracklib-small \
	   $(CURDIR)/debian/cracklib-runtime/usr/share/dict
	# remove unused files
	rm -f $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.la \
	      $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so
	rm -rf $(CURDIR)/debian/libcrack2/usr/share/cracklib
	chrpath -d \
	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-check \
	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-packer \
	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-unpacker

ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
	for i in $(PYVERS); do \
		cd $(CURDIR)/debian/buildtmp/python$$i/python; \
		python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/python-cracklib; \
	done
	for i in $(PY3VERS); do \
		cd $(CURDIR)/debian/buildtmp/python$$i/python; \
		python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-cracklib; \
	done
endif

override_dh_link:
	dh_link -plibcrack2-dev usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so.2 \
		usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so
	dh_link

override_dh_installchangelogs:
	dh_installchangelogs NEWS

ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
override_dh_python2:
	dh_python2 -ppython-cracklib

override_dh_python3:
	dh_python3 -ppython3-cracklib
endif

%:
	dh $@ --with=$(DH_WITH_PARAMETERS) $(NOPYTHON_OPTIONS)