[gentoo-dev] [RFC] qt5-build.eclass

2014-08-17 Thread Davide Pesavento
Hi guys,

In preparation for moving Qt5 to gentoo-x86 (finally!), please review
the attached eclass that is inherited by every Qt5 ebuild.

If you want to get an idea about how the ebuild code looks like, see
any ebuild in the dev-qt category of our overlay that inherits the
eclass:

https://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=tree;f=dev-qt;hb=HEAD
or on the github mirror (easier to navigate and nicer looking):
https://github.com/gentoo/qt/tree/master/dev-qt

For reference, the tracker bug is https://bugs.gentoo.org/show_bug.cgi?id=qt5

I will commit the eclass in about 7-10 days from now, unless major
problems are found during the review. The actual Qt5 packages will
follow soon thereafter, initially under package.mask.

Thanks,
Pesa


qt5-build.eclass
Description: Binary data


Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-17 Thread Maxim Koltsov
2014-08-17 22:38 GMT+04:00 Davide Pesavento :

> Hi guys,
>
> In preparation for moving Qt5 to gentoo-x86 (finally!), please review
> the attached eclass that is inherited by every Qt5 ebuild.
>
> If you want to get an idea about how the ebuild code looks like, see
> any ebuild in the dev-qt category of our overlay that inherits the
> eclass:
>
> https://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=tree;f=dev-qt;hb=HEAD
> or on the github mirror (easier to navigate and nicer looking):
> https://github.com/gentoo/qt/tree/master/dev-qt
>
> For reference, the tracker bug is
> https://bugs.gentoo.org/show_bug.cgi?id=qt5
>
> I will commit the eclass in about 7-10 days from now, unless major
> problems are found during the review. The actual Qt5 packages will
> follow soon thereafter, initially under package.mask.
>
> Thanks,
> Pesa
>

For the record: I /think/ that an eclass for packages supporting both qt4
and qt5 (using multibuild.eclass) /might/ be useful. Looking forward to
hearing Qt team opinion.


Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-17 Thread Georg Rudoy
2014-08-17 22:56 GMT+04:00 Maxim Koltsov :
> For the record: I /think/ that an eclass for packages supporting both qt4
> and qt5 (using multibuild.eclass) /might/ be useful. Looking forward to
> hearing Qt team opinion.

I second this opinion (especially after porting a few libraries'
ebuilds to multibuild to support qt5 builds).

I don't know, though, how (and whether it's possible) to automate
sed'ing the library names in qmake/cmake/whatever build system, since
you'll have to have different ones for qt4 and qt5 builds.

-- 
  Georg Rudoy



Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-17 Thread Davide Pesavento
On Sun, Aug 17, 2014 at 8:56 PM, Maxim Koltsov  wrote:
>
> For the record: I /think/ that an eclass for packages supporting both qt4
> and qt5 (using multibuild.eclass) /might/ be useful. Looking forward to
> hearing Qt team opinion.

Maybe. But you'll have to convince me. We aren't planning on writing
the qt5 equivalent of qt4-r2.eclass; qmake-utils.eclass should
suffice. Therefore I don't see much usefulness in a "glue" eclass such
as the one you're proposing.

In any case, this is completely off-topic. Please start a separate
discussion or open a bug.

Thanks,
Pesa



Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-20 Thread Michał Górny
Dnia 2014-08-17, o godz. 20:38:18
Davide Pesavento  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 \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}"

Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-20 Thread hasufell
Michał Górny:
>>  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 ... {} +
> 

Unless you really need it please use -execdir instead, since -exec is
insecure. Afais it should work both ways here.



Re: [gentoo-dev] [RFC] qt5-build.eclass

2014-08-26 Thread Davide Pesavento
On Wed, Aug 20, 2014 at 10:07 AM, Michał Górny  wrote:
> Dnia 2014-08-17, o godz. 20:38:18
> Davide Pesavento  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.

That doesn't match '-g' though, does it?

>
>>   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.

I think it's a fairly straightforward substitution, not pretty maybe
but... heh ;) Also, it's not something that you have to look at all
the time since the configure line doesn't change often, and the intent
is clear from the comment, so I'm not going to change it.

>
>>   # 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 ;).

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 \n' \
>>   "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \
>>   || die "sed failed (qconfig.h)"
>>   fi
>>
>>   qt5_insta