summaryrefslogtreecommitdiff
path: root/debian/rules
blob: d1339637b5a7f57cfaa85521dbbb08658472681c (plain)
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
#!/usr/bin/make -f

export QT_SELECT=qt5
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# The build system doesn't use CPPFLAGS, pass them to CFLAGS/CXXFLAGS to
# enable the missing (hardening) flags
DEB_CFLAGS_MAINT_APPEND   = -MMD -Wall $(shell dpkg-buildflags --get CPPFLAGS)
DEB_CXXFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)
DEB_LDFLAGS_MAINT_APPEND  = -Wl,--as-needed
export DEB_CFLAGS_MAINT_APPEND DEB_CXXFLAGS_MAINT_APPEND DEB_LDFLAGS_MAINT_APPEND

UCFLAGS   = -MMD -Wall -fPIC $(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CFLAGS)

BINDIR    = /sbin
V = 1

PKG_CONFIG ?= $(DEB_HOST_GNU_TYPE)-pkg-config

export BINDIR V PKG_CONFIG

include /usr/share/dpkg/architecture.mk
HOSTAPD_DOT_CONFIG            := debian/config/hostapd/$(DEB_HOST_ARCH_OS)
WPASUPPLICANT_DOT_CONFIG      := debian/config/wpasupplicant/$(DEB_HOST_ARCH_OS)
WPASUPPLICANT_UDEB_DOT_CONFIG := debian/config/wpasupplicant/$(DEB_HOST_ARCH_OS)-udeb

### start dh overrides
override_dh_auto_configure:
ifeq (,$(filter pkg.wpa.nogui,$(DEB_BUILD_PROFILES)))
	dh_auto_configure --sourcedirectory=wpa_supplicant/wpa_gui-qt4 \
	                  --buildsystem=qmake
endif

override_dh_auto_build:
	# build documentation
	dh_auto_build --sourcedirectory=wpa_supplicant/doc/docbook \
	              --buildsystem=makefile \
	              -- man
ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
	# build wpasupplicant-udeb
	cp -v --remove-destination $(WPASUPPLICANT_UDEB_DOT_CONFIG) wpa_supplicant/.config
	CFLAGS="$(UCFLAGS)" dh_auto_build --sourcedirectory=wpa_supplicant \
	              --buildsystem=makefile
	mv -v wpa_supplicant/wpa_supplicant wpa_supplicant/wpa_supplicant-udeb
	dh_auto_clean --sourcedirectory=wpa_supplicant \
	              --buildsystem=makefile
endif
	# build wpasupplicant, libwpa_client and eapol_test
	cp -v --remove-destination $(WPASUPPLICANT_DOT_CONFIG) wpa_supplicant/.config
	dh_auto_build --sourcedirectory=wpa_supplicant \
	              --buildsystem=makefile -- all libwpa_client.a eapol_test
ifeq (,$(filter pkg.wpa.nogui,$(DEB_BUILD_PROFILES)))
	# build wpa_gui-qt4
	dh_auto_build --sourcedirectory=wpa_supplicant/wpa_gui-qt4 \
	              --buildsystem=qmake
endif
	dh_auto_clean --sourcedirectory=src --buildsystem=makefile
	# build hostapd
	cp -v --remove-destination $(HOSTAPD_DOT_CONFIG) hostapd/.config
	dh_auto_build --sourcedirectory=hostapd \
	              --buildsystem=makefile
	dh_auto_clean --sourcedirectory=src --buildsystem=makefile

override_dh_auto_clean:
	dh_auto_clean --sourcedirectory=wpa_supplicant/doc/docbook \
	              --buildsystem=makefile
	dh_auto_clean --sourcedirectory=wpa_supplicant \
	              --buildsystem=makefile
ifeq (,$(filter pkg.wpa.nogui,$(DEB_BUILD_PROFILES)))
	dh_auto_clean --sourcedirectory=wpa_supplicant/wpa_gui-qt4 \
	              --buildsystem=qmake
	-find wpa_supplicant/wpa_gui-qt4 -type d -name \.moc -exec rm -rf {} \;
	-find wpa_supplicant/wpa_gui-qt4 -type d -name \.ui  -exec rm -rf {} \;
	-find wpa_supplicant/wpa_gui-qt4 -type d -name \.obj -exec rm -rf {} \;
endif
	dh_auto_clean --sourcedirectory=hostapd \
	              --buildsystem=makefile

override_dh_auto_install:
	$(info Skip dh_auto_install ...)

override_dh_clean:
	# make sure to remove the staging directory for the udeb
	rm -rf debian/wpasupplicant-udeb
	dh_clean

override_dh_install:
	dh_install
	# install D-Bus service activation files & configuration
	install --mode=644 -D wpa_supplicant/dbus/dbus-wpa_supplicant.conf \
		debian/wpasupplicant/etc/dbus-1/system.d/wpa_supplicant.conf
ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
	# Install udeb
	install --mode=755 -D wpa_supplicant/wpa_supplicant-udeb \
		debian/wpasupplicant-udeb/sbin/wpa_supplicant
endif

override_dh_installchangelogs:
	dh_installchangelogs --package=hostapd hostapd/ChangeLog
	dh_installchangelogs --package=wpasupplicant wpa_supplicant/ChangeLog
ifeq (,$(filter pkg.wpa.nogui,$(DEB_BUILD_PROFILES)))
	dh_installchangelogs --package=wpagui wpa_supplicant/ChangeLog
endif
	dh_installchangelogs --remaining-packages
### end dh overrides

override_dh_installexamples:
	dh_installexamples
	sed -e 's="includes.h"=<stddef.h>=' -e 's="common/wpa_ctrl.h"=<wpa_ctrl.h>=' -i debian/*/usr/share/doc/*/examples/*.c

%:
	dh ${@}

get-orig-source:
	chmod +x $(CURDIR)/debian/get-orig-source
	$(CURDIR)/debian/get-orig-source $(CURDIR)