blob: 040a779be6a8431bb5f231684df35ec9a1867ebe [file] [log] [blame]
aviauf89d7062016-06-14 12:42:57 -04001#!/usr/bin/make -f
2# -*- makefile -*-
3
4# Hardening
5export DEB_BUILD_MAINT_OPTIONS = hardening=+all
6DPKG_EXPORT_BUILDFLAGS = 1
7include /usr/share/dpkg/buildflags.mk
8
9# Number of CPUS
10NO_CPUS=$(shell nproc)
11ifeq ($(NO_CPUS),0)
12NO_CPUS=1
13endif
14
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -040015# Binary package names
Maxim Cournoyer0a269662021-02-05 16:02:43 -050016JAMI_ALL_IN_ONE_PKG_NAME="jami-all"
17JAMI_CLIENT_PKG_NAME="jami"
Amin Bandali6d0caec2021-03-17 10:40:22 -040018JAMI_CLIENT_GNOME_PKG_NAME="jami-gnome"
19JAMI_LIB_CLIENT_PKG_NAME="jami-libclient"
Maxim Cournoyer0a269662021-02-05 16:02:43 -050020JAMI_DAEMON_PKG_NAME="jami-daemon"
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -040021
Fredy Pb20faf62019-12-09 10:15:45 -050022# Bundled packages from contrib
Sébastien Blin14518942021-04-19 16:13:13 -040023BUNDLED_PKGS=""
Sandra Tobajasd6dde7e2020-10-08 11:18:56 +000024ifeq (raspbian_10_armhf,$(findstring raspbian_10_armhf, $(DISTRIBUTION)))
Fredy Pb20faf62019-12-09 10:15:45 -050025# Raspbian's yaml-cpp lib does not work properly
Sébastien Blin14518942021-04-19 16:13:13 -040026BUNDLED_PKGS="--enable-ffmpeg --enable-yaml-cpp"
Sandra Tobajasd6dde7e2020-10-08 11:18:56 +000027# Add host environment variables
28CMAKE_OPTIONS=-DCHOST=${HOST_ARCH} \
Maxim Cournoyer7be07612021-06-11 11:34:19 -040029 -DCMAKE_C_COMPILER=${HOST_ARCH}-gcc \
30 -DCMAKE_CXX_COMPILER=${HOST_ARCH}-g++ \
31 -DCMAKE_FIND_ROOT_PATH=/usr/${HOST_ARCH} \
32 -DPKG_CONFIG_EXECUTABLE=/usr/bin/${HOST_ARCH}-pkg-config
Sébastien Blin14518942021-04-19 16:13:13 -040033else
34ifneq (ubuntu_21.04,$(findstring ubuntu_21.04, $(DISTRIBUTION)))
35BUNDLED_PKGS="--enable-ffmpeg" # For ubuntu 21.04 it seems there is massive issues with linking for swscale
36endif
Fredy Pb20faf62019-12-09 10:15:45 -050037endif
38
Amin Bandali6d0caec2021-03-17 10:40:22 -040039# Qt-related variables
40QT_JAMI_PREFIX := ${QT_JAMI_PREFIX}
41export PATH := $(QT_JAMI_PREFIX)/bin:${PATH}
42export LD_LIBRARY_PATH := $(QT_JAMI_PREFIX)/lib:${LD_LIBRARY_PATH}
43export PKG_CONFIG_PATH := $(QT_JAMI_PREFIX)/lib/pkgconfig:${PKG_CONFIG_PATH}
44export CMAKE_PREFIX_PATH := $(QT_JAMI_PREFIX)/lib/cmake:${CMAKE_PREFIX_PATH}
45
Maxim Cournoyer4e969702021-04-26 15:01:57 -040046# Installation directories.
47OCI_INSTALL_DIR = $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)
Amin Bandali6d0caec2021-03-17 10:40:22 -040048
aviauf89d7062016-06-14 12:42:57 -040049%:
50 dh $@
51
52override_dh_auto_configure:
aviauf89d7062016-06-14 12:42:57 -040053 ###########################
Sébastien Blin14518942021-04-19 16:13:13 -040054 ## Daemon configure ##
aviauf89d7062016-06-14 12:42:57 -040055 ###########################
56 mkdir -p daemon/contrib/native
57 cd daemon/contrib/native && \
58 ../bootstrap \
Maxim Cournoyer7be07612021-06-11 11:34:19 -040059 --host=${HOST_ARCH} \
60 --disable-downloads \
61 --no-checksums \
62 --disable-ogg \
63 --disable-flac \
64 --disable-vorbis \
65 --disable-vorbisenc \
66 --disable-speex \
67 --disable-sndfile \
68 --disable-gsm \
69 --disable-speexdsp \
70 --disable-natpmp \
71 --enable-gnutls $(BUNDLED_PKGS) && \
72 make list && \
73 make -j$(NO_CPUS) V=1
aviauf89d7062016-06-14 12:42:57 -040074 cd daemon && \
Maxim Cournoyer7be07612021-06-11 11:34:19 -040075 ./autogen.sh && \
76 ./configure \
77 --disable-shared \
78 --prefix=/usr \
79 --host=${HOST_ARCH}
aviauf89d7062016-06-14 12:42:57 -040080
81 #############################
82 ## libringclient configure ##
83 #############################
84 cd lrc && \
Maxim Cournoyer7be07612021-06-11 11:34:19 -040085 mkdir build && \
86 cd build && \
87 cmake \
88 -DRING_BUILD_DIR=$(CURDIR)/daemon/src \
89 -DENABLE_LIBWRAP=false \
90 -DCMAKE_INSTALL_PREFIX=/usr \
91 -DCMAKE_INSTALL_LIBDIR=lib \
92 $(CMAKE_OPTIONS) ..
aviauf89d7062016-06-14 12:42:57 -040093
94 ############################
95 ## gnome client configure ##
96 ############################
97 cd client-gnome && \
98 mkdir build && \
99 cd build && \
100 cmake \
101 -DCMAKE_INSTALL_PREFIX=/usr \
Sébastien Blin47c61df2021-04-30 17:29:59 -0400102 -DCMAKE_INSTALL_LIBDIR=lib \
aviauf89d7062016-06-14 12:42:57 -0400103 -DLibRingClient_PROJECT_DIR=/$(CURDIR)/lrc \
Stepan Salenikovichd6f588a2016-08-30 15:40:15 -0400104 -DGSETTINGS_LOCALCOMPILE=OFF \
Sandra Tobajasd6dde7e2020-10-08 11:18:56 +0000105 $(CMAKE_OPTIONS) \
aviauf89d7062016-06-14 12:42:57 -0400106 ..
107
Amin Bandali6d0caec2021-03-17 10:40:22 -0400108 #########################
109 ## qt client configure ##
110 #########################
111 # needs to be done after lrc is built; see below
112
aviauf89d7062016-06-14 12:42:57 -0400113 dh_auto_configure
114
115override_dh_auto_build:
116 #######################
Sébastien Blin14518942021-04-19 16:13:13 -0400117 ## Daemon build ##
aviauf89d7062016-06-14 12:42:57 -0400118 #######################
aviau9c5c4ad2016-07-20 14:07:34 -0400119 make -C daemon -j$(NO_CPUS) V=1
aviauf89d7062016-06-14 12:42:57 -0400120 pod2man daemon/man/dring.pod > daemon/dring.1
121
122 #########################
123 ## libringclient build ##
124 #########################
aviau9c5c4ad2016-07-20 14:07:34 -0400125 make -C lrc/build -j$(NO_CPUS) V=1
aviauf89d7062016-06-14 12:42:57 -0400126
127 ########################
128 ## gnome client build ##
129 ########################
aviau9c5c4ad2016-07-20 14:07:34 -0400130 make -C client-gnome/build LDFLAGS="-lpthread" -j$(NO_CPUS) V=1
aviauf89d7062016-06-14 12:42:57 -0400131
Amin Bandali6d0caec2021-03-17 10:40:22 -0400132 ###################################
133 ## qt client configure and build ##
134 ###################################
135 cd client-qt && \
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400136 mkdir build && \
137 cd build && \
138 cmake \
139 -DCMAKE_INSTALL_PREFIX=/usr \
140 -DLRC=$(CURDIR)/lrc \
141 $(CMAKE_OPTIONS) ..
Amin Bandali6d0caec2021-03-17 10:40:22 -0400142 make -C client-qt/build -j$(NO_CPUS) V=1
143
aviauf89d7062016-06-14 12:42:57 -0400144override_dh_auto_clean:
aviauf89d7062016-06-14 12:42:57 -0400145 #######################
Sébastien Blin14518942021-04-19 16:13:13 -0400146 ## Daemon clean ##
aviauf89d7062016-06-14 12:42:57 -0400147 #######################
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400148 [ -f daemon/contrib/native/Makefile ] && \
149 make -C daemon/contrib/native distclean || true
aviauf89d7062016-06-14 12:42:57 -0400150 rm -rfv daemon/contrib/native
151 rm -rfv daemon/dring.1
152
153 #########################
154 ## libringclient clean ##
155 #########################
Maxim Cournoyerdad4c3b2018-02-14 15:48:37 -0500156 # CMake build system has no distclean target, so use clean.
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400157 [ -f lrc/build/Makefile ] && make -C lrc/build clean || true
aviauf89d7062016-06-14 12:42:57 -0400158 rm -rfv lrc/build
159
160 ########################
161 ## gnome client clean ##
162 ########################
Maxim Cournoyerdad4c3b2018-02-14 15:48:37 -0500163 # CMake build system has no distclean target, so use clean.
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400164 [ -f client-gnome/build/Makefile ] && \
165 make -C client-gnome/build clean || true
aviauf89d7062016-06-14 12:42:57 -0400166 rm -rfv client-gnome/build
167
Amin Bandali6d0caec2021-03-17 10:40:22 -0400168 #####################
169 ## qt client clean ##
170 #####################
171 # CMake build system has no distclean target, so use clean.
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400172 [ -f client-qt/build/Makefile ] && make -C client-qt/build clean || true
Amin Bandali6d0caec2021-03-17 10:40:22 -0400173 rm -rfv client-qt/build
174
aviauf89d7062016-06-14 12:42:57 -0400175override_dh_auto_install:
176 #########################
Sébastien Blin14518942021-04-19 16:13:13 -0400177 ## Daemon install ##
aviauf89d7062016-06-14 12:42:57 -0400178 #########################
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500179 cd daemon && make DESTDIR=$(CURDIR)/debian/$(JAMI_DAEMON_PKG_NAME) install
180 rm -rfv $(CURDIR)/debian/$(JAMI_DAEMON_PKG_NAME)/usr/include
181 rm -rfv $(CURDIR)/debian/$(JAMI_DAEMON_PKG_NAME)/usr/lib/*.a
182 rm -rfv $(CURDIR)/debian/$(JAMI_DAEMON_PKG_NAME)/usr/lib/*.la
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -0400183
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400184 #########################
Fredy P553fef12019-10-10 15:05:06 -0400185 ## Jami client install ##
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400186 #########################
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400187 ## LibRingClient
Amin Bandali6d0caec2021-03-17 10:40:22 -0400188 cd lrc/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME) install
189 rm -rfv $(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME)/usr/include
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400190
191 # This is a symlink, should be in -dev package
Amin Bandali6d0caec2021-03-17 10:40:22 -0400192 rm -v $(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME)/usr/lib/libringclient.so
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400193
194 # cmake files
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500195 rm -rfv $(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME)/usr/lib/cmake
Hugo Lefeuvrec79ae4d2018-08-07 14:48:28 -0400196
197 ## GNOME client
Amin Bandali6d0caec2021-03-17 10:40:22 -0400198 cd client-gnome/build && \
199 make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_GNOME_PKG_NAME) install
200 rm -rfv $(CURDIR)/debian/$(JAMI_CLIENT_GNOME_PKG_NAME)/usr/bin/jami
201
202 ## Qt client
203 cd client-qt/build && \
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400204 make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME) install
Amin Bandali6d0caec2021-03-17 10:40:22 -0400205
Maxim Cournoyer4e969702021-04-26 15:01:57 -0400206 ## Custom Qt package for Jami (libqt-jami)
207 ## Copy our own Qt library package content into the OCI package.
208 for file_name in $$(dpkg-query -L libqt-jami); do \
209 mkdir -p "$(OCI_INSTALL_DIR)$$(dirname $$file_name)"; \
210 test -d "$$file_name" && continue; \
211 cp "$$file_name" "$(OCI_INSTALL_DIR)$$file_name"; \
212 done
213
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -0400214 ######################
Fredy P553fef12019-10-10 15:05:06 -0400215 ## Jami AiO install ##
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -0400216 ######################
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -0400217 ## daemon
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500218 cd daemon && make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
219 rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/include
220 rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/lib/*.a
221 rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/lib/*.la
Hugo Lefeuvrec902ea12018-07-19 14:23:32 -0400222
223 ## LibRingClient
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500224 cd lrc/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
225 rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/include
aviauf89d7062016-06-14 12:42:57 -0400226
227 # This is a symlink, should be in -dev package
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500228 rm -v $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/lib/libringclient.so
aviauf89d7062016-06-14 12:42:57 -0400229
230 # cmake files
Maxim Cournoyer0a269662021-02-05 16:02:43 -0500231 rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/lib/cmake
aviauf89d7062016-06-14 12:42:57 -0400232
Amin Bandali6d0caec2021-03-17 10:40:22 -0400233 ## Qt client
234 cd client-qt/build && \
Maxim Cournoyer7be07612021-06-11 11:34:19 -0400235 make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
Amin Bandali6d0caec2021-03-17 10:40:22 -0400236
Amin Bandali6d0caec2021-03-17 10:40:22 -0400237override_dh_shlibdeps:
238 dh_shlibdeps -- -x$(JAMI_ALL_IN_ONE_PKG_NAME)
aviauf89d7062016-06-14 12:42:57 -0400239
aviauf89d7062016-06-14 12:42:57 -0400240tmpdir:= $(shell mktemp -d)
241workdir:= $(shell pwd)
242PKD := $(abspath $(dir $(MAKEFILE_LIST)))
243version_to_download := $(shell dpkg-parsechangelog -ldebian/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\~dfsg.+)(?:\-\d+.*)};')