summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-10-24 20:37:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-10-24 20:37:20 +0000
commitf150027100d2488b318af935979c9b32ff420c71 (patch)
tree13d4bfce4313b5e0faba6d32c02a423cc8702150
parentc50ab80bfaf00fbc974e3847b613d0ce2b6e1549 (diff)
downloadabuild-f150027100d2488b318af935979c9b32ff420c71.tar.gz
abuild-f150027100d2488b318af935979c9b32ff420c71.tar.bz2
abuild-f150027100d2488b318af935979c9b32ff420c71.tar.xz
abuild-f150027100d2488b318af935979c9b32ff420c71.zip
abuild: fix so APKBUILD env var works properly
We also make sure we source the APKBUILD when we are in the directory holding the APKBUILD file. Some of the packages sources others with relative references. (for example kernel 3rd party packages)
-rw-r--r--Makefile3
-rwxr-xr-xabuild.in33
2 files changed, 23 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 43e5e57..1c6c539 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ else
FULL_VERSION := $(VERSION)
endif
+CHMOD := chmod
SED := sed
TAR := tar
@@ -39,9 +40,11 @@ SSL_LIBS := $(shell pkg-config --libs openssl)
.SUFFIXES: .sh.in .in
.sh.in.sh:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
+ ${CHMOD} +x $@
.in:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
+ ${CHMOD} +x $@
P=$(PACKAGE)-$(VERSION)
diff --git a/abuild.in b/abuild.in
index c7168ee..c6f85c1 100755
--- a/abuild.in
+++ b/abuild.in
@@ -14,16 +14,9 @@ apkcache=@apkcache@
datadir=@datadir@
program=${0##*/}
-startdir="$PWD"
-srcdir=${srcdir:-"$startdir/src"}
-pkgbasedir=${pkgbasedir:-"$startdir/pkg"}
-pkgrel=0
-repo=${startdir%/*}
-repo=${repo##*/}
+abuild_path=$(readlink -f $0)
# defaults
-SRCDEST=${SRCDEST:-$startdir}
-PKGDEST=${PKGDEST:-$startdir}
BUILD_BASE="build-base"
SUDO=${SUDO:-"sudo"}
@@ -635,7 +628,8 @@ rootpkg() {
fi
cd "$startdir"
msg "Entering fakeroot..."
- fakeroot $0 $do_build prepare_subpackages prepare_package create_apks
+ fakeroot "$abuild_path" $do_build prepare_subpackages prepare_package \
+ create_apks
}
srcpkg() {
@@ -1017,15 +1011,28 @@ while getopts "dfhi:kinp:P:qrRs:u" opt; do
done
shift $(( $OPTIND - 1 ))
+# find startdir
+[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)"
+APKBUILD=$(readlink -f "$APKBUILD")
+
+startdir="${APKBUILD%/*}"
+srcdir=${srcdir:-"$startdir/src"}
+pkgbasedir=${pkgbasedir:-"$startdir/pkg"}
+pkgrel=0
+repo=${startdir%/*}
+repo=${repo##*/}
+
+SRCDEST=${SRCDEST:-$startdir}
+PKGDEST=${PKGDEST:-$startdir}
+
+cd "$startdir" || die
+. "$APKBUILD"
+
# If REPODEST is set then it will override the PKGDEST
if [ -n "$REPODEST" ]; then
PKGDEST="$REPODEST/$repo"
fi
-# source the buildfile
-[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)"
-. "$APKBUILD"
-
# If we are handling a sub package then reset subpackages and install
if [ -n "$subpkgname" ]; then
origsubpackages="$subpackages"