Tue Mar 3 21:52:01 MSK 2015

Problem

Some qt programs wont build w/ dev-libs/boost-1.57 due a bug of stupid moc and BOOST_JOIN. In my case it was kde-base/kleopatra and media-libs/qt-gstreamer.

Solution

As suggested in bug comments wrapping #include <boost/...> into #ifndef Q_MOC_RUN/#endif helps to build them. The problem is to find all lines that needs to be wrapped. I didn’t want to waste my time doing patches, so the simplest way is to wrap all such #include directives automatically w/ sed. So I’ve added ebuilds to my overlay where on src_prepare() stage all sources will be patched w/ a sed script:

/\// {
    i #ifndef Q_MOC_RUN
    a #endif
}

In ebuild at prepare stage:

src_prepare() {
        # Wrap all boost #include due a bug:
        # https://bugreports.qt.io/browse/QTBUG-22829
        ebegin "Wrapping #include <boost/...> into #ifndef Q_MOC_RUN/#endif"
        for i in `find . -name '*.h' -o -name '*.cpp'`; do
            sed -f "${FILESDIR}/wrap-boost-headers.sed" -i "${i}"
        done
        eend $?

        # Call default handler here:
        # - cmake-utils_src_configure for media-libs/qt-gstreamer
        # - kde4-meta_src_prepare for kde-base/kleopatra...
}

Yeah, need to report bugs (as usually)… and append them to #541572.



blog comments powered by Disqus