From c7006e45f3a3bcf75950037c8b309489af19d6aa Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 11 Apr 2017 10:52:35 +0200 Subject: add meson conf tool Signed-off-by: Michael Olbrich --- scripts/lib/ptxd_make_meson_toolchain.sh | 23 ++++++++++++++++++++ scripts/lib/ptxd_make_serialize.sh | 11 +++++++--- scripts/lib/ptxd_make_world_common.sh | 37 ++++++++++++++++++++++++++------ scripts/lib/ptxd_make_world_compile.sh | 9 ++++++++ scripts/lib/ptxd_make_world_install.sh | 12 +++++++++++ scripts/lib/ptxd_make_world_prepare.sh | 17 ++++++++++++++- 6 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 scripts/lib/ptxd_make_meson_toolchain.sh (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_meson_toolchain.sh b/scripts/lib/ptxd_make_meson_toolchain.sh new file mode 100644 index 000000000..1b2598fdd --- /dev/null +++ b/scripts/lib/ptxd_make_meson_toolchain.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright (C) 2017 by Michael Olbrich +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +PTXDIST_MESON_CROSS_FILE="${PTXDIST_GEN_CONFIG_DIR}/cross-file.meson" +export PTXDIST_MESON_CROSS_FILE + +# +# generate meson cross file from template +# +# $1: meson cross file +# +ptxd_make_meson_cross_file() { + CPU="$(ptxd_cross_cc_v | sed -n -e "s/.*'-march=\([^']*\).*/\1/p" -e "/-march=/q")" \ + ptxd_replace_magic "${PTXDIST_TOPDIR}/config/meson/cross-file.meson.in" > "${1}" +} +export -f ptxd_make_meson_cross_file diff --git a/scripts/lib/ptxd_make_serialize.sh b/scripts/lib/ptxd_make_serialize.sh index 3ea8e13b0..8d560e5a5 100644 --- a/scripts/lib/ptxd_make_serialize.sh +++ b/scripts/lib/ptxd_make_serialize.sh @@ -56,10 +56,14 @@ ptxd_make_serialize_init() { if ! "${PTXCONF_SETUP_HOST_MAKE}" ${jobserver}=42,43 --help >& /dev/null; then jobserver="-j --jobserver-fds" fi - mflags="${sync} ${jobserver}=${ptxd_make_serialize_global_readfd},${ptxd_make_serialize_global_writefd}" - PTXDIST_PARALLELMFLAGS_INTERN="${mflags}" - PTXDIST_PARALLELMFLAGS_EXTERN="${mflags}" + mflags="${jobserver}=${ptxd_make_serialize_global_readfd},${ptxd_make_serialize_global_writefd}" + PTXDIST_PARALLELMFLAGS_INTERN="${sync} ${mflags}" + PTXDIST_PARALLELMFLAGS_EXTERN="${sync} ${mflags}" + PTXDIST_JOBSERVER_FLAGS="${mflags}" + PTXDIST_PARALLEL_FLAGS="${PTXDIST_PARALLELMFLAGS}" else + PTXDIST_JOBSERVER_FLAGS= + PTXDIST_PARALLEL_FLAGS="${PTXDIST_PARALLELMFLAGS_INTERN}" case "${PTXDIST_PARALLELMFLAGS_INTERN}" in -j1) ;; *) @@ -67,6 +71,7 @@ ptxd_make_serialize_init() { PTXDIST_PARALLELMFLAGS_INTERN="${PTXDIST_PARALLELMFLAGS_INTERN} ${sync}" ;; esac fi + export PTXDIST_JOBSERVER_FLAGS PTXDIST_PARALLEL_FLAGS ptxd_make_serialize_setup get 4 && ptxd_make_serialize_setup extract 2 diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh index c99500b8e..befd1df1e 100644 --- a/scripts/lib/ptxd_make_world_common.sh +++ b/scripts/lib/ptxd_make_world_common.sh @@ -130,13 +130,6 @@ ptxd_make_world_init_compat() { fi fi - # DESTDIR - if [[ "${pkg_conf_tool}" =~ "python" ]]; then - pkg_install_opt="${pkg_install_opt} --root=${pkg_pkg_dir}" - else - pkg_install_opt="DESTDIR=\"${pkg_pkg_dir}\" INSTALL_ROOT=\"${pkg_pkg_dir}\" ${pkg_install_opt}" - fi - # # pkg_binconfig_glob # @@ -295,6 +288,9 @@ ptxd_make_world_init() { if [ -e "${pkg_conf_dir}/Makefile.PL" ]; then pkg_conf_tool=${pkg_conf_tool}perl fi + if [ -e "${pkg_conf_dir}/meson.build" ]; then + pkg_conf_tool=${pkg_conf_tool}meson + fi fi case "${pkg_conf_tool}" in @@ -315,9 +311,35 @@ ptxd_make_world_init() { pkg_make_env="${pkg_conf_env:-${!env_ptr}}" pkg_make_opt="${pkg_make_opt:-build}" ;; + meson) + local conf_opt_ptr="ptx_conf_opt_${pkg_conf_tool}_${pkg_type}${conf_opt_ext}" + + pkg_conf_opt="${pkg_conf_opt:-${!conf_opt_ptr}}" + pkg_conf_env="PTXDIST_ICECC= ${pkg_conf_env}" + pkg_env="${pkg_env} LC_ALL='C.UTF-8'" + if [ "${PTXDIST_VERBOSE}" = "1" ]; then + pkg_make_opt="-v ${pkg_make_opt}" + pkg_install_opt="-v ${pkg_install_opt}" + fi + # both jobserver and argument limit parallelism so both are needed + pkg_env="${pkg_env} MAKEFLAGS='${PTXDIST_JOBSERVER_FLAGS}'" + PTXDIST_PARALLELMFLAGS_INTERN="${PTXDIST_PARALLEL_FLAGS}" + + unset conf_opt_ptr + ;; *) ;; esac + # DESTDIR + if [[ "${pkg_conf_tool}" =~ "python" ]]; then + pkg_install_opt="${pkg_install_opt} --root=${pkg_pkg_dir}" + elif [ "${pkg_conf_tool}" = "meson" ]; then + pkg_env="${pkg_env} DESTDIR=\"${pkg_pkg_dir}\"" + else + pkg_install_opt="DESTDIR=\"${pkg_pkg_dir}\" INSTALL_ROOT=\"${pkg_pkg_dir}\" ${pkg_install_opt}" + fi + + # # build dir # @@ -325,6 +347,7 @@ ptxd_make_world_init() { if [ -z "${pkg_build_oot}" ]; then case "${pkg_conf_tool}" in cmake) pkg_build_oot=YES ;; + meson) pkg_build_oot=YES ;; *) pkg_build_oot=NO ;; esac fi diff --git a/scripts/lib/ptxd_make_world_compile.sh b/scripts/lib/ptxd_make_world_compile.sh index c6eebc2c8..9cc739e57 100644 --- a/scripts/lib/ptxd_make_world_compile.sh +++ b/scripts/lib/ptxd_make_world_compile.sh @@ -30,6 +30,15 @@ ptxd_make_world_compile() { "${pkg_make_opt}" ) 2>&1 ;; + meson) + ptxd_eval \ + "${pkg_path}" \ + "${pkg_env}" \ + "${pkg_make_env}" \ + ninja -C "${pkg_build_dir}" \ + "${pkg_make_opt}" \ + "${pkg_make_par}" 2>&1 + ;; *) ptxd_eval \ "${pkg_path}" \ diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh index 1dd1dd62a..25175fcb8 100644 --- a/scripts/lib/ptxd_make_world_install.sh +++ b/scripts/lib/ptxd_make_world_install.sh @@ -84,6 +84,18 @@ ptxd_make_world_install() { cmd[${#cmd[@]}]=ptxd_make_world_install_python_cleanup fi ;; + meson) + cmd=( \ + "${pkg_path}" \ + "${pkg_env}" \ + "${pkg_make_env}" \ + "${pkg_install_env}" \ + ninja \ + -C "${pkg_build_dir}" \ + "${pkg_install_opt}" \ + -j1 \ + ) + ;; *) cmd=( \ "${pkg_path}" \ diff --git a/scripts/lib/ptxd_make_world_prepare.sh b/scripts/lib/ptxd_make_world_prepare.sh index ecc896205..cee6b7786 100644 --- a/scripts/lib/ptxd_make_world_prepare.sh +++ b/scripts/lib/ptxd_make_world_prepare.sh @@ -119,6 +119,21 @@ ptxd_make_world_prepare_perl() { export -f ptxd_make_world_prepare_perl +# +# prepare for meson based pkgs +# +ptxd_make_world_prepare_meson() { + ptxd_eval \ + "${pkg_path}" \ + "${pkg_env}" \ + "${pkg_conf_env}" \ + meson \ + "${pkg_conf_opt}" \ + "${pkg_conf_dir}" +} +export -f ptxd_make_world_prepare_meson + + # # generic prepare # @@ -138,7 +153,7 @@ ptxd_make_world_prepare() { fi case "${pkg_conf_tool}" in - autoconf|cmake|qmake|kconfig|perl) + autoconf|cmake|qmake|kconfig|perl|meson) cd -- "${pkg_build_dir}" && ptxd_make_world_prepare_"${pkg_conf_tool}" 2>&1 ;; python|python3) -- cgit v1.2.3