summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-01-04 10:32:12 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-01-04 10:32:12 +0000
commit5d9012c09adaf72dc1f97453c6a207c8109fed2c (patch)
tree8841266ceb03cfa584087151ac760cfd29cb4d4a /abuild.in
parent2182953390723eb9854092063448c1882947da52 (diff)
downloadabuild-5d9012c09adaf72dc1f97453c6a207c8109fed2c.tar.gz
abuild-5d9012c09adaf72dc1f97453c6a207c8109fed2c.tar.bz2
abuild-5d9012c09adaf72dc1f97453c6a207c8109fed2c.tar.xz
abuild-5d9012c09adaf72dc1f97453c6a207c8109fed2c.zip
abuild: add support for language packs
Diffstat (limited to 'abuild.in')
-rwxr-xr-xabuild.in59
1 files changed, 46 insertions, 13 deletions
diff --git a/abuild.in b/abuild.in
index bd786a7..904b1c3 100755
--- a/abuild.in
+++ b/abuild.in
@@ -322,11 +322,21 @@ cleancache() {
done
}
+listpkgnames() {
+ local i
+ for i in $pkgname $subpackages; do
+ echo ${i%:*}
+ done
+ for i in $linguas; do
+ echo $pkgname-lang-$i
+ done
+}
+
cleanpkg() {
local i
getpkgver || return 1
msg "Cleaning built packages..."
- for i in $pkgname $subpackages; do
+ for i in $(listpkgnames); do
local p="${i%:*}-$pkgver-r$pkgrel"
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \
"$abuildrepo"/$p.apk
@@ -339,7 +349,7 @@ cleanoldpkg() {
local i j
getpkgver || return 1
msg "Cleaning all packages except $pkgver-r$pkgrel..."
- for i in $pkgname $subpackages; do
+ for i in $(listpkgnames); do
for j in "$PKGDEST"/${i%:*}-[0-9]*.apk; do
[ "$j" != "$PKGDEST/${i%:*}-$pkgver-r$pkgrel.apk" ] \
&& rm -f "$j"
@@ -404,9 +414,6 @@ get_split_func() {
}
prepare_subpackages() {
- if [ -z "$subpackages" ]; then
- return 0
- fi
local i
cd "$startdir"
for i in $subpackages; do
@@ -418,6 +425,28 @@ prepare_subpackages() {
done
}
+lang_subpkg() {
+ if [ -z "$lang" ]; then
+ error "lang is not set"
+ return 1
+ fi
+ arch="noarch"
+ install_if="$pkgname=$pkgver-r$pkgrel lang-$lang"
+ mkdir -p "$subpkgdir"/usr/share/locale
+ mv "$pkgdir"/usr/share/locale/$lang* \
+ "$subpkgdir"/usr/share/locale/ \
+ || return 1
+}
+
+prepare_language_packs() {
+ for lang in $linguas; do
+ lang="$lang" \
+ subpkgname="$pkgname-lang-$lang" \
+ subpkgdir="$pkgbasedir"/$subpkgname \
+ $0 lang_subpkg prepare_package || return 1
+ done
+}
+
prepare_metafiles() {
getpkgver || return 1
local name=${subpkgname:-$pkgname}
@@ -506,6 +535,7 @@ EOF
prepare_tracedeps() {
local dir=${subpkgdir:-$pkgdir}
+ [ "$arch" = "noarch" ] && return 0
options_has "!tracedeps" && return 0
# lets tell all the .so files this package provides in .provides-so
find -name '*.so' -o -name '*.so.[0-9]*' | sed 's:.*/::' \
@@ -600,12 +630,12 @@ trace_apk_deps() {
fi
# special case for libpthread: we need depend on libgcc
- if grep -q -w '^libpthread.so.*' "$dir"/.needs-so 2>/dev/null \
+ if [ -f "$dir"/.needs-so ] && grep -q -w '^libpthread.so.*' "$dir"/.needs-so \
&& ! grep -q -w "^depend = libgcc" "$dir"/.PKGINFO; then
autodeps="$autodeps libgcc"
msg " added libgcc (due to libpthread)"
fi
- for i in $(cat "$dir"/.needs-so 2>/dev/null); do
+ [ -f "$dir"/.needs-so ] && for i in $(cat "$dir"/.needs-so); do
found=
# first check if its provide by same apkbuild
for j in "$dir"/../.control.*/.provides-so; do
@@ -624,9 +654,11 @@ trace_apk_deps() {
done
# find all packages that holds the so files
- so_files=$(find_so_files "$dir"/.rpaths $missing) || return 1
- deppkgs=$($APK info -q -W $so_files) || return 1
-
+ if [ -f "$dir"/.rpaths ]; then
+ so_files=$(find_so_files "$dir"/.rpaths $missing) || return 1
+ deppkgs=$($APK info -q -W $so_files) || return 1
+ fi
+
for found in $self_provided $deppkgs; do
if grep -w "^depend = ${found}$" "$dir"/.PKGINFO >/dev/null ; then
warning "You can remove '$found' from depends"
@@ -822,6 +854,7 @@ rootpkg() {
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
$FAKEROOT -- "$abuild_path" $color_opt $do_build \
prepare_subpackages \
+ prepare_language_packs \
prepare_package \
create_apks
}
@@ -1072,10 +1105,10 @@ stripbin() {
# simply list target apks
listpkg() {
- local i
+ local name
getpkgver || return 1
- for i in $pkgname $subpackages; do
- echo "${i%:*}-$pkgver-r$pkgrel.apk"
+ for name in $(listpkgnames) ; do
+ echo "$name-$pkgver-r$pkgrel.apk"
done
}