File: rules

package info (click to toggle)
libsemanage 3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,108 kB
  • sloc: ansic: 21,386; python: 1,308; yacc: 523; makefile: 285; lex: 81; sh: 16
file content (93 lines) | stat: -rwxr-xr-x 2,875 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/architecture.mk
# for cross compilation
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
export CC := $(DEB_HOST_GNU_TYPE)-gcc
export PKG_CONFIG := $(DEB_HOST_GNU_TYPE)-pkg-config
export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__$(DEB_HOST_MULTIARCH)
define ruby_env
  RUBYLIB=/usr/lib/$(DEB_HOST_MULTIARCH)/ruby-crossbuild/$$($(1) -e "puts RbConfig::CONFIG['ruby_version']")
endef
else
define ruby_env
endef
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif

DOPACKAGES = $(shell dh_listpackages)

ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
PY3VERSIONS = $(shell py3versions -rv)
endif
ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
RUBY_VERSIONS := $(shell dh_ruby --print-supported)
endif

# Upstream recommends using this flag
export DEB_CFLAGS_MAINT_APPEND = -fno-semantic-interposition
# The build system doesn't use CPPFLAGS, pass them to CFLAGS to enable the
# missing (hardening) flags. Also enable Wall and Wextra to spot basic irregularities.
export DEB_CFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS) -Wall -Wextra

%:
	dh $@

override_dh_auto_build:
	$(MAKE) all

ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
	set -e; for version in $(PY3VERSIONS); do        \
	  $(MAKE) pywrap PYTHON=python$$version PYLIBS=; \
	done;
endif
ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
	set -e; for version in $(RUBY_VERSIONS); do      \
	  $(call ruby_env,$$version) \
	  $(MAKE) -C src rubywrap RUBY=$$version; \
	done;
endif

override_dh_auto_install:
	$(MAKE) install DESTDIR="${CURDIR}/debian/tmp" \
	  LIBDIR="/usr/lib/${DEB_HOST_MULTIARCH}" \
	  SHLIBDIR="/usr/lib/${DEB_HOST_MULTIARCH}"

ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
	set -e; for version in $(PY3VERSIONS); do        \
	  $(MAKE) install-pywrap PYTHON=python$$version DESTDIR="${CURDIR}/debian/tmp" DEB_PYTHON_INSTALL_LAYOUT=deb; \
	done;
endif
ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
	set -e; for version in $(RUBY_VERSIONS); do      \
	  $(call ruby_env,$$version) \
	  $(MAKE) -C src install-rubywrap RUBY=$$version DESTDIR="${CURDIR}/debian/tmp"; \
	done;
endif

override_dh_auto_clean:
	dh_auto_clean
ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
	set -e; for version in $(PY3VERSIONS); do         \
	  $(MAKE) clean PYTHON=python$$version;  \
	done;
endif
ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
	set -e; for version in $(RUBY_VERSIONS); do      \
	  $(call ruby_env,$$version) \
	  $(MAKE) clean RUBY=$$version; \
	done;
endif

override_dh_fixperms:
	dh_fixperms
ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
	chmod -x ${CURDIR}/debian/python3-semanage/usr/lib/python*/*-packages/semanage.py
endif