diff options
author | davidovski <david@davidovski.xyz> | 2022-05-04 23:50:47 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-05-04 23:50:47 +0100 |
commit | 9f488b934f4a7635be9d012c60196dd6db68dc00 (patch) | |
tree | 36ca7e17ae101b126b6eb0882c481b63ecabd926 /xi_profile.sh | |
parent | c99ca14a05558b11bae20f2ab887e1c42aa921a7 (diff) |
allowing multiple xibuild files to be run consecutively
Diffstat (limited to 'xi_profile.sh')
-rw-r--r-- | xi_profile.sh | 94 |
1 files changed, 55 insertions, 39 deletions
diff --git a/xi_profile.sh b/xi_profile.sh index d88ed80..97047bd 100644 --- a/xi_profile.sh +++ b/xi_profile.sh @@ -1,48 +1,64 @@ #!/bin/sh -cd $1 -prepare () { - echo "passing prepare" -} +export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin:/tools/sbin +export LIBRARY_PATH=/lib:/usr/lib/:/tools/lib:/tools/lib64 -build () { - echo "passing build" -} +export JOBS=$(grep "processor" /proc/cpuinfo | wc -l) +export HOME=/root -check () { - echo "passing check" -} +export MAKEFLAGS="-j$JOBS" +export XORG_PREFIX="/usr" -package () { - echo "passing package" +export XORG_CONFIG="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static" +export BUILD_ROOT="/build/source" +export RUST_TARGET="x86_64-unknown-linux-musl" + +apply_patches () { + for p in *.patch; do + echo "Applying $p" + patch -Np1 -i $p + done } -for xibuild in *.xibuild; do - PKG_NAME=$(basename $xibuild .xibuild) - export PKG_DEST=./xipkg/$PKG_NAME - mkdir -p $PKG_DEST - - . ./$xibuild - - echo "==========================PREPARE STAGE==========================" - prepare || exit 1 - echo "==========================BUILD STAGE==========================" - build || exit 1 - echo "==========================CHECK STAGE==========================" - check || exit 1 - echo "==========================PACKAGE STAGE==========================" - package || exit 1 - - printf "checking for postinstall... " - if command -v postinstall > /dev/null; then - echo "adding postinstall" - POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall - mkdir -p $POST_DIR - cat /build/$PKG_NAME.xibuild > $POST_DIR/$PKG_NAME.sh - echo "" >> $POST_DIR/$PKG_NAME.sh - echo "postinstall" >> $POST_DIR/$PKG_NAME.sh - else - echo "no postinstall" - fi +PKG_NAME=$1 +cd $2 +export BUILD_ROOT=$(realpath $2) + +builds="$(ls *.xibuild | grep -v "$PKG_NAME.xibuild")" + +for xibuild in $PKG_NAME.xibuild $(ls *.xibuild | grep -v "$PKG_NAME.xibuild"); do + PKG_NAME=$(basename $xibuild .xibuild) + export PKG_DEST=./xipkg/$PKG_NAME + mkdir -p $PKG_DEST + + echo "============$PKG_NAME=============" + + # read only the static variables fromt the primary + . ./$PKG_NAME.xibuild + unset -f prepare + unset -f build + unset -f check + unset -f package + + . ./$xibuild + + + for t in prepare build check package; do + type $t >/dev/null && { + echo "==========================$t stage==========================" + $t || exit 1 + } + done + printf "checking for postinstall... " + if command -v postinstall > /dev/null; then + echo "adding postinstall" + POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall + mkdir -p $POST_DIR + cat /build/$PKG_NAME.xibuild > $POST_DIR/$PKG_NAME.sh + echo "" >> $POST_DIR/$PKG_NAME.sh + echo "postinstall" >> $POST_DIR/$PKG_NAME.sh + else + echo "no postinstall" + fi done |