From 1a27e252f790a5abd485249036e33ab90712f9a8 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 5 Jun 2019 15:54:18 +0200 Subject: ptxd_make_world_*: allow ninja generator for cmake cmake can be used with 'make' and 'ninja'. Currently only 'make' is supported. This introduces a check to determine which generator is selected and calls the corresponding tool in the compile and install stages. Signed-off-by: Michael Olbrich --- scripts/lib/ptxd_make_world_common.sh | 54 ++++++++++++++++++++++------------ scripts/lib/ptxd_make_world_compile.sh | 4 +-- scripts/lib/ptxd_make_world_install.sh | 4 +-- 3 files changed, 40 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh index 0cc294915..a65707b15 100644 --- a/scripts/lib/ptxd_make_world_common.sh +++ b/scripts/lib/ptxd_make_world_common.sh @@ -336,15 +336,6 @@ ptxd_make_world_init() { pkg_env="${pkg_env} LC_ALL='$(locale -a | grep -i -m 1 "\.utf[-]\?8")'" fi unset c_locale - - if [ "${PTXDIST_VERBOSE}" = "1" ]; then - pkg_make_opt="-v ${pkg_make_opt}" - pkg_install_opt="-v ${pkg_install_opt}" - fi - # pass jobserver via MAKEFLAGS to ninja - pkg_env="${pkg_env} MAKEFLAGS='${PTXDIST_JOBSERVER_FLAGS}'" - PTXDIST_PARALLELMFLAGS_INTERN="" - unset conf_opt_ptr ;; *) @@ -370,15 +361,6 @@ ptxd_make_world_init() { whitelist_target="$(echo $(cat "${deps_target[@]}" /dev/null 2>/dev/null))" pkg_env="PKGCONFIG_WHITELIST_HOST='${whitelist_host}' PKGCONFIG_WHITELIST_TARGET='${whitelist_target}' PKGCONFIG_WHITELIST_SRC='${pkg_label}' ${pkg_env}" - # 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 @@ -413,6 +395,42 @@ ptxd_make_world_init() { pkg_conf_dir="$(ptxd_abs2rel "${pkg_build_dir}" "${pkg_conf_dir}")" fi + # + # make or ninja + # + pkg_build_tool="${pkg_conf_tool}" + case "${pkg_conf_tool}" in + meson) + pkg_build_tool=ninja + ;; + cmake) + if [ -e "${pkg_build_dir}/build.ninja" ]; then + pkg_build_tool=ninja + fi + esac + if [ "${pkg_build_tool}" = "ninja" ]; then + if [ "${PTXDIST_VERBOSE}" = "1" ]; then + pkg_make_opt="-v ${pkg_make_opt}" + pkg_install_opt="-v ${pkg_install_opt}" + fi + # pass jobserver via MAKEFLAGS to ninja + pkg_env="${pkg_env} MAKEFLAGS='${PTXDIST_JOBSERVER_FLAGS}'" + PTXDIST_PARALLELMFLAGS_INTERN="" + fi + + # DESTDIR + case "${pkg_build_tool}" in + python*) + pkg_install_opt="${pkg_install_opt} --root=${pkg_pkg_dir}" + ;; + ninja) + pkg_env="DESTDIR=\"${pkg_pkg_dir}\" ${pkg_env}" + ;; + *) + pkg_install_opt="DESTDIR=\"${pkg_pkg_dir}\" INSTALL_ROOT=\"${pkg_pkg_dir}\" ${pkg_install_opt}" + ;; + esac + # # parallelmake # diff --git a/scripts/lib/ptxd_make_world_compile.sh b/scripts/lib/ptxd_make_world_compile.sh index 6d4a611fc..a15a46054 100644 --- a/scripts/lib/ptxd_make_world_compile.sh +++ b/scripts/lib/ptxd_make_world_compile.sh @@ -17,7 +17,7 @@ ptxd_make_world_compile() { # no build dir -> assume the package has nothing to build. return fi && - case "${pkg_conf_tool}" in + case "${pkg_build_tool}" in python*) ( ptxd_eval \ @@ -30,7 +30,7 @@ ptxd_make_world_compile() { "${pkg_make_opt}" ) ;; - meson) + ninja) ptxd_eval \ "${pkg_path}" \ "${pkg_env}" \ diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh index 9f865de97..74ca980f1 100644 --- a/scripts/lib/ptxd_make_world_install.sh +++ b/scripts/lib/ptxd_make_world_install.sh @@ -70,7 +70,7 @@ ptxd_make_world_install() { ptxd_make_world_install_prepare && - case "${pkg_conf_tool}" in + case "${pkg_build_tool}" in python*) cmd=( \ cd "${pkg_build_dir}" '&&' \ @@ -87,7 +87,7 @@ ptxd_make_world_install() { cmd[${#cmd[@]}]=ptxd_make_world_install_python_cleanup fi ;; - meson) + ninja) cmd=( \ "${pkg_path}" \ "${pkg_env}" \ -- cgit v1.2.3