Commit edf5c5fb authored by Natanael Copa's avatar Natanael Copa

Define subpkgdir for sub package funcs

better handling of cleaning subpackages
parent 5bf92320
......@@ -111,7 +111,7 @@ clean() {
rm -rf "$pkgdir"
local i
for i in $subpackages; do
INSUB=1 $0 $i clean
rm -rf "$pkgdir-$i"
done
}
......@@ -132,7 +132,7 @@ cleanpkg() {
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz"
local i
for i in $subpackages; do
INSUB=1 $0 $i cleanpkg
INSUB=1 subpkgdir="$pkgdir-$i" $0 $i cleanpkg
done
}
......@@ -152,15 +152,16 @@ subpkg() {
local i
cd "$startdir"
for i in $subpackages; do
INSUB=1 $0 $i package || return 1
INSUB=1 subpkgdir="$pkgdir-$i" $0 $i package || return 1
done
}
package_apk() {
local dir=${subpkgdir:-$pkgdir}
local p="$pkgname-$pkgver"
[ "$pkgrel" -ne 0 ] && p="$p-r$pkgrel"
local pkg="$p.apk"
local db="$pkgdir/var/db/apk/$p"
local db="$dir/var/db/apk/$p"
mkdir -p "$db"
echo "$arch" > "$db/ARCH"
echo "$pkgdesc" > "$db/DESC"
......@@ -171,7 +172,7 @@ package_apk() {
for i in pre-install post-install pre-deinstall post-deinstall; do
[ -f ../$i ] && cp ../$i "$db"/
done
( cd "$pkgdir" && tar -zcf "$PKGDEST/$pkg" * )
( cd "$dir" && tar -zcf "$PKGDEST/$pkg" * )
}
package() {
......@@ -180,51 +181,43 @@ package() {
# predefined subpackage doc
doc() {
local origname="$pkgname"
local origpkgdir="$pkgdir"
pkgname="$pkgname-doc"
pkgdir="$pkgdir-doc"
depends=""
local i
for i in doc man info html sgml; do
if [ -d "$origpkgdir/usr/share/$i" ]; then
mkdir -p "$pkgdir/usr/share"
mv "$origpkgdir/usr/share/$i" "$pkgdir/usr/share"
if [ -d "$pkgdir/usr/share/$i" ]; then
mkdir -p "$subpkgdir/usr/share"
mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/"
fi
done
[ -d "$pkgdir/usr/share/man" ] && depends="man"
[ -d "$subpkgdir/usr/share/man" ] && depends="man"
return 0
}
# predefined subpackage mod
mod() {
local origname="$pkgname"
local origpkgdir="$pkgdir"
pkgname="$pkgname-mod"
pkgdir="$pkgdir-mod"
depends="$kernel"
for i in firmware modules; do
if [ -d $origpkgdir/lib/$i ]; then
mkdir -p $pkgdir/lib
mv $origpkgdir/lib/$i $pkgdir/lib
if [ -d "$pkgdir/lib/$i" ]; then
rm -rf "$subpkgdir/lib"
mkdir -p "$subpkgdir/lib"
mv "$pkgdir/lib/$i" "$subdir/lib"
fi
done
}
# predefined subpackage dev
dev() {
local origname="$pkgname"
local origpkgdir="$pkgdir"
depends="$pkgname"
pkgname="$pkgname-dev"
pkgdir="$pkgdir-dev"
depends="$origname"
for i in $(cd "$origpkgdir" && find usr/lib -name '*.a' -o \
for i in $(cd "$pkgdir" && find usr/lib -name '*.a' -o \
-name '*.la' -o -name '*.o' 2>/dev/null) \
usr/include usr/lib/pkgconfig usr/share/aclocal; do
if [ -e "$origpkgdir/$i" ] || [ -L "$origpkgdir/$i" ]; then
d="$pkgdir/${i%/*}" # dirname $i
if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then
d="$subpkgdir/${i%/*}" # dirname $i
mkdir -p "$d"
mv "$origpkgdir/$i" "$d"
mv "$pkgdir/$i" "$d"
fi
done
}
......
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