diff options
-rw-r--r-- | config/meson/cross-file.meson.in | 12 | ||||
-rw-r--r-- | rules/host-meson.make | 2 | ||||
-rw-r--r-- | rules/post/ptxd_make_meson_toolchain.make | 17 | ||||
-rw-r--r-- | rules/post/ptxd_make_world_common.make | 2 | ||||
-rw-r--r-- | rules/pre/Rules.make | 7 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_meson_toolchain.sh | 23 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_serialize.sh | 11 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_common.sh | 37 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_compile.sh | 9 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_install.sh | 12 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_prepare.sh | 17 |
11 files changed, 138 insertions, 11 deletions
diff --git a/config/meson/cross-file.meson.in b/config/meson/cross-file.meson.in new file mode 100644 index 000000000..b2861254a --- /dev/null +++ b/config/meson/cross-file.meson.in @@ -0,0 +1,12 @@ +[binaries] +c = '@CC@' +cpp = '@CXX@' +ar = '@AR@' +strip = '@STRIP@' +pkgconfig = '@PKG_CONFIG@' + +[host_machine] +system = 'linux' +cpu_family = '@PTXCONF_ARCH_STRING@' +cpu = '@CPU@' +endian = '@ENDIAN@' diff --git a/rules/host-meson.make b/rules/host-meson.make index 3090ee754..b27fa55e8 100644 --- a/rules/host-meson.make +++ b/rules/host-meson.make @@ -61,4 +61,6 @@ $(STATEDIR)/host-meson.install: @ln -svf ../share/meson/meson $(HOST_MESON_PKGDIR)/bin/meson @$(call touch) +$(STATEDIR)/host-meson.install.post: $(PTXDIST_MESON_CROSS_FILE) + # vim: syntax=make diff --git a/rules/post/ptxd_make_meson_toolchain.make b/rules/post/ptxd_make_meson_toolchain.make new file mode 100644 index 000000000..d9c2aabca --- /dev/null +++ b/rules/post/ptxd_make_meson_toolchain.make @@ -0,0 +1,17 @@ +# -*-makefile-*- +# +# Copyright (C) 2017 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# 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): + @$(CROSS_ENV) \ + PTXCONF_ARCH_STRING=${PTXCONF_ARCH_STRING} \ + ENDIAN=$(call ptx/ifdef, PTXCONF_ENDIAN_LITTLE, little, big) \ + ptxd_make_meson_cross_file "${@}" + +# vim: syntax=make diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make index 5a4e9a6f3..ffa16a0b1 100644 --- a/rules/post/ptxd_make_world_common.make +++ b/rules/post/ptxd_make_world_common.make @@ -55,6 +55,8 @@ ptx/env = \ ptx_python3_host="$(call ptx/escape,$(HOSTPYTHON3))" \ ptx_install_opt_python_host="$(call ptx/escape,$(HOST_PYTHON_INSTALL))" \ \ + ptx_conf_opt_meson_target="$(call ptx/escape,$(CROSS_MESON_USR))" \ + \ ptx_xpkg_extra_args=$(PTXCONF_IMAGE_XPKG_EXTRA_ARGS) \ ptx_xpkg_type=$(PTXCONF_HOST_PACKAGE_MANAGEMENT) diff --git a/rules/pre/Rules.make b/rules/pre/Rules.make index 53e49306b..6d09995db 100644 --- a/rules/pre/Rules.make +++ b/rules/pre/Rules.make @@ -257,6 +257,13 @@ CROSS_QMAKE_OPT := \ CROSS_PYTHON_INSTALL := install --prefix=/usr HOST_PYTHON_INSTALL := install --prefix= +CROSS_MESON_USR := \ + --prefix /usr \ + --libdir $(CROSS_LIB_DIR) \ + --backend ninja \ + --buildtype debugoptimized \ + --cross-file '${PTXDIST_MESON_CROSS_FILE}' + ifdef PTXCONF_GLOBAL_IPV6 GLOBAL_IPV6_OPTION := --enable-ipv6 else 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 <m.olbrich@pengutronix.de> +# +# 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 @@ -120,6 +120,21 @@ 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 # ptxd_make_world_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) |