xref: /unit/pkg/deb/debian/rules.in (revision 2027)
1373Sdefan@nginx.com#!/usr/bin/make -f
2373Sdefan@nginx.com
3373Sdefan@nginx.com# Uncomment this to turn on verbose mode.
4373Sdefan@nginx.com#export DH_VERBOSE=1
5373Sdefan@nginx.com
6442Sdefan@nginx.comexport DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
7442Sdefan@nginx.comexport DEB_CFLAGS_MAINT_APPEND=-Wp,-D_FORTIFY_SOURCE=2 -fPIC
8442Sdefan@nginx.comexport DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed -pie
9442Sdefan@nginx.comDPKG_EXPORT_BUILDFLAGS = 1
10442Sdefan@nginx.cominclude /usr/share/dpkg/buildflags.mk
11442Sdefan@nginx.com
12815Sdefan@nginx.comDEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
131765Sdefan@nginx.comCODENAME := $(shell lsb_release -cs)
14815Sdefan@nginx.com
15373Sdefan@nginx.comBUILDDIR_unit = $(CURDIR)/debian/build-unit
16373Sdefan@nginx.comBUILDDIR_unit_debug = $(CURDIR)/debian/build-unit-debug
17373Sdefan@nginx.comINSTALLDIR = $(CURDIR)/debian/unit
18815Sdefan@nginx.comINSTALLDIR_dev = $(CURDIR)/debian/unit-dev
19373Sdefan@nginx.comBASEDIR = $(CURDIR)
20373Sdefan@nginx.com
21373Sdefan@nginx.comDOTESTS = 0
22373Sdefan@nginx.com
23373Sdefan@nginx.comconfig.env.%:
24373Sdefan@nginx.com	dh_testdir
25373Sdefan@nginx.com	mkdir -p $(BUILDDIR_$*)
26373Sdefan@nginx.com	cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/
27373Sdefan@nginx.com	cp -Pa $(CURDIR)/configure $(BUILDDIR_$*)/
28373Sdefan@nginx.com	cp -Pa $(CURDIR)/src $(BUILDDIR_$*)/
29373Sdefan@nginx.com	cp -Pa $(CURDIR)/test $(BUILDDIR_$*)/
30957Sdefan@nginx.com	cp -Pa $(CURDIR)/version $(BUILDDIR_$*)/
31980Sdefan@nginx.com	cp -Pa $(CURDIR)/CHANGES $(BUILDDIR_$*)/
32980Sdefan@nginx.com	cp -Pa $(CURDIR)/LICENSE $(BUILDDIR_$*)/
33980Sdefan@nginx.com	cp -Pa $(CURDIR)/NOTICE $(BUILDDIR_$*)/
34980Sdefan@nginx.com	cp -Pa $(CURDIR)/README $(BUILDDIR_$*)/
351316Smax.romanov@nginx.com	cp -Pa $(CURDIR)/go $(BUILDDIR_$*)/
361826Sthresh@nginx.com	mkdir -p $(BUILDDIR_$*)/docs/man
371826Sthresh@nginx.com	cp -Pa $(CURDIR)/docs/man/unitd.8.in $(BUILDDIR_$*)/docs/man/
38373Sdefan@nginx.com	touch $@
39373Sdefan@nginx.com
40373Sdefan@nginx.comconfigure.unit: config.env.unit
41373Sdefan@nginx.com	cd $(BUILDDIR_unit) && \
42442Sdefan@nginx.com	CFLAGS= ./configure \
43373Sdefan@nginx.com		%%CONFIGURE_ARGS%% \
44442Sdefan@nginx.com		--modules=/usr/lib/unit/modules \
45815Sdefan@nginx.com		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
46442Sdefan@nginx.com		--cc-opt="$(CFLAGS)" \
47442Sdefan@nginx.com		--ld-opt="$(LDFLAGS)"
48373Sdefan@nginx.com	touch $@
49373Sdefan@nginx.com
50373Sdefan@nginx.comconfigure.unit_debug: config.env.unit_debug
51373Sdefan@nginx.com	cd $(BUILDDIR_unit_debug) && \
52442Sdefan@nginx.com	CFLAGS= ./configure \
53373Sdefan@nginx.com		%%CONFIGURE_ARGS%% \
54373Sdefan@nginx.com		--modules=/usr/lib/unit/debug-modules \
55815Sdefan@nginx.com		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
56442Sdefan@nginx.com		--cc-opt="$(CFLAGS)" \
57442Sdefan@nginx.com		--ld-opt="$(LDFLAGS)" \
58373Sdefan@nginx.com		--debug
59373Sdefan@nginx.com	touch $@
60373Sdefan@nginx.com
61373Sdefan@nginx.combuild-arch.%: configure.%
62373Sdefan@nginx.com	dh_testdir
63373Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*)
64815Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*) build/libunit.a
65373Sdefan@nginx.comifeq ($(DOTESTS), 1)
66373Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*) tests
67373Sdefan@nginx.comendif
68373Sdefan@nginx.com	touch $@
69373Sdefan@nginx.com
70373Sdefan@nginx.comdo.tests: build
71373Sdefan@nginx.com	dh_testdir
72373Sdefan@nginx.comifeq ($(DOTESTS), 1)
73373Sdefan@nginx.com	cd $(BUILDDIR_unit) && ./build/tests
74373Sdefan@nginx.com	cd $(BUILDDIR_unit_debug) && ./build/tests
75373Sdefan@nginx.comendif
76373Sdefan@nginx.com	touch $@
77373Sdefan@nginx.com
78373Sdefan@nginx.combuild-indep:
79373Sdefan@nginx.com	dh_testdir
80373Sdefan@nginx.com	touch $@
81373Sdefan@nginx.com
82373Sdefan@nginx.combuild-arch: build-arch.unit build-arch.unit_debug
83373Sdefan@nginx.com	dh_testdir
84373Sdefan@nginx.com	touch $@
85373Sdefan@nginx.com
86373Sdefan@nginx.combuild: build-arch build-indep
87373Sdefan@nginx.com	dh_testdir
88373Sdefan@nginx.com	touch $@
89373Sdefan@nginx.com
90373Sdefan@nginx.comclean:
91373Sdefan@nginx.com	dh_testdir
92373Sdefan@nginx.com	dh_testroot
93373Sdefan@nginx.com	dh_clean
94373Sdefan@nginx.com	find $(CURDIR) -maxdepth 1 -size 0 -delete
95957Sdefan@nginx.com	rm -rf $(BUILDDIR_unit) $(BUILDDIR_unit_debug)
96373Sdefan@nginx.com
97373Sdefan@nginx.cominstall: build do.tests
98373Sdefan@nginx.com	dh_testdir
99373Sdefan@nginx.com	dh_testroot
100373Sdefan@nginx.com	dh_prep
101373Sdefan@nginx.com	dh_installdirs
102*2027Sdefan@nginx.com	dh_installsystemd -punit --name=unit unit.service
103*2027Sdefan@nginx.com	dh_installsystemd -punit --name=unit-debug --no-start --no-enable unit-debug.service
104373Sdefan@nginx.com	dh_installlogrotate
105373Sdefan@nginx.com	cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR) make install
106815Sdefan@nginx.com	cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR_dev) make libunit-install
107373Sdefan@nginx.com	install -m 755 $(BUILDDIR_unit_debug)/build/unitd $(INSTALLDIR)/usr/sbin/unitd-debug
108815Sdefan@nginx.com	install -m 644 $(BUILDDIR_unit_debug)/build/libunit.a $(INSTALLDIR_dev)/usr/lib/$(DEB_HOST_MULTIARCH)/libunit-debug.a
109373Sdefan@nginx.com	mkdir -p $(INSTALLDIR)/usr/share/doc/unit/examples
110373Sdefan@nginx.com	install -m 644 debian/unit.example.config $(INSTALLDIR)/usr/share/doc/unit/examples/example.config
1111749Sdefan@nginx.com	install -m 644 CHANGES $(INSTALLDIR)/usr/share/doc/unit/changelog
112373Sdefan@nginx.com	install -m 644 README $(INSTALLDIR)/usr/share/doc/unit/
1131749Sdefan@nginx.com	install -m 644 NOTICE $(INSTALLDIR)/usr/share/doc/unit/
114373Sdefan@nginx.com
115373Sdefan@nginx.combinary-indep: build install
116373Sdefan@nginx.com	dh_testdir
117373Sdefan@nginx.com	dh_testroot
118373Sdefan@nginx.com	dh_installdocs
1191826Sthresh@nginx.com	dh_installchangelogs
120373Sdefan@nginx.com	dh_link
121373Sdefan@nginx.com	dh_strip --dbg-package=unit-dbg
122373Sdefan@nginx.com	dh_shlibdeps
123373Sdefan@nginx.com	dh_compress
124373Sdefan@nginx.com	dh_fixperms
125373Sdefan@nginx.com	dh_installdeb
126373Sdefan@nginx.com	dh_perl
127373Sdefan@nginx.com	dh_gencontrol
128373Sdefan@nginx.com	dh_md5sums
129373Sdefan@nginx.com	dh_builddeb
130373Sdefan@nginx.com
131373Sdefan@nginx.combinary-arch: install
132373Sdefan@nginx.com
133373Sdefan@nginx.combinary: binary-indep binary-arch
134373Sdefan@nginx.com
135373Sdefan@nginx.com.PHONY: clean binary-indep binary-arch binary install build
136