build-style/cmake.sh: allow build subdirectory

This commit is contained in:
beefcurtains 2015-06-29 11:19:50 +00:00
parent 1de91493ce
commit e30ccdc3ea
2 changed files with 9 additions and 6 deletions

View File

@ -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`.

View File

@ -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}
}