Hi everyone! I would like you to comment on the attached patch for qtbase.
The idea behind it is the following: there are many headers in qtbase that are
built as a manual-process by upstream.

The only reason they are manually-done is because the tools required to build
them depend on corelibs (Qt5Core5 and others)... and this headers are part of
corelibs. So they are a circular build dependency.

So I tried to bootstrap corelibs, build the tools (one in this patch, I hope
more to come), ran them, distclean corelibs (this seems to be strictly needed
according to my tests, and it's also the cleanest way, even if it takes some
more build time) and start compiling the libs.

You might be wondering what are the advantages of doing this? First of all
most of this tools depend on external data (like in the attached example) that
is also provided as a Debian package. Moreover, also as in this example, it's
not strange to have a newer version of the data set available in the Debian
packaging. So rebuilding it we get a more up-to-date, easy to update (just a
binNMU!) data set.

Secondly the fact of regenerating the files and being able to build upon them
is also a step in the right direction wrt quality.

The patch is to be pushed against the current HEAD (latest experimental
release). I havem't touched debian/changes yet because I want feedback before
going any further.

So do you like the idea? Do you have ideas/tips on how to improve it? Would
you implement it differently?

Thanks in advance, Lisandro.

--
http://www.phdcomics.com/comics/archive.php?comicidV

Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/
From d64d2bf9187c2ba582b83c0396998f47e41190c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lisandro Damián Nicanor Pérez Meyer? <perezme...@gmail.com>
Date: Thu, 9 Jul 2015 21:48:16 -0300
Subject: [PATCH] Bootstrap corelibs in order to be able to rebuild headers
 provided by upstream.

To renegerate this headers we need corelibs available. But once this
headers are rebuilt we need to rebuild corelibs.

It also contains a first example: regenerating TLDs.
---
 debian/control         |  1 +
 debian/generateTLDs.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/rules           | 11 +++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 debian/generateTLDs.sh

diff --git a/debian/control b/debian/control
index 8440a48..65aa029 100644
--- a/debian/control
+++ b/debian/control
@@ -60,6 +60,7 @@ Build-Depends: debhelper (>= 9),
                libxkbcommon-x11-dev,
                libxrender-dev,
                pkg-kde-tools (>= 0.15.17),
+               publicsuffix,
                unixodbc-dev,
                zlib1g-dev
 Build-Conflicts: libmariadbclient-dev
diff --git a/debian/generateTLDs.sh b/debian/generateTLDs.sh
new file mode 100644
index 0000000..49503a0
--- /dev/null
+++ b/debian/generateTLDs.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Copyright (c) 2015 Lisandro Damián Nicanor Pérez Meyer <lisan...@debian.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+DESTHEADER=src/corelib/io/qurltlds_p.h
+
+mv -f $DESTHEADER $DESTHEADER.orig
+
+cd util/corelib/qurl-generateTLDs
+../../../bin/qmake -makefile qurl-generateTLDs.pro
+make
+
+# Prepare the data.
+grep '^[^\/\/]' /usr/share/publicsuffix/effective_tld_names.dat > effective_tld_names.dat.trimmed
+
+cat << EOF >> ../../../$DESTHEADER
+#ifndef QURLTLD_P_H
+#define QURLTLD_P_H
+
+QT_BEGIN_NAMESPACE
+
+EOF
+
+LD_PRELOAD=../../../lib/libQt5Core.so.5 ./qurl-generateTLDs effective_tld_names.dat.trimmed effective_tld_names.dat.qt
+cat effective_tld_names.dat.qt >> ../../../$DESTHEADER
+
+cat << EOF >> ../../../$DESTHEADER
+
+QT_END_NAMESPACE
+
+#endif // QURLTLD_P_H
+EOF
diff --git a/debian/rules b/debian/rules
index adc79c9..9c33a31 100755
--- a/debian/rules
+++ b/debian/rules
@@ -221,6 +221,17 @@ override_dh_auto_build-indep:
 	cd $(CURDIR)/src/xml; ../../bin/qmake
 	dh_auto_build -Smakefile -- html_docs

+override_dh_auto_build-arch:
+	# Bootstrap corelibs in order to be able to build the helper tools to
+	# regenerate some upstream-provided files.
+	cd $(CURDIR)/src; ../bin/qmake; make sub-corelib
+	# Add here the code to generate the helpers and then the headers.
+	sh debian/generateTLDs.sh
+	# Clean up the compiled code and start again.
+	cd $(CURDIR)/src; make distclean
+	make clean
+	dh_auto_build
+
 override_dh_auto_install-arch:
 	dh_auto_install -Smakefile -- INSTALL_ROOT=$(CURDIR)/debian/tmp/

--
2.1.4

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-kde-talk

Reply via email to