From 7a6c1ffed21b43b759cef9d6879654639e88fc65 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Fri, 5 Jan 2018 15:04:44 +0100 Subject: [PATCH 1/3] buildtypes: Add script for Meson [1] [Description][2]: > Meson is an open source build system meant to be both extremely fast, > and, even more importantly, as user friendly as possible. > > The main design point of Meson is that every moment a developer spends > writing or debugging build definitions is a second wasted. So is every > second spent waiting for the build system to actually start compiling > code. [1]: http://mesonbuild.com/Quick-guide.html [2]: http://mesonbuild.com/ --- Makefile | 1 + buildtypes/meson.sh.in | 59 ++++++++++++++++++++++++++++++++++++++++++ src/beesh.sh.in | 1 + 3 files changed, 61 insertions(+) create mode 100644 buildtypes/meson.sh.in diff --git a/Makefile b/Makefile index e7abaeb..6ed5118 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ BUILDTYPES+=cmake BUILDTYPES+=configure BUILDTYPES+=jb BUILDTYPES+=make +BUILDTYPES+=meson BUILDTYPES+=perl-module BUILDTYPES+=perl-module-makemaker BUILDTYPES+=python-module diff --git a/buildtypes/meson.sh.in b/buildtypes/meson.sh.in new file mode 100644 index 0000000..5ee5984 --- /dev/null +++ b/buildtypes/meson.sh.in @@ -0,0 +1,59 @@ +# +# bee magic for meson +# +# Copyright (C) 2017 +# Paul Menzel +# and other bee developers +# +# This file is part of bee. +# +# bee is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +: ${BEE_BUILDTYPE_MESON_MESONBUILD:=${S}/meson.build} + +if [ ! -r "${BEE_BUILDTYPE_MESON_MESONBUILD}" ] ; then + return +fi + +if ! type -p meson >/dev/null 2>&1 ; then + return +fi + +BEE_BUILDTYPE_DETECTED=meson + +BEE_BUILDTYPE_MESON_SOURCEDIR=${BEE_BUILDTYPE_MESON_MESONBUILD%/*} + +#### bee_configure() ########################################################## + +bee_configure() { + start_cmd meson \ + --prefix ${PREFIX} \ + --buildtype=plain \ + "${@}" \ + ${S} +} + +#### bee_build() ############################################################## + +bee_build() { + start_cmd ninja -v -C ${B} ${BEE_MAKEFLAGS} "${@}" +} + +#### bee_install() ############################################################ + +bee_install() { + start_cmd DESTDIR=${D} ninja -C ${B} install "${@}" +} + diff --git a/src/beesh.sh.in b/src/beesh.sh.in index c419363..0cca9b0 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -1032,6 +1032,7 @@ bee_run patch "${bee_PATCHFILES[@]}" bee_buildmagic=( $("${BEE_BINDIR}/beeuniq" "${BEE_BUILDTYPE[@]}" \ cmake \ + meson \ autotools \ autogen \ perl-module \ From 3f7924ca7d9b20c2cd3e9202c8d867232c91aca7 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Fri, 5 Jan 2018 16:00:04 +0100 Subject: [PATCH 2/3] buildtypes/meson: Remove check for `meson` If the Meson executable is not found, an error will be thrown by the shell, so the check is not needed. Additionally, the environment could be changed in the bee file, so deterministically continue. --- buildtypes/meson.sh.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/buildtypes/meson.sh.in b/buildtypes/meson.sh.in index 5ee5984..b131c1d 100644 --- a/buildtypes/meson.sh.in +++ b/buildtypes/meson.sh.in @@ -27,10 +27,6 @@ if [ ! -r "${BEE_BUILDTYPE_MESON_MESONBUILD}" ] ; then return fi -if ! type -p meson >/dev/null 2>&1 ; then - return -fi - BEE_BUILDTYPE_DETECTED=meson BEE_BUILDTYPE_MESON_SOURCEDIR=${BEE_BUILDTYPE_MESON_MESONBUILD%/*} From df90cd2156f01b0e510df2829d6e4ebc81e67791 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Tue, 16 Jan 2018 15:37:08 +0100 Subject: [PATCH 3/3] buildtypes/meson.sh.in: Work around environment variable setting The function `start_cmd()` in the bee shell runs "{@}" causing the setting of the environment variable to be executed, which is of course not found. ``` function start_cmd() { print_info "${COLOR_CYAN}${@}" "${@}" } ``` Work around it, by setting the environment variable `DESTDIR` outside. --- buildtypes/meson.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtypes/meson.sh.in b/buildtypes/meson.sh.in index b131c1d..84bd354 100644 --- a/buildtypes/meson.sh.in +++ b/buildtypes/meson.sh.in @@ -50,6 +50,6 @@ bee_build() { #### bee_install() ############################################################ bee_install() { - start_cmd DESTDIR=${D} ninja -C ${B} install "${@}" + DESTDIR=${D} start_cmd ninja -C ${B} install "${@}" }