From e30ccdc3eaaac41a29825fad318972f51256fcb0 Mon Sep 17 00:00:00 2001 From: beefcurtains Date: Mon, 29 Jun 2015 11:19:50 +0000 Subject: [PATCH] build-style/cmake.sh: allow build subdirectory --- Manual.md | 4 +++- common/build-style/cmake.sh | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Manual.md b/Manual.md index 622eee3743a..66ac89a4042 100644 --- a/Manual.md +++ b/Manual.md @@ -545,7 +545,9 @@ to execute a `build_style` script must be defined via `$hostmakedepends`. The current list of available `build_style` scripts is the following: - `cmake` For packages that use the CMake build system, configuration arguments -can be passed in via `configure_args`. +can be passed in via `configure_args`. The `cmake_builddir` variable may be +defined to specify the directory for building under `build_wrksrc` instead of +the default `build`. - `configure` For packages that use non-GNU configure scripts, at least `--prefix=/usr` should be passed in via `configure_args`. diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh index 30654953dc9..503558ad812 100644 --- a/common/build-style/cmake.sh +++ b/common/build-style/cmake.sh @@ -2,8 +2,8 @@ # This helper is for templates using cmake. # do_configure() { - [ ! -d build ] && mkdir build - cd build + [ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir} + cd ${cmake_builddir} if [ "$CROSS_BUILD" ]; then cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF @@ -32,13 +32,14 @@ _EOF configure_args+=" -DCMAKE_INSTALL_SBINDIR=bin" - cmake ${configure_args} .. + cmake ${configure_args} $(echo ${cmake_builddir}|sed \ + -e 's|[^/]$|/|' -e 's|[^/]*||g' -e 's|/|../|g') } do_build() { : ${make_cmd:=make} - cd build + cd ${cmake_builddir:=build} ${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} } @@ -46,6 +47,6 @@ do_install() { : ${make_cmd:=make} : ${make_install_target:=install} - cd build + cd ${cmake_builddir:=build} ${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target} }