diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2008-10-24 09:40:30 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2008-10-24 09:40:30 +0000 |
commit | edf5c5fb029b184410738ea76bfeabd0e1ec4934 (patch) | |
tree | eddf5ddf520d1aa7c0ef1798aa36c35a74d327fe /abuild | |
parent | 5bf92320625a5aa9ed31454379798360997e0fda (diff) | |
download | abuild-edf5c5fb029b184410738ea76bfeabd0e1ec4934.tar.gz abuild-edf5c5fb029b184410738ea76bfeabd0e1ec4934.tar.bz2 abuild-edf5c5fb029b184410738ea76bfeabd0e1ec4934.tar.xz abuild-edf5c5fb029b184410738ea76bfeabd0e1ec4934.zip |
Define subpkgdir for sub package funcs
better handling of cleaning subpackages
Diffstat (limited to 'abuild')
-rwxr-xr-x | abuild | 45 |
1 files changed, 19 insertions, 26 deletions
@@ -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 } |