| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# Uncomment this to turn on verbose mode. |
| 4 |
#export DH_VERBOSE=1 |
| 5 |
|
| 6 |
# Use already defined DEB_HOST_* variables. |
| 7 |
include /usr/share/dpkg/architecture.mk |
| 8 |
|
| 9 |
# Use already defined upstream version as DEB_VERSION_UPSTREAM. |
| 10 |
include /usr/share/dpkg/pkg-info.mk |
| 11 |
|
| 12 |
export PATH := $(PATH):$(shell pwd)/bin |
| 13 |
export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) $(shell getconf LFS_CFLAGS) |
| 14 |
export CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) $(shell getconf LFS_CFLAGS) |
| 15 |
export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) |
| 16 |
export PKG_CONFIG := /usr/bin/$(DEB_HOST_GNU_TYPE)-pkg-config |
| 17 |
sslpkgname := $(shell dpkg-query --show '--showformat=$${Depends}' libssl-dev | cut -d ' ' -f1) |
| 18 |
|
| 19 |
# Upstream changelog |
| 20 |
upstream_changes := dist/changes-$(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/+dfsg//' | sed -e 's/+git.*//') |
| 21 |
|
| 22 |
ifneq (,$(filter libqt5sql5-ibase,$(shell dh_listpackages))) |
| 23 |
extra_configure_opts += -plugin-sql-ibase |
| 24 |
else |
| 25 |
extra_configure_opts += -no-sql-ibase |
| 26 |
endif |
| 27 |
|
| 28 |
no_pch_architectures := arm64 |
| 29 |
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(no_pch_architectures))) |
| 30 |
extra_configure_opts += -no-pch |
| 31 |
endif |
| 32 |
|
| 33 |
gles2_architectures := armel armhf |
| 34 |
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures))) |
| 35 |
extra_configure_opts += -opengl es2 |
| 36 |
else |
| 37 |
extra_configure_opts += -opengl desktop |
| 38 |
endif |
| 39 |
|
| 40 |
ifneq ($(DEB_HOST_ARCH_OS),$(findstring $(DEB_HOST_ARCH_OS), linux)) |
| 41 |
extra_configure_opts += -no-eglfs |
| 42 |
endif |
| 43 |
|
| 44 |
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85412 |
| 45 |
ifeq ($(DEB_HOST_ARCH),ia64) |
| 46 |
extra_configure_opts += QMAKE_CFLAGS_OPTIMIZE_FULL-=-O3 |
| 47 |
endif |
| 48 |
|
| 49 |
# Compile without sse2 support on i386 |
| 50 |
# Do not use precompiled headers in order to be able to rebuild the gui |
| 51 |
# submodule. |
| 52 |
ifeq ($(DEB_HOST_ARCH_CPU),i386) |
| 53 |
cpu_opt = -no-sse2 -no-pch |
| 54 |
endif |
| 55 |
|
| 56 |
platform_os = $(or $(mkspec_osmap_$(DEB_HOST_ARCH_OS)),$(DEB_HOST_ARCH_OS)) |
| 57 |
platform_arg = $(platform_os)-g++ |
| 58 |
|
| 59 |
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 60 |
platform_arg = $(platform_os)-$(DEB_HOST_GNU_CPU)-$(DEB_HOST_ARCH_LIBC)$(filter-out base,$(DEB_HOST_ARCH_ABI))-g++ |
| 61 |
endif |
| 62 |
|
| 63 |
# Refuse cross building with a qmake whose version differs from the package. |
| 64 |
ifneq (,$(filter cross,$(DEB_BUILD_PROFILES))) |
| 65 |
extra_configure_opts += -external-hostbindir /usr/lib/qt5/bin |
| 66 |
endif |
| 67 |
|
| 68 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 69 |
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 70 |
else |
| 71 |
NUMJOBS = 1 |
| 72 |
endif |
| 73 |
|
| 74 |
%: |
| 75 |
dh $@ --with pkgkde_symbolshelper |
| 76 |
|
| 77 |
override_dh_auto_configure: |
| 78 |
ifneq (,$(filter cross,$(DEB_BUILD_PROFILES))) |
| 79 |
test "`dpkg-query -f '$${Version}' -W qt5-qmake-bin`" = "$(DEB_VERSION)" |
| 80 |
endif |
| 81 |
MAKEFLAGS="-j$(NUMJOBS) ${CXXFLAGS:%=EXTRA_CXXFLAGS+=%} ${LDFLAGS:%=EXTRA_LFLAGS+=%}" \ |
| 82 |
./configure \ |
| 83 |
-confirm-license \ |
| 84 |
-prefix "/usr" \ |
| 85 |
-bindir "/usr/lib/qt5/bin" \ |
| 86 |
-libdir "/usr/lib/$(DEB_HOST_MULTIARCH)" \ |
| 87 |
-docdir "/usr/share/qt5/doc" \ |
| 88 |
-headerdir "/usr/include/$(DEB_HOST_MULTIARCH)/qt5" \ |
| 89 |
-datadir "/usr/share/qt5" \ |
| 90 |
-archdatadir "/usr/lib/$(DEB_HOST_MULTIARCH)/qt5" \ |
| 91 |
-plugindir "/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/plugins" \ |
| 92 |
-importdir "/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/imports" \ |
| 93 |
-translationdir "/usr/share/qt5/translations" \ |
| 94 |
-hostdatadir "/usr/lib/$(DEB_HOST_MULTIARCH)/qt5" \ |
| 95 |
-sysconfdir "/etc/xdg" \ |
| 96 |
-examplesdir "/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/examples" \ |
| 97 |
-opensource \ |
| 98 |
-plugin-sql-mysql \ |
| 99 |
-plugin-sql-odbc \ |
| 100 |
-plugin-sql-psql \ |
| 101 |
-plugin-sql-sqlite \ |
| 102 |
-no-sql-sqlite2 \ |
| 103 |
-plugin-sql-tds \ |
| 104 |
-system-sqlite \ |
| 105 |
-platform $(platform_arg) \ |
| 106 |
-system-harfbuzz \ |
| 107 |
-system-zlib \ |
| 108 |
-system-libpng \ |
| 109 |
-system-libjpeg \ |
| 110 |
-system-doubleconversion \ |
| 111 |
-system-pcre \ |
| 112 |
-openssl \ |
| 113 |
-no-rpath \ |
| 114 |
-verbose \ |
| 115 |
-optimized-qmake \ |
| 116 |
-dbus-linked \ |
| 117 |
-no-strip \ |
| 118 |
-no-separate-debug-info \ |
| 119 |
-qpa xcb \ |
| 120 |
-xcb \ |
| 121 |
-glib \ |
| 122 |
-icu \ |
| 123 |
-accessibility \ |
| 124 |
-compile-examples \ |
| 125 |
-no-directfb \ |
| 126 |
-no-use-gold-linker \ |
| 127 |
-no-mimetype-database \ |
| 128 |
-no-feature-relocatable \ |
| 129 |
-xcb-native-painting \ |
| 130 |
$(extra_configure_opts) \ |
| 131 |
$(cpu_opt) \ |
| 132 |
QMAKE_CFLAGS="$(CFLAGS)" \ |
| 133 |
QMAKE_CXXFLAGS="$(CXXFLAGS)" \ |
| 134 |
QMAKE_LFLAGS="$(LDFLAGS)" |
| 135 |
|
| 136 |
override_dh_auto_clean: |
| 137 |
[ ! -f Makefile ] || $(MAKE) confclean distclean |
| 138 |
|
| 139 |
# Extra stuff missed by confclean/distclean |
| 140 |
|
| 141 |
# Leftover dirs |
| 142 |
find -depth -type d \( -false \ |
| 143 |
-o -name debug-shared \ |
| 144 |
-o -name debug-static \ |
| 145 |
-o -name \*.gch \ |
| 146 |
-o -name .moc\* \ |
| 147 |
-o -name .obj\* \ |
| 148 |
-o -name .pch \ |
| 149 |
-o -name pkgconfig \ |
| 150 |
-o -name .rcc \ |
| 151 |
-o -name release-shared \ |
| 152 |
-o -name release-static \ |
| 153 |
-o -name .uic \ |
| 154 |
\) -print0 | xargs -0 rm -rf |
| 155 |
|
| 156 |
# Leftover files and all symlinks |
| 157 |
find \( -false \ |
| 158 |
-o -name lib\*.a \ |
| 159 |
-o -name Makefile.Debug \ |
| 160 |
-o -name Makefile.Release \ |
| 161 |
-o -name \*.o \ |
| 162 |
-o -name \*.prl \ |
| 163 |
-o -name lib\*.so \ |
| 164 |
-o -type l \ |
| 165 |
\) -print0 | xargs -0 rm -rf |
| 166 |
|
| 167 |
# Delete all Makefiles, excluding some from src/3rdparty |
| 168 |
find $(CURDIR) -name Makefile \ |
| 169 |
! -path $(CURDIR)/src/3rdparty/Makefile \ |
| 170 |
! -path $(CURDIR)/src/3rdparty/freetype/\* \ |
| 171 |
! -path $(CURDIR)/src/3rdparty/zlib/\* \ |
| 172 |
! -path $(CURDIR)/src/3rdparty/ptmalloc/Makefile \ |
| 173 |
-print0 | xargs -0 rm -rf |
| 174 |
|
| 175 |
# Any remaining executables |
| 176 |
find $(CURDIR) -type f -perm /u+x,g+x,o+x -exec file -i '{}' \; \ |
| 177 |
| grep -e application/x-executable \ |
| 178 |
| cut -d ':' -f 1 | xargs rm -f |
| 179 |
|
| 180 |
override_dh_auto_build-indep: |
| 181 |
dh_auto_build -- docs |
| 182 |
|
| 183 |
override_dh_auto_build-arch: |
| 184 |
# Bootstrap corelibs in order to be able to build the helper tools to |
| 185 |
# regenerate some upstream-provided files. |
| 186 |
cd $(CURDIR)/src; ../bin/qmake; $(MAKE) sub-corelib |
| 187 |
# Add here the code to generate the helpers and then the headers. |
| 188 |
LC_ALL=C.UTF-8 sh debian/generateTLDs.sh |
| 189 |
# Rebuild only the object file that used the generated header. |
| 190 |
rm src/corelib/.obj/qtldurl.o |
| 191 |
dh_auto_build |
| 192 |
|
| 193 |
override_dh_auto_install-arch: |
| 194 |
dh_auto_install -Smakefile -- INSTALL_ROOT=$(CURDIR)/debian/tmp/ |
| 195 |
|
| 196 |
ifeq ($(DEB_HOST_ARCH_CPU),i386) |
| 197 |
# Rebuild the necessary libs with SSE2 support. |
| 198 |
# Create the destination directory. |
| 199 |
install -d debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sse2/ |
| 200 |
|
| 201 |
# corelib needs make clean first to be able to rebuild. |
| 202 |
cd $(CURDIR)/src/corelib; $(MAKE) clean; ../../bin/qmake -config sse2; $(MAKE) |
| 203 |
cp -av lib/libQt5Core.so.* debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sse2/ |
| 204 |
|
| 205 |
# gui on turn doesn't need it, and actually fails if done. |
| 206 |
cd $(CURDIR)/src/gui; ../../bin/qmake -config sse2; $(MAKE) |
| 207 |
cp -av lib/libQt5Gui.so.* debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sse2/ |
| 208 |
endif |
| 209 |
|
| 210 |
# Fix wrong path in pkgconfig files |
| 211 |
find $(CURDIR)/debian/tmp/usr/lib/*/pkgconfig -type f -name '*.pc' \ |
| 212 |
-exec perl -pi -e "s, -L$(CURDIR)/?\S+,,g" {} \; |
| 213 |
|
| 214 |
# Use multiarched directory for host_bins variable (see #909575) |
| 215 |
sed -i "s,lib/qt5/bin,lib/$(DEB_HOST_MULTIARCH)/qt5/bin," \ |
| 216 |
debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/Qt5Core.pc |
| 217 |
|
| 218 |
# Remove leftover directories |
| 219 |
find $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5 -depth -type d \( -false \ |
| 220 |
-o -name .moc\* \ |
| 221 |
-o -name .obj\* \ |
| 222 |
-o -name .pch \ |
| 223 |
-o -name .rcc \ |
| 224 |
\) -print0 | xargs -0 rm -rf |
| 225 |
|
| 226 |
# Remove libtool-like files |
| 227 |
rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la |
| 228 |
|
| 229 |
# A user of Qt built by a distro doesn't need to find where the plugins |
| 230 |
# are via CMake, so don't install them. |
| 231 |
rm -fv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5Gui/Q*ThemePlugin.cmake |
| 232 |
rm -fv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5Sql/Q*DriverPlugin.cmake |
| 233 |
|
| 234 |
# There is also no need to install libQtBootstrap. As its name indicates it's |
| 235 |
# only used to bootstrap qt. |
| 236 |
rm -fv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libQt5Bootstrap* |
| 237 |
rm -fv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/Qt5Bootstrap.pc |
| 238 |
|
| 239 |
# Remove bogus exec bits from some data files in mkspecs, docs, examples |
| 240 |
find debian/tmp/usr/share/qt5/ debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/ \ |
| 241 |
debian/tmp/usr/share/qt5/doc/ \ |
| 242 |
-perm /u+x,g+x,o+x -type f \ |
| 243 |
-regex '.*\.\(app\|conf\|cpp\|h\|js\|php\|png\|pro\|xml\|xsl\)$$' \ |
| 244 |
-exec chmod a-x {} \; |
| 245 |
|
| 246 |
# Helper files for cross-building |
| 247 |
mkdir -p debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5 |
| 248 |
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/' debian/qt.conf.in \ |
| 249 |
> debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/qt.conf |
| 250 |
|
| 251 |
mkdir -p debian/tmp/usr/bin |
| 252 |
sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \ |
| 253 |
-e 's/@DEB_HOST_GNU_TYPE@/$(DEB_HOST_GNU_TYPE)/g' \ |
| 254 |
< debian/qmake-cross-wrapper.in > debian/tmp/usr/bin/$(DEB_HOST_GNU_TYPE)-qmake |
| 255 |
chmod +x debian/tmp/usr/bin/$(DEB_HOST_GNU_TYPE)-qmake |
| 256 |
|
| 257 |
# See https://bugs.debian.org/913499 |
| 258 |
sed -i 's,lib/qt5/bin/qmake,lib/$(DEB_HOST_MULTIARCH)/qt5/bin/qmake,' \ |
| 259 |
debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/Qt5Core/Qt5CoreConfigExtras.cmake |
| 260 |
|
| 261 |
# See https://bugs.debian.org/914019 |
| 262 |
sed -i 's,-fdebug-prefix-map=$(CURDIR)=. ,,; s,-ffile-prefix-map=$(CURDIR)=. ,,' \ |
| 263 |
debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/mkspecs/qmodule.pri |
| 264 |
|
| 265 |
# Reproducible builds: remove build paths from .prl files. |
| 266 |
sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libQt5*.prl \ |
| 267 |
debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/examples/widgets/tools/plugandpaint/plugins/libpnp_basictools.prl |
| 268 |
|
| 269 |
# Headers needed for building deepin-qt5dxcb-plugin. |
| 270 |
install -D -t debian/tmp/usr/include/$(DEB_HOST_MULTIARCH)/qt5/QtXcb/$(DEB_VERSION_UPSTREAM:+dfsg=)/QtXcb/private \ |
| 271 |
src/plugins/platforms/xcb/*.h |
| 272 |
|
| 273 |
override_dh_auto_install-indep: |
| 274 |
dh_auto_build -- INSTALL_ROOT=$(CURDIR)/debian/tmp install_docs |
| 275 |
|
| 276 |
override_dh_installchangelogs: |
| 277 |
if [ -f $(upstream_changes) ] ; then \ |
| 278 |
dh_installchangelogs $(upstream_changes); \ |
| 279 |
else \ |
| 280 |
dh_installchangelogs; \ |
| 281 |
fi |
| 282 |
|
| 283 |
override_dh_makeshlibs: |
| 284 |
dh_makeshlibs -XlibQt5EglFSDeviceIntegration -XlibQt5EglFsKmsSupport -XlibQt5XcbQpa |
| 285 |
|
| 286 |
override_dh_auto_test: |
| 287 |
|
| 288 |
override_dh_strip_nondeterminism: |
| 289 |
dh_strip_nondeterminism --verbose -X.png |
| 290 |
|
| 291 |
execute_after_dh_shlibdeps-arch: |
| 292 |
echo libssl:Depends=$(sslpkgname) >> debian/libqt5network5t64.substvars |