From b849aae4b9bd431002935c7bed45024bdd4e9c88 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 26 Apr 2019 21:23:27 -0300 Subject: abuild: provide a default_static() and static() functions - Also check for static archives and warn on lack of static subpackage --- abuild.in | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/abuild.in b/abuild.in index be81a66..159c98d 100644 --- a/abuild.in +++ b/abuild.in @@ -695,6 +695,12 @@ postcheck() { && ! is_openrc_pkg "$name"; then warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc" fi + # look for static archives + if ! is_static_pkg "$name"; then + for i in $(find "$dir"/lib "$dir"/usr/lib -name '*.a' 2>/dev/null); do + warning "Found static archive on ${i##*$dir/} but name doesn't end with -static" + done + fi # look for /usr/share/doc if [ -e "$dir"/usr/share/doc ] \ && ! is_doc_pkg "$name"; then @@ -1108,6 +1114,11 @@ is_dev_pkg() { test "${subpkgname%-dev}" != "$subpkgname" } +# returns true if this is the -static package +is_static_pkg() { + test "${1%-static}" != "$1" +} + # returns true if this is the -doc package is_doc_pkg() { test "${1%-doc}" != "$1" @@ -1125,7 +1136,7 @@ archcheck() { [ "${subpkgarch:-$pkgarch}" != "noarch" ] && return 0 error "Arch specific binaries found so arch must not be set to \"noarch\"" return 1 - elif [ "${subpkgarch:-$pkgarch}" != "noarch" ] && ! is_dev_pkg; then + elif [ "${subpkgarch:-$pkgarch}" != "noarch" ] && ! is_dev_pkg && ! is_static_pkg "$subpkgname"; then # we dont want -dev package go to noarch warning "No arch specific binaries found so arch should probably be set to \"noarch\"" fi @@ -1705,7 +1716,9 @@ default_dev() { usr/lib/qt*/mkspecs \ usr/lib/cmake \ $(find . -name include -type d) \ - $(find $libdirs -name '*.[acho]' \ + $([ -z "${subpackages##*$pkgname-static*}" ] && find $libdirs \ + -name '*.a' 2>/dev/null) \ + $(find $libdirs -name '*.[cho]' \ -o -name '*.prl' 2>/dev/null); do if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then d="$subpkgdir/${i%/*}" # dirname $i @@ -1728,6 +1741,28 @@ dev() { default_dev } +# predefined splitfunc static +default_static() { + local i= + depends="" + pkgdesc="$pkgdesc (static library)" + + cd "$pkgdir" || return 0 + local libdirs=usr/lib + [ -d lib/ ] && libdirs="lib/ $libdirs" + + # move *.a static library + for i in $(find $libdir -name '*.a'); do + mkdir -p "$subpkgdir"/"${i%/*}" + mv "$i" "$subpkgdir/$i" || return 1 + done + return 0 +} + +static() { + default_static +} + # predefined splitfunc libs default_libs() { depends="$depends_libs" -- cgit v1.2.3-60-g2f50