diff options
author | davidovski <david@davidovski.xyz> | 2022-05-17 19:00:08 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-05-17 19:00:08 +0100 |
commit | f48819041cb2fcb71a0778fab7b79d95c6971662 (patch) | |
tree | 551d62daf6ab1b36d15b3926ba46eeda67b2eb28 /xi_buildscript.sh | |
parent | 1e95eb0590151b3041e9ce5ad7d4cb3dd3b322fa (diff) |
moved xi_profile to separate
Diffstat (limited to 'xi_buildscript.sh')
-rw-r--r-- | xi_buildscript.sh | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/xi_buildscript.sh b/xi_buildscript.sh new file mode 100644 index 0000000..0fbcc92 --- /dev/null +++ b/xi_buildscript.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +. ./xi_profile.sh + +apply_patches () { + for p in *.patch; do + echo "Applying $p" + patch -Np1 -i $p + done +} + +add_from_main () { + for pattern in $@; do + printf "moving $pattern..." + for file in $(find ./xipkg/ -path "./xipkg/*/$pattern" ); do + printf "$file " + filename=${file#./xipkg/$PKG_NAME} + mkdir -p $PKG_DEST/${pattern%/*} + mv $file $PKG_DEST/${filename} + done + printf "\n" + done +} + +PKG_NAME=$1 +cd $2 + +stages="prepare build check package" +case "$@" in + *"-n"*) + stages="prepare build package" +esac + +export BUILD_ROOT=$(realpath $2) + +echo "Build file for $1, to build at root $2" + +builds="$(ls *.xibuild | grep -v "$PKG_NAME.xibuild")" + +for xibuild in $PKG_NAME.xibuild $(ls *.xibuild | grep -v "^$PKG_NAME.xibuild$"); do + cd $2 + SUBPKG_NAME=$(basename $xibuild .xibuild) + mkdir -p ./xipkg/$SUBPKG_NAME + export PKG_DEST=$(realpath ./xipkg/$SUBPKG_NAME) + echo "to install to $PKG_DEST" + + echo "============$SUBPKG_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 $stages; 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 ./$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 |