Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=8bb9da5839c61add56931f7d8a7a5ac7064c5f32
commit 8bb9da5839c61add56931f7d8a7a5ac7064c5f32 Author: crazy <[email protected]> Date: Sun Jul 23 08:05:49 2017 +0200 added meson.sh * well I don't like this one however since apps seems to switch to it * lets add an new schema.. Also syntax is ugly and meson is just used * for configure part some sort .. rest is ninja build * We'll have fun patching meson.build files since full of syntax error , * and incompatible changes fo anccient meson some folks are using. * @Baste have fun with GNOME :p diff --git a/source/include/meson.sh b/source/include/meson.sh new file mode 100644 index 0000000..71ca874 --- /dev/null +++ b/source/include/meson.sh @@ -0,0 +1,153 @@ +#!/bin/sh + +### +# = meson.sh(3) +# Gabriel Craciunescu <[email protected]> +# +# == NAME +# meson.sh - for Frugalware +# +# == SYNOPSIS +# Common schema for packages using meson build system. +# +# == OPTIONS +# * _F_meson_type (default: release ): Possible values : plain debug debugoptimized release minsize +# * _F_meson_confopts (default: nothing): Use like with Fconfopts , syntax is -Dsomething=something +# * _F_meson_compiler ( default: gcc ): Possible values: gcc or clang +### + + +if [ -z "$_F_meson_build_type" ]; then + _F_meson_build_type="release" +fi + +if [ -z "$_F_meson_compiler" ]; then + _F_meson_compiler="gcc" +fi + +if [ -z "$_F_meson_build_dir" ]; then + _F_meson_build_dir="frugalware_meson_build" +fi + + +### +# == APPENDED VARIABLES +# * makedepends(): add meson and pkgconfig +# * options(): add nostrip if _F_meson_build_type is debug* +### + +makedepends+=('meson' 'pkgconfig') + +### +# == PROVIDED FUNCTIONS +# * Meson_setup(): Setup packages depending on some _F_cmake_* options. +### +Meson_setup() +{ + local i + + case "$_F_meson_build_type" in + debug*) + options=("${options[@]}" 'nostrip') + for i in $(seq 0 $((${#subpkgs[@]} - 1))); do + suboptions[$i]="${suboptions[$i]} nostrip" + done + ;; + esac + + case "$_F_meson_compiler" in + gcc) + _F_meson_cc="gcc" + _F_meson_cxx="g++" + ;; + clang) + _F_meson_cc="clang" + _F_meson_cxx="clang++" + ;; + *) + Fmessage "Unknow compiler , cannot continue.." + exit 1 + ;; + esac +} + +## FIXME +CROSS_LIB="lib" +CROSS_BIN="bin" +CROSS_SBIN="sbin" + +### +# * Meson_conf(): This is the 'configure' part but cmake way. +### +Meson_conf() +{ + + ## NOTE: no other backend but ninja for LINUX + Meson_setup + ## we need all these to be sure we build with own flags.. + CC="$_F_meson_cc" CXX="$_F_meson_cxx" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ + Fexec meson \ + --prefix /usr \ + --datadir share \ + --libdir ${CROSS_LIB} \ + --libexecdir $pkgname \ + --mandir share/man \ + --bindir ${CROSS_BIN} \ + --sbindir ${CROSS_SBIN} \ + --sysconfdir etc \ + --localstatedir var \ + --buildtype $_F_meson_build_type \ + --backend ninja \ + $_F_meson_confopts "$@" $_F_meson_build_dir || Fdie +} + +### +# * Meson_prepare_build(): Runs 'Fpatchall' and prepares the 'build' dir needed by meson. +### +Meson_prepare_build() +{ + Fcd + Fpatchall + if [ -d "$_F_meson_build_dir" ]; then + Fexec rm -rf "$_F_meson_build_dir" || Fdie + Fexec mkdir -p "$_F_meson_build_dir" || Fdie + else + Fexec mkdir -p "$_F_meson_build_dir" || Fdie + fi + +} + +### +# * Meson_make(): Calls 'Meson_prepare_build()' , 'Meson_conf()' and runs ninja +### +Meson_make() +{ + Meson_prepare_build + Meson_conf "$@" + ## we run ninja with verbose , *always* + Fexec ninja -v -C "$_F_meson_build_dir" || Fdie +} + +Meson_install() +{ + + DESTDIR=$Fdestdir Fexec ninja -v -C "$_F_meson_build_dir" install || Fdie + Fremove_static_libs ## should not be needed but .. +} +### +# * Meson_build(): build() wrapper +### +Meson_build() +{ + Meson_make "$@" + Meson_install +} + +### +# * build(): Calls 'Meson_build()' +### +build() +{ + Meson_build +} + _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
