[pacman-dev] [PATCH 5/9] Moved commands to setup build environment and run build() into run_build().
Andrew Fyfe
andrew at neptune-one.net
Sun Apr 1 18:49:57 EDT 2007
Signed-off-by: Andrew Fyfe <andrew at neptune-one.net>
diff --git a/scripts/makepkg.in b/scripts/makepkg.in
index e4af2a1..1fd7cf9 100755
--- a/scripts/makepkg.in
+++ b/scripts/makepkg.in
@@ -356,6 +356,68 @@ removedeps() {
fi
}
+run_build () {
+ # use distcc if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
+ [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
+ elif [ "$(check_option distcc)" = "n" ]; then
+ # if it is not wanted, clear the makeflags too
+ export MAKEFLAGS=""
+ fi
+
+ # use ccache if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
+ [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
+ fi
+
+ # clear user-specified makeflags if requested
+ if [ "$(check_option makeflags)" = "n" ]; then
+ export MAKEFLAGS=""
+ fi
+
+ # build
+ msg "$(gettext "Starting build()...")"
+
+ # some applications (eg, blackbox) will not build with some languages
+ unset LC_ALL LANG
+ umask 0022
+
+ #check for "exit on syntax error" shell option
+ echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
+ set_e=$?
+
+ ret=0
+ if [ "$LOGGING" = "1" ]; then
+ BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
+ if [ -f "$BUILDLOG" ]; then
+ i=1
+ while true; do
+ if [ -f "$BUILDLOG.$i" ]; then
+ i=$(($i +1))
+ else
+ break
+ fi
+ done
+ mv "$BUILDLOG" "$BUILDLOG.$i"
+ fi
+
+ #use 'errexit' to bail on syntax error
+ [ $set_e -eq 1 ] && set -e
+ build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
+ [ $set_e -eq 1 ] && set +e
+ else
+ #use 'errexit' to bail on syntax error
+ [ $set_e -eq 1 ] && set -e
+ build 2>&1 || ret=$?
+ [ $set_e -eq 1 ] && set +e
+ fi
+ if [ $ret -gt 0 ]; then
+ error "$(gettext "Build Failed. Aborting...")"
+ removedeps
+ exit 2
+ fi
+}
+
tidy_install () {
cd "$startdir"/pkg
msg2 "$(gettext "Tidying install...")"
@@ -1017,65 +1079,7 @@ else
fi
mkdir -p "$startdir/pkg"
- # use distcc if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
- [ -d /usr/lib/distcc/bin ] && export PATH=/usr/lib/distcc/bin:$PATH
- elif [ "$(check_option distcc)" = "n" ]; then
- # if it is not wanted, clear the makeflags too
- export MAKEFLAGS=""
- fi
-
- # use ccache if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
- [ -d /usr/lib/ccache/bin ] && export PATH=/usr/lib/ccache/bin:$PATH
- fi
-
- # clear user-specified makeflags if requested
- if [ "$(check_option makeflags)" = "n" ]; then
- export MAKEFLAGS=""
- fi
-
- # build
- msg "$(gettext "Starting build()...")"
-
- # some applications (eg, blackbox) will not build with some languages
- unset LC_ALL LANG
- umask 0022
-
- #check for "exit on syntax error" shell option
- echo $SHELLOPTS | grep errexit 2>&1 >/dev/null
- set_e=$?
-
- ret=0
- if [ "$LOGGING" = "1" ]; then
- BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.log"
- if [ -f "$BUILDLOG" ]; then
- i=1
- while true; do
- if [ -f "$BUILDLOG.$i" ]; then
- i=$(($i +1))
- else
- break
- fi
- done
- mv "$BUILDLOG" "$BUILDLOG.$i"
- fi
-
- #use 'errexit' to bail on syntax error
- [ $set_e -eq 1 ] && set -e
- build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
- [ $set_e -eq 1 ] && set +e
- else
- #use 'errexit' to bail on syntax error
- [ $set_e -eq 1 ] && set -e
- build 2>&1 || ret=$?
- [ $set_e -eq 1 ] && set +e
- fi
- if [ $ret -gt 0 ]; then
- error "$(gettext "Build Failed. Aborting...")"
- removedeps
- exit 2
- fi
+ run_build
fi
tidy_install
--
1.5.0.6
More information about the pacman-dev
mailing list