newapkbuild: do out-of-source CMake builds by default

It is recommended by upstream CMake (it will warn when you do in-source
builds) to keep generated files away from the source.
This commit is contained in:
Leo 2020-01-17 23:41:46 +01:00 committed by Sören Tempel
parent d0828c0655
commit e125a76489

View File

@ -61,7 +61,7 @@ build_cmake() {
if [ "\$CBUILD" != "\$CHOST" ]; then if [ "\$CBUILD" != "\$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi fi
cmake \\ cmake -B build \\
-DCMAKE_INSTALL_PREFIX=/usr \\ -DCMAKE_INSTALL_PREFIX=/usr \\
-DCMAKE_INSTALL_LIBDIR=lib \\ -DCMAKE_INSTALL_LIBDIR=lib \\
-DBUILD_SHARED_LIBS=True \\ -DBUILD_SHARED_LIBS=True \\
@ -69,7 +69,7 @@ build_cmake() {
-DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\ -DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\
-DCMAKE_C_FLAGS="\$CFLAGS" \\ -DCMAKE_C_FLAGS="\$CFLAGS" \\
\${CMAKE_CROSSOPTS} . \${CMAKE_CROSSOPTS} .
make make -C build
__EOF__ __EOF__
} }
@ -124,6 +124,12 @@ check_make() {
__EOF__ __EOF__
} }
check_cmake() {
cat >>APKBUILD<<__EOF__
CTEST_OUTPUT_ON_FAILURE=1 make -C build check
__EOF__
}
check_python() { check_python() {
cat >>APKBUILD<<__EOF__ cat >>APKBUILD<<__EOF__
python3 setup.py test python3 setup.py test
@ -156,6 +162,12 @@ package_make() {
__EOF__ __EOF__
} }
package_cmake() {
cat >>APKBUILD<<__EOF__
make -C build DESTDIR="\$pkgdir" install
__EOF__
}
package_autotools() { package_autotools() {
package_make package_make
} }
@ -348,8 +360,10 @@ check() {
__EOF__ __EOF__
case "$buildtype" in case "$buildtype" in
make|cmake|autotools|perl) make|autotools|perl)
check_make;; check_make;;
cmake)
check_cmake;;
python) python)
check_python;; check_python;;
rust) rust)
@ -369,8 +383,10 @@ package() {
__EOF__ __EOF__
case "$buildtype" in case "$buildtype" in
make|cmake) make)
package_make;; package_make;;
cmake)
package_cmake;;
autotools) autotools)
package_autotools;; package_autotools;;
meson) meson)