diff options
-rw-r--r-- | abuild.in | 2 | ||||
-rw-r--r-- | newapkbuild.in | 44 | ||||
-rwxr-xr-x | run-tests.sh | 8 |
3 files changed, 36 insertions, 18 deletions
@@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # abuild - build apk packages (light version of makepkg) # Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org> diff --git a/newapkbuild.in b/newapkbuild.in index 85f838f..9c4ffbf 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -68,13 +68,9 @@ build_cmake() { -DCMAKE_BUILD_TYPE=RelWithDebugInfo \\ -DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\ -DCMAKE_C_FLAGS="\$CFLAGS" \\ - \${CMAKE_CROSSOPTS} + \${CMAKE_CROSSOPTS} \\ + . make -} - -check() { - cd "\$builddir" - CTEST_OUTPUT_ON_FAILURE=TRUE ctest __EOF__ } @@ -115,6 +111,12 @@ check_make() { __EOF__ } +check_cmake() { + cat >>APKBUILD<<__EOF__ + CTEST_OUTPUT_ON_FAILURE=TRUE ctest +__EOF__ +} + check_python() { cat >>APKBUILD<<__EOF__ python3 setup.py test @@ -193,7 +195,7 @@ newaport() { python) makedepends="python3-dev";; cmake) makedepends="cmake";; meson) makedepends="meson";; - *) makedepends="\$depends_dev";; + *) makedepends="";; esac # Replace pkgver in $source @@ -226,9 +228,15 @@ url="$url" arch="all" license="$license" depends="$depends" -depends_dev="" makedepends="$makedepends" +__EOF__ + if [ -n "$install" ]; then + cat >>APKBUILD<<__EOF__ install="$install" +__EOF__ + fi + + cat >>APKBUILD<<__EOF__ subpackages="\$pkgname-dev \$pkgname-doc" source="$source" __EOF__ @@ -241,7 +249,12 @@ __EOF__ builddir=$(echo ${i#*/} | sed "s/$pv/\$pkgver/g") fi done - printf 'builddir="$srcdir/%s"\n\n' "$builddir" >> APKBUILD + if [ -n "$sdir" ] && [ "$sdir" = "src/$pkgname-$pv" ]; then + # No builddir needed. + printf '\n' >> APKBUILD + else + printf 'builddir="$srcdir/%s"\n\n' "$builddir" >> APKBUILD + fi # Subpackage -dev is usually required only for C/C++. Since depends_dev # confuses a lot people, remove it if there's no .h or .hpp file. @@ -271,7 +284,6 @@ __EOF__ # Create build() function cat >>APKBUILD<<__EOF__ build() { - cd "\$builddir" __EOF__ case "$buildtype" in @@ -287,6 +299,8 @@ __EOF__ build_perl;; python) build_python;; + *) + printf '# Add build instructions here.' >> APKBUILD esac cat >>APKBUILD<<__EOF__ @@ -297,14 +311,17 @@ __EOF__ # Create check() function cat >>APKBUILD<<__EOF__ check() { - cd "\$builddir" __EOF__ case "$buildtype" in - make|cmake|autotools|perl) + make|autotools|perl) check_make;; + cmake) + check_cmake;; python) check_python;; + *) + printf '# Add test instructions here.' >> APKBUILD esac cat >>APKBUILD<<__EOF__ @@ -315,7 +332,6 @@ __EOF__ # Create package() function cat >>APKBUILD<<__EOF__ package() { - cd "\$builddir" __EOF__ case "$buildtype" in @@ -329,6 +345,8 @@ __EOF__ package_perl;; python) package_python;; + *) + printf '# Add packaging instructions here.' >> APKBUILD esac if [ -n "$cpinitd" ]; then diff --git a/run-tests.sh b/run-tests.sh index b74627c..6cb8dc6 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,14 +1,14 @@ #!/bin/sh # # Test suite for abuild(1), newapkbuild(1), and friends -# +# # Copyright (c) 2018, A. Wilcox <awilfox@adelielinux.org> # Licensed under the GPL 2.0 only. No later version. # ##################################################################### # Ground rules: -# +# # * Must be POSIX shell compatible (no bash / dash extensions) # * Must test all common operations of newapkbuild # (not necessarily every single kind of package, but common ones) @@ -143,7 +143,7 @@ newapkbuild_simple_test() { shift cd "tests/newapkbuild" [ -d $name ] && rm -r $name - newapkbuild -n $name $@ + ../../newapkbuild $@ if [ $? -ne 0 ]; then fail $name cd "$OLDPWD" @@ -166,7 +166,7 @@ newapkbuild_simple_test simplever 'pkgver=1.0' simplever-1.0 newapkbuild_pkg_test() { cd "tests/newapkbuild" [ -d $1 ] && rm -r $1 - newapkbuild "https://distfiles.adelielinux.org/source/newapkbuild-tests/$1-1.0.tar.xz" 1>/dev/null 2>/dev/null + ../../newapkbuild "https://distfiles.adelielinux.org/source/newapkbuild-tests/$1-1.0.tar.xz" 1>/dev/null 2>/dev/null cd "$OLDPWD" if [ $? -ne 0 ]; then fail "$1: newapkbuild failed" |