# $Id$ # meson config tools SDEPEND="${SDEPEND} >= dev-util/meson-0.43 >= dev-util/ninja-1.8" # enables features like --enable-blah with make meson_enable() { local feature="$1" local option="$2" [[ -z ${option} ]] && option="true" echo "-Denable-${feature}=${option}" } # disables features like --disable-blah with make meson_disable() { local feature="$1" echo "-Denable_${feature}=false" } # enables features like --with-blah with make meson_with() { local feature="$1" local option="$2" [[ -z ${option} ]] && option="true" echo "-Dwith-${feature}=${option}" } # enables features like --with-blah with make meson_without() { local feature="$1" echo "-Dwith-{feature}=false" } # generic meson opts meson_opt() { local feature="$1" local option="$2" echo "-D${feature}=${option}" } meson_src_prepare() { munpack ${SRCFILE} || die } meson_configure() { local configure_opts="$@" meson setup \ --buildtype=release \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var/lib \ --libdir=/usr/$(mlibdir) \ --libexecdir=/usr/$(mlibdir)/${PNAME} \ ${configure_opts} \ ${SRCDIR}/${SRCSUBDIR} \ || die } mninja() { ninja -v ${MAKEOPTS} "$@" } meson_src_compile() { cd ${SRCDIR} # remove build dir if exist [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build # build outside of the source dir install -d ${BUILDDIR}/build || die cd ${BUILDDIR}/build meson_configure || die mninja || die } meson_src_check() { cd ${BUILDDIR}/build meson test || die } meson_src_install() { cd ${BUILDDIR}/build DESTDIR=${BINDIR} ninja install || die cd ${SRCDIR} local i for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ FAQ LICENSE NEWS README TODO do if [ -f ${SRCDIR}/${i} ] then minstalldocs ${i} || die fi done } export_inherits meson src_prepare src_compile src_check src_install