diff options
author | Leo <thinkabit.ukim@gmail.com> | 2019-04-26 21:23:27 -0300 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-04-29 18:38:22 +0000 |
commit | b849aae4b9bd431002935c7bed45024bdd4e9c88 (patch) | |
tree | 53f3f6fc5b70138e5997ff07f73291b5222b8c9f | |
parent | f83d19ce79ab9f2dcc5238346a910cd18ae0f330 (diff) | |
download | abuild-b849aae4b9bd431002935c7bed45024bdd4e9c88.tar.bz2 abuild-b849aae4b9bd431002935c7bed45024bdd4e9c88.tar.xz |
abuild: provide a default_static() and static() functions
- Also check for static archives and warn on lack of static subpackage
-rw-r--r-- | abuild.in | 39 |
1 files changed, 37 insertions, 2 deletions
@@ -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" |