Commit b849aae4 authored by Leo's avatar Leo Committed by Natanael Copa

abuild: provide a default_static() and static() functions

- Also check for static archives and warn on lack of static subpackage
parent f83d19ce
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment