Dnia 2014-08-17, o godz. 20:38:18
Davide Pesavento <[email protected]> napisał(a):

> # @FUNCTION: qt5-build_src_unpack
> # @DESCRIPTION:
> # Unpacks the sources.
> qt5-build_src_unpack() {
>       if [[ $(gcc-major-version) -lt 4 ]] || [[ $(gcc-major-version) -eq 4 && 
> $(gcc-minor-version) -lt 5 ]]; then
>               ewarn
>               ewarn "Using a GCC version lower than 4.5 is not supported."
>               ewarn
>       fi
> 
>       if [[ ${PN} == qtwebkit ]]; then
>               eshopts_push -s extglob
>               if is-flagq '-g?(gdb)?([1-9])'; then

Wouldn't that be equivalent to '-g[^0]'? And I think this would
actually work without extglob.

>                       ewarn
>                       ewarn "You have enabled debug info (probably have -g or 
> -ggdb in your CFLAGS/CXXFLAGS)."
>                       ewarn "You may experience really long compilation times 
> and/or increased memory usage."
>                       ewarn "If compilation fails, please try removing 
> -g/-ggdb before reporting a bug."
>                       ewarn "For more info check out 
> https://bugs.gentoo.org/307861";
>                       ewarn
>               fi
>               eshopts_pop
>       fi
> 
>       case ${QT5_BUILD_TYPE} in
>               live)    git-r3_src_unpack ;;
>               release) default ;;
>       esac
> }
> 
> # @FUNCTION: qt5-build_src_prepare
> # @DESCRIPTION:
> # Prepares the sources before the configure phase.
> qt5-build_src_prepare() {
>       qt5_prepare_env
> 
>       if [[ ${QT5_MODULE} == qtbase ]]; then
>               # Avoid unnecessary qmake recompilations
>               sed -i -re "s|^if true;.*(\[ 
> '\!').*(\"\\\$outpath/bin/qmake\".*)|if \1 -e \2 then|" \
>                       configure || die "sed failed (skip qmake bootstrap)"

Any chance for something more readable? :) Like a inline patch.

>               # Respect CC, CXX, *FLAGS, MAKEOPTS and EXTRA_EMAKE when 
> bootstrapping qmake
>               sed -i -e "/outpath\/qmake\".*\"\$MAKE\")/ s:): \
>                       ${MAKEOPTS} ${EXTRA_EMAKE} 'CC=$(tc-getCC)' 
> 'CXX=$(tc-getCXX)' \
>                       'QMAKE_CFLAGS=${CFLAGS}' 'QMAKE_CXXFLAGS=${CXXFLAGS}' 
> 'QMAKE_LFLAGS=${LDFLAGS}'&:" \
>                       -e '/"$CFG_RELEASE_QMAKE"/,/^\s\+fi$/ d' \
>                       configure || die "sed failed (respect env for qmake 
> build)"

Ditto ;).

>               sed -i -e '/^CPPFLAGS\s*=/ s/-g //' \
>                       qmake/Makefile.unix || die "sed failed (CPPFLAGS for 
> qmake build)"
> 
>               # Respect CXX in {bsymbolic_functions,fvisibility,precomp}.test
>               sed -i -e "/^QMAKE_CONF_COMPILER=/ s:=.*:=\"$(tc-getCXX)\":" \
>                       configure || die "sed failed (QMAKE_CONF_COMPILER)"
> 
>               # Respect toolchain and flags in config.tests
>               find config.tests/unix -name '*.test' -type f -print0 \
>                       | xargs -0 sed -i -e '/bin\/qmake/ s/-nocache //' \
>                       || die "sed failed (config.tests)"

find ... -exec sed ... {} +

>       fi
> 
>       if [[ ${PN} != qtcore ]]; then
>               qt5_symlink_tools_to_build_dir
>       fi
> 
>       # apply patches
>       [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
>       epatch_user
> }

[...]

> # @FUNCTION: qt5-build_src_install
> # @DESCRIPTION:
> # Performs the actual installation of target directories.
> qt5-build_src_install() {
>       qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install
> 
>       if [[ ${PN} == qtcore ]]; then
>               pushd "${QT5_BUILD_DIR}" >/dev/null || die
>               einfo "Running emake INSTALL_ROOT=${D} 
> install_{mkspecs,qmake,syncqt}"

You can put that command-line in an array or set to argv.

>               emake INSTALL_ROOT="${D}" install_{mkspecs,qmake,syncqt}
>               popd >/dev/null || die
> 
>               # install an empty Gentoo/gentoo-qconfig.h in ${D}
>               # so that it's placed under package manager control
>               > "${T}"/gentoo-qconfig.h  
>               (
>                       insinto "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo
>                       doins "${T}"/gentoo-qconfig.h
>               )
> 
>               # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h
>               sed -i -e '1a#include <Gentoo/gentoo-qconfig.h>\n' \
>                       "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \
>                       || die "sed failed (qconfig.h)"
>       fi
> 
>       qt5_install_module_qconfigs
>       prune_libtool_files
> }

[...]

> # @FUNCTION: qt5_base_configure
> # @INTERNAL
> # @DESCRIPTION:
> # Runs ./configure for modules belonging to qtbase.
> qt5_base_configure() {
>       # setup toolchain variables used by configure
>       tc-export CC CXX RANLIB STRIP
>       export LD="$(tc-getCXX)"
> 
>       # configure arguments
>       local conf=(
>               # installation paths
>               -prefix "${QT5_PREFIX}"
>               -bindir "${QT5_BINDIR}"
>               -headerdir "${QT5_HEADERDIR}"
>               -libdir "${QT5_LIBDIR}"
>               -archdatadir "${QT5_ARCHDATADIR}"
>               -plugindir "${QT5_PLUGINDIR}"
>               -libexecdir "${QT5_LIBEXECDIR}"
>               -importdir "${QT5_IMPORTDIR}"
>               -qmldir "${QT5_QMLDIR}"
>               -datadir "${QT5_DATADIR}"
>               -docdir "${QT5_DOCDIR}"
>               -translationdir "${QT5_TRANSLATIONDIR}"
>               -sysconfdir "${QT5_SYSCONFDIR}"
>               -examplesdir "${QT5_EXAMPLESDIR}"
>               -testsdir "${QT5_TESTSDIR}"
> 
>               # debug/release
>               $(use debug && echo -debug || echo -release)
>               -no-separate-debug-info
> 
>               # licensing stuff
>               -opensource -confirm-license
> 
>               # let configure automatically figure out if C++11 is supported
>               #-c++11

Doesn't switching C++11 support involve changing ABI? I suspect Qt may
be actually free of that.

>               # build shared libraries
>               -shared
> 
>               # always enable large file support
>               -largefile
> 
>               # disabling accessibility is not recommended by upstream, as
>               # it will break QStyle and may break other internal parts of Qt
>               -accessibility
> 
>               # disable all SQL drivers by default, override in qtsql
>               -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc
>               -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds
> 
>               # obsolete flag, does nothing
>               #-qml-debug
> 
>               # use pkg-config to detect include and library paths
>               -pkg-config
> 
>               # prefer system libraries (only common deps here)
>               -system-zlib
>               -system-pcre
> 
>               # don't specify -no-gif because there is no way to override it 
> later
>               #-no-gif
> 
>               # disable everything to prevent automagic deps (part 1)
>               -no-mtdev
>               -no-journald
>               -no-libpng -no-libjpeg
>               -no-freetype -no-harfbuzz
>               -no-openssl
>               -no-xinput2 -no-xcb-xlib
> 
>               # always enable glib event loop support
>               -glib
> 
>               # disable everything to prevent automagic deps (part 2)
>               -no-pulseaudio -no-alsa
> 
>               # disable gtkstyle because it adds qt4 include paths to the 
> compiler
>               # command line if x11-libs/cairo is built with USE=qt4 (bug 
> 433826)
>               -no-gtkstyle
> 
>               # exclude examples and tests from default build
>               -nomake examples
>               -nomake tests
>               -no-compile-examples
> 
>               # disable rpath on non-prefix (bugs 380415 and 417169)
>               $(use prefix || echo -no-rpath)
> 
>               # print verbose information about each configure test
>               -verbose
> 
>               # doesn't actually matter since we override CXXFLAGS
>               #-no-optimized-qmake
> 
>               # obsolete flag, does nothing
>               #-nis
> 
>               # always enable iconv support
>               -iconv
> 
>               # disable everything to prevent automagic deps (part 3)
>               -no-cups -no-evdev -no-icu -no-fontconfig -no-dbus
> 
>               # don't strip
>               -no-strip
> 
>               # precompiled headers are not that useful for us
>               # and cause problems on hardened, so turn them off
>               -no-pch
> 
>               # reduced relocations cause major breakage on at least arm and 
> ppc, so we
>               # don't specify anything and let configure figure out if they 
> are supported,
>               # see also https://bugreports.qt-project.org/browse/QTBUG-36129
>               #-reduce-relocations
> 
>               # let configure automatically detect if GNU gold is available
>               #-use-gold-linker
> 
>               # disable all platform plugins by default, override in qtgui
>               -no-xcb -no-eglfs -no-directfb -no-linuxfb -no-kms
> 
>               # disable undocumented X11-related flags, override in qtgui
>               # (not shown in ./configure -help output)
>               -no-xkb -no-xrender
> 
>               # disable obsolete/unused X11-related flags
>               # (not shown in ./configure -help output)
>               -no-mitshm -no-xcursor -no-xfixes -no-xinerama -no-xinput
>               -no-xrandr -no-xshape -no-xsync -no-xvideo
> 
>               # always enable session management support: it doesn't need 
> extra deps
>               # at configure time and turning it off is dangerous, see bug 
> 518262
>               -sm
> 
>               # typedef qreal to double (warning: changing this flag breaks 
> the ABI)
>               -qreal double
> 
>               # disable opengl and egl by default, override in qtgui and 
> qtopengl
>               -no-opengl -no-egl
> 
>               # use upstream default
>               #-no-system-proxies
> 
>               # do not build with -Werror
>               -no-warnings-are-errors
> 
>               # module-specific options
>               "${myconf[@]}"
>       )
> 
>       mkdir -p "${QT5_BUILD_DIR}" || die
>       pushd "${QT5_BUILD_DIR}" >/dev/null || die
> 
>       einfo "Configuring with: ${conf[@]}"
>       "${S}"/configure "${conf[@]}" || die "configure failed"
> 
>       popd >/dev/null || die
> }

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to