Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Davide Pesavento <pesa@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] qt5-build.eclass
Date: Wed, 20 Aug 2014 08:06:48
Message-Id: 20140820100727.07f25b3c@pomiot.lan
In Reply to: [gentoo-dev] [RFC] qt5-build.eclass by Davide Pesavento
1 Dnia 2014-08-17, o godz. 20:38:18
2 Davide Pesavento <pesa@g.o> napisał(a):
3
4 > # @FUNCTION: qt5-build_src_unpack
5 > # @DESCRIPTION:
6 > # Unpacks the sources.
7 > qt5-build_src_unpack() {
8 > if [[ $(gcc-major-version) -lt 4 ]] || [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 5 ]]; then
9 > ewarn
10 > ewarn "Using a GCC version lower than 4.5 is not supported."
11 > ewarn
12 > fi
13 >
14 > if [[ ${PN} == qtwebkit ]]; then
15 > eshopts_push -s extglob
16 > if is-flagq '-g?(gdb)?([1-9])'; then
17
18 Wouldn't that be equivalent to '-g[^0]'? And I think this would
19 actually work without extglob.
20
21 > ewarn
22 > ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
23 > ewarn "You may experience really long compilation times and/or increased memory usage."
24 > ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
25 > ewarn "For more info check out https://bugs.gentoo.org/307861"
26 > ewarn
27 > fi
28 > eshopts_pop
29 > fi
30 >
31 > case ${QT5_BUILD_TYPE} in
32 > live) git-r3_src_unpack ;;
33 > release) default ;;
34 > esac
35 > }
36 >
37 > # @FUNCTION: qt5-build_src_prepare
38 > # @DESCRIPTION:
39 > # Prepares the sources before the configure phase.
40 > qt5-build_src_prepare() {
41 > qt5_prepare_env
42 >
43 > if [[ ${QT5_MODULE} == qtbase ]]; then
44 > # Avoid unnecessary qmake recompilations
45 > sed -i -re "s|^if true;.*(\[ '\!').*(\"\\\$outpath/bin/qmake\".*)|if \1 -e \2 then|" \
46 > configure || die "sed failed (skip qmake bootstrap)"
47
48 Any chance for something more readable? :) Like a inline patch.
49
50 > # Respect CC, CXX, *FLAGS, MAKEOPTS and EXTRA_EMAKE when bootstrapping qmake
51 > sed -i -e "/outpath\/qmake\".*\"\$MAKE\")/ s:): \
52 > ${MAKEOPTS} ${EXTRA_EMAKE} 'CC=$(tc-getCC)' 'CXX=$(tc-getCXX)' \
53 > 'QMAKE_CFLAGS=${CFLAGS}' 'QMAKE_CXXFLAGS=${CXXFLAGS}' 'QMAKE_LFLAGS=${LDFLAGS}'&:" \
54 > -e '/"$CFG_RELEASE_QMAKE"/,/^\s\+fi$/ d' \
55 > configure || die "sed failed (respect env for qmake build)"
56
57 Ditto ;).
58
59 > sed -i -e '/^CPPFLAGS\s*=/ s/-g //' \
60 > qmake/Makefile.unix || die "sed failed (CPPFLAGS for qmake build)"
61 >
62 > # Respect CXX in {bsymbolic_functions,fvisibility,precomp}.test
63 > sed -i -e "/^QMAKE_CONF_COMPILER=/ s:=.*:=\"$(tc-getCXX)\":" \
64 > configure || die "sed failed (QMAKE_CONF_COMPILER)"
65 >
66 > # Respect toolchain and flags in config.tests
67 > find config.tests/unix -name '*.test' -type f -print0 \
68 > | xargs -0 sed -i -e '/bin\/qmake/ s/-nocache //' \
69 > || die "sed failed (config.tests)"
70
71 find ... -exec sed ... {} +
72
73 > fi
74 >
75 > if [[ ${PN} != qtcore ]]; then
76 > qt5_symlink_tools_to_build_dir
77 > fi
78 >
79 > # apply patches
80 > [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
81 > epatch_user
82 > }
83
84 [...]
85
86 > # @FUNCTION: qt5-build_src_install
87 > # @DESCRIPTION:
88 > # Performs the actual installation of target directories.
89 > qt5-build_src_install() {
90 > qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install
91 >
92 > if [[ ${PN} == qtcore ]]; then
93 > pushd "${QT5_BUILD_DIR}" >/dev/null || die
94 > einfo "Running emake INSTALL_ROOT=${D} install_{mkspecs,qmake,syncqt}"
95
96 You can put that command-line in an array or set to argv.
97
98 > emake INSTALL_ROOT="${D}" install_{mkspecs,qmake,syncqt}
99 > popd >/dev/null || die
100 >
101 > # install an empty Gentoo/gentoo-qconfig.h in ${D}
102 > # so that it's placed under package manager control
103 > > "${T}"/gentoo-qconfig.h
104 > (
105 > insinto "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo
106 > doins "${T}"/gentoo-qconfig.h
107 > )
108 >
109 > # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h
110 > sed -i -e '1a#include <Gentoo/gentoo-qconfig.h>\n' \
111 > "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \
112 > || die "sed failed (qconfig.h)"
113 > fi
114 >
115 > qt5_install_module_qconfigs
116 > prune_libtool_files
117 > }
118
119 [...]
120
121 > # @FUNCTION: qt5_base_configure
122 > # @INTERNAL
123 > # @DESCRIPTION:
124 > # Runs ./configure for modules belonging to qtbase.
125 > qt5_base_configure() {
126 > # setup toolchain variables used by configure
127 > tc-export CC CXX RANLIB STRIP
128 > export LD="$(tc-getCXX)"
129 >
130 > # configure arguments
131 > local conf=(
132 > # installation paths
133 > -prefix "${QT5_PREFIX}"
134 > -bindir "${QT5_BINDIR}"
135 > -headerdir "${QT5_HEADERDIR}"
136 > -libdir "${QT5_LIBDIR}"
137 > -archdatadir "${QT5_ARCHDATADIR}"
138 > -plugindir "${QT5_PLUGINDIR}"
139 > -libexecdir "${QT5_LIBEXECDIR}"
140 > -importdir "${QT5_IMPORTDIR}"
141 > -qmldir "${QT5_QMLDIR}"
142 > -datadir "${QT5_DATADIR}"
143 > -docdir "${QT5_DOCDIR}"
144 > -translationdir "${QT5_TRANSLATIONDIR}"
145 > -sysconfdir "${QT5_SYSCONFDIR}"
146 > -examplesdir "${QT5_EXAMPLESDIR}"
147 > -testsdir "${QT5_TESTSDIR}"
148 >
149 > # debug/release
150 > $(use debug && echo -debug || echo -release)
151 > -no-separate-debug-info
152 >
153 > # licensing stuff
154 > -opensource -confirm-license
155 >
156 > # let configure automatically figure out if C++11 is supported
157 > #-c++11
158
159 Doesn't switching C++11 support involve changing ABI? I suspect Qt may
160 be actually free of that.
161
162 > # build shared libraries
163 > -shared
164 >
165 > # always enable large file support
166 > -largefile
167 >
168 > # disabling accessibility is not recommended by upstream, as
169 > # it will break QStyle and may break other internal parts of Qt
170 > -accessibility
171 >
172 > # disable all SQL drivers by default, override in qtsql
173 > -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc
174 > -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds
175 >
176 > # obsolete flag, does nothing
177 > #-qml-debug
178 >
179 > # use pkg-config to detect include and library paths
180 > -pkg-config
181 >
182 > # prefer system libraries (only common deps here)
183 > -system-zlib
184 > -system-pcre
185 >
186 > # don't specify -no-gif because there is no way to override it later
187 > #-no-gif
188 >
189 > # disable everything to prevent automagic deps (part 1)
190 > -no-mtdev
191 > -no-journald
192 > -no-libpng -no-libjpeg
193 > -no-freetype -no-harfbuzz
194 > -no-openssl
195 > -no-xinput2 -no-xcb-xlib
196 >
197 > # always enable glib event loop support
198 > -glib
199 >
200 > # disable everything to prevent automagic deps (part 2)
201 > -no-pulseaudio -no-alsa
202 >
203 > # disable gtkstyle because it adds qt4 include paths to the compiler
204 > # command line if x11-libs/cairo is built with USE=qt4 (bug 433826)
205 > -no-gtkstyle
206 >
207 > # exclude examples and tests from default build
208 > -nomake examples
209 > -nomake tests
210 > -no-compile-examples
211 >
212 > # disable rpath on non-prefix (bugs 380415 and 417169)
213 > $(use prefix || echo -no-rpath)
214 >
215 > # print verbose information about each configure test
216 > -verbose
217 >
218 > # doesn't actually matter since we override CXXFLAGS
219 > #-no-optimized-qmake
220 >
221 > # obsolete flag, does nothing
222 > #-nis
223 >
224 > # always enable iconv support
225 > -iconv
226 >
227 > # disable everything to prevent automagic deps (part 3)
228 > -no-cups -no-evdev -no-icu -no-fontconfig -no-dbus
229 >
230 > # don't strip
231 > -no-strip
232 >
233 > # precompiled headers are not that useful for us
234 > # and cause problems on hardened, so turn them off
235 > -no-pch
236 >
237 > # reduced relocations cause major breakage on at least arm and ppc, so we
238 > # don't specify anything and let configure figure out if they are supported,
239 > # see also https://bugreports.qt-project.org/browse/QTBUG-36129
240 > #-reduce-relocations
241 >
242 > # let configure automatically detect if GNU gold is available
243 > #-use-gold-linker
244 >
245 > # disable all platform plugins by default, override in qtgui
246 > -no-xcb -no-eglfs -no-directfb -no-linuxfb -no-kms
247 >
248 > # disable undocumented X11-related flags, override in qtgui
249 > # (not shown in ./configure -help output)
250 > -no-xkb -no-xrender
251 >
252 > # disable obsolete/unused X11-related flags
253 > # (not shown in ./configure -help output)
254 > -no-mitshm -no-xcursor -no-xfixes -no-xinerama -no-xinput
255 > -no-xrandr -no-xshape -no-xsync -no-xvideo
256 >
257 > # always enable session management support: it doesn't need extra deps
258 > # at configure time and turning it off is dangerous, see bug 518262
259 > -sm
260 >
261 > # typedef qreal to double (warning: changing this flag breaks the ABI)
262 > -qreal double
263 >
264 > # disable opengl and egl by default, override in qtgui and qtopengl
265 > -no-opengl -no-egl
266 >
267 > # use upstream default
268 > #-no-system-proxies
269 >
270 > # do not build with -Werror
271 > -no-warnings-are-errors
272 >
273 > # module-specific options
274 > "${myconf[@]}"
275 > )
276 >
277 > mkdir -p "${QT5_BUILD_DIR}" || die
278 > pushd "${QT5_BUILD_DIR}" >/dev/null || die
279 >
280 > einfo "Configuring with: ${conf[@]}"
281 > "${S}"/configure "${conf[@]}" || die "configure failed"
282 >
283 > popd >/dev/null || die
284 > }
285
286 --
287 Best regards,
288 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] [RFC] qt5-build.eclass hasufell <hasufell@g.o>
Re: [gentoo-dev] [RFC] qt5-build.eclass Davide Pesavento <pesa@g.o>