summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 01d7e5e3c05232a7ce57fe5c69f9fb8b9abd67ba (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
    export DH_VERBOSE = 1
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
DPKG_EXPORT_BUILDFLAGS = 1

CFLAGS   += $(CPPFLAGS) -DNDEBUG
CXXFLAGS += $(CPPFLAGS) -DNDEBUG

empty :=

DEB_CMAKE_EXTRA_FLAGS = \
    -DCMAKE_INSTALL_INCLUDEDIR=include/$(DEB_HOST_MULTIARCH) \
    -DCMAKE_SKIP_RPATH=FALSE \
    -DCMAKE_SKIP_INSTALL_RPATH=TRUE \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DWITH_DEBUG_ALL=OFF \
    -DBUILD_TESTING=OFF \
    -DWITH_CHANNELS=ON \
    -DWITH_SERVER=ON \
    -DWITH_PROXY=ON \
    -DWITH_PROXY_MODULES=ON \
    -DWITH_CLIENT_INTERFACE=OFF \
    -DWITH_CLIENT_SDL=ON \
    -DWITH_SDL_IMAGE_DIALOGS=ON \
    -DWITH_WEBVIEW=OFF \
    -DWITH_PULSE=ON \
    -DWITH_ICU=ON \
    -DWITH_CUPS=ON \
    -DWITH_PCSC=ON \
    -DWITH_JPEG=ON \
    -DWITH_KERBEROS=ON \
    -DWITH_CLANG_FORMAT=OFF \
    -DWITH_OPUS=ON \
    -DWITH_SAMPLE=OFF \
    -DWITH_OPENSC_PKCS11_LINKED=OFF \
    -DWITH_VAAPI=OFF \
    -DWITH_WINPR_UTILS_IMAGE_JPEG=ON \
    -DWITH_WINPR_UTILS_IMAGE_PNG=ON \
    -DWITH_WINPR_UTILS_IMAGE_WEBP=ON \
    -DWITH_SMARTCARD_EMULATE=ON \
    -DRDTK_FORCE_STATIC_BUILD=ON \
    -DUWAC_FORCE_STATIC_BUILD=ON \
    -DWITH_BINARY_VERSIONING=ON \
    -DWITH_VERBOSE_WINPR_ASSERT=OFF \
    $(empty)

ifneq (,$(filter armel,$(DEB_HOST_ARCH)))
    DEB_CMAKE_EXTRA_FLAGS += \
        -DWITH_NEON=OFF \
        $(empty)
endif

ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
    DEB_CMAKE_EXTRA_FLAGS += \
        -DCHANNEL_URBDRC=ON \
        -DCHANNEL_URBDRC_CLIENT=ON \
        -DWITH_WAYLAND=ON \
        $(empty)
else
    DEB_CMAKE_EXTRA_FLAGS += \
        -DCHANNEL_URBDRC=OFF \
        -DCHANNEL_URBDRC_CLIENT=OFF \
        $(empty)

    DEB_CMAKE_EXTRA_FLAGS += \
        -DWITH_ALSA=OFF \
        -DWITH_LIBSYSTEMD=OFF \
        -DWITH_WAYLAND=OFF \
        $(empty)
endif

# Ubuntu can't have ffmpeg in main
# Ubuntu doesn't yet have cjson or pkcs11-helper
# or uriparser in main
ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes),yes)
    DEB_CMAKE_EXTRA_FLAGS += \
        -DWITH_AAD=OFF \
        -DWITH_FFMPEG=OFF \
        -DWITH_GSM=OFF \
        -DWITH_CAIRO=ON \
        -DWITH_PKCS11=OFF \
        -DWITH_SWSCALE=OFF \
        -DWITH_URIPARSER=OFF \
        $(empty)
else
    DEB_CMAKE_EXTRA_FLAGS += \
        -DWITH_GSM=ON \
        -DWITH_SWSCALE=ON \
        -DWITH_DSP_FFMPEG=ON \
        -DSWScale_INCLUDE_DIRS=/usr/include/$(DEB_HOST_MULTIARCH) \
        -DWITH_CAIRO=OFF \
        $(empty)
endif

%:
	dh $@

# char 026 (0x16) is seemed to be safe separator for sed "s" command;
# idea taken from Debian src:nginx/debian/dh_nginx.
# (however, they're using 0x17)
xSEDx :=$(shell printf '\026')

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
	# mangle CFLAGS value stored in buildflags.h.
	# fixes build path leakage.
	o='-f(debug|file)-prefix-map' ; \
	sed -E -i \
	    -e "s$(xSEDx)$${o}=[^=]+=\. $(xSEDx)$(xSEDx)g;" \
	    -e "s$(xSEDx) $${o}=[^=]+=\.$(xSEDx)$(xSEDx)g;" \
	obj-$(DEB_HOST_GNU_TYPE)/include/freerdp/buildflags.h
	sed -E -i \
	    -e "s$(xSEDx)$${o}=[^=]+=\. $(xSEDx)$(xSEDx)g;" \
	    -e "s$(xSEDx) $${o}=[^=]+=\.$(xSEDx)$(xSEDx)g;" \
	obj-$(DEB_HOST_GNU_TYPE)/winpr/include/winpr/buildflags.h

# NB debhelper 13+: convert to execute_before_dh_install
override_dh_install: TMP_LIB = debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
override_dh_install:
	rm -rf $(TMP_LIB)/*.a
	mkdir -p $(TMP_LIB)/freerdp/
	dh_install

# NB debhelper 13+: remove override
override_dh_missing:
	dh_missing --fail-missing

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..