summaryrefslogtreecommitdiff
path: root/build_stage1_package.sh
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-02-01 11:43:22 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-02-01 11:43:22 +0100
commitab6c622e801c15627beac5cdc0e0f6d9270316aa (patch)
treeb16f9d97c95733a23d5d2780735e339189417b2a /build_stage1_package.sh
parent01b9f1fb2e19f0d587bdbe77d9861d62de4dcd8f (diff)
downloadbootstrap32-ab6c622e801c15627beac5cdc0e0f6d9270316aa.tar.xz
added package patch support
building up to libtirpc
Diffstat (limited to 'build_stage1_package.sh')
-rwxr-xr-xbuild_stage1_package.sh29
1 files changed, 26 insertions, 3 deletions
diff --git a/build_stage1_package.sh b/build_stage1_package.sh
index d37a611..7513611 100755
--- a/build_stage1_package.sh
+++ b/build_stage1_package.sh
@@ -11,8 +11,12 @@ fi
PACKAGE=$1
+# set PATH to use the proper cross-compiler binaries
+
export PATH="$XTOOLS_ARCH/bin:${PATH}"
+# draw in default values for build variables
+
. "$SCRIPT_DIR/packages-$TARGET_CPU-stage1/template"
if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q | cut -f 1 -d ' ' | grep -c "^${PACKAGE}$") = 0; then
@@ -20,9 +24,14 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
cd $STAGE1_BUILD || exit 1
+ # clean up old build
+
sudo rm -rf "$PACKAGE"
rm -f $STAGE1_PACKAGES/$PACKAGE-*pkg.tar.xz
+ # check out the package build information from the upstream git rep
+ # using asp (or from the AUR using yaourt)
+
PACKAGE_CONF="$SCRIPT_DIR/packages-$TARGET_CPU-stage1/$PACKAGE"
if test $(grep -c NEEDS_YAOURT $PACKAGE_CONF) = 1; then
NEEDS_YAOURT=$(grep NEEDS_YAOURT $PACKAGE_CONF | cut -f 2 -d =)
@@ -38,8 +47,8 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
# attach our destination platform to be a supported architecture
sed -i "/^arch=[^#]*any/!{/^arch=(/s/(/($TARGET_CPU /}" PKGBUILD
- # if exists packages32 diff-PKGBUILD, attach at the end
- # (we assume, we build only 'core' packages)
+ # if there is a packages32 diff-PKGBUILD, attach it at the end
+ # (we assume, we build only 'core' packages during stage1)
DIFF_PKGBUILD="$ARCHLINUX32_PACKAGES/core/$PACKAGE/PKGBUILD"
if test -f "$DIFF_PKGBUILD"; then
cat "$DIFF_PKGBUILD" >> PKGBUILD
@@ -51,7 +60,12 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
if test -f "$PACKAGE_CONF"; then
. "$PACKAGE_CONF"
fi
+
+ # copy bigger patches into the build area
+ cp $SCRIPT_DIR/patches-$TARGET_CPU-stage1/$PACKAGE-*.patch .
+ # disable or enable parallel builds
+
if test "$NOPARALLEL_BUILD" = 0; then
CPUS=$(nproc)
else
@@ -59,6 +73,8 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
fi
sed -i "s@^.*MAKEFLAGS=.*@MAKEFLAGS=\"-j$CPUS\"@" $STAGE1_BUILD/makepkg-$TARGET_CPU.conf
+ # building the actual package
+
$STAGE1_BUILD/makepkg-$TARGET_CPU -C --config $STAGE1_BUILD/makepkg-$TARGET_CPU.conf \
--skipchecksums --skippgpcheck --nocheck > "$PACKAGE.log" 2>&1
RES=$?
@@ -66,20 +82,27 @@ if test $(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -
tail "$PACKAGE.log"
if test $RES = 0; then
+
+ # copy to our package folder in the first stage chroot
+
rm -f ./*debug*.pkg.tar.xz
cp -v ./*.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
- # redo the whole cache
+ # redo the whole pacman cache and repo (always running into trouble
+ # there, packages seem to reappear in old versions)
+
rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
# install into chroot via pacman
+
sudo pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Syy "$PACKAGE"
pacman --noconfirm --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT" -Q
# optionally install into cross-compiler sysroot with bsdtar
+
if test "$SYSROOT_INSTALL" = 1; then
cd "$XTOOLS_ARCH/$TARGET_CPU-unknown-linux-gnu/sysroot" || exit 1
sudo bsdtar xvf $STAGE1_CHROOT/packages/$TARGET_CPU/$PACKAGE-*.pkg.tar.xz