General: Cleanup build scripts
This commit is contained in:
parent
fb35f06cf5
commit
e59772a58d
|
@ -13,7 +13,7 @@ source "$BANAN_ROOT_DIR/script/config.sh"
|
||||||
|
|
||||||
export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH"
|
export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH"
|
||||||
|
|
||||||
export PKG_CONFIG='pkg-config --static'
|
export PKG_CONFIG_DIR=''
|
||||||
export PKG_CONFIG_SYSROOT_DIR="$BANAN_SYSROOT"
|
export PKG_CONFIG_SYSROOT_DIR="$BANAN_SYSROOT"
|
||||||
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/usr/lib/pkgconfig"
|
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/usr/lib/pkgconfig"
|
||||||
export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig"
|
export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig"
|
||||||
|
@ -21,6 +21,13 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig"
|
||||||
export CC="$BANAN_TOOLCHAIN_TRIPLE-gcc"
|
export CC="$BANAN_TOOLCHAIN_TRIPLE-gcc"
|
||||||
export CXX="$BANAN_TOOLCHAIN_TRIPLE-g++"
|
export CXX="$BANAN_TOOLCHAIN_TRIPLE-g++"
|
||||||
export LD="$BANAN_TOOLCHAIN_TRIPLE-ld"
|
export LD="$BANAN_TOOLCHAIN_TRIPLE-ld"
|
||||||
|
export AR="$BANAN_TOOLCHAIN_TRIPLE-ar"
|
||||||
|
export RANLIB="$BANAN_TOOLCHAIN_TRIPLE-ranlib"
|
||||||
|
export READELF="$BANAN_TOOLCHAIN_TRIPLE-readelf"
|
||||||
|
export OBJCOPY="$BANAN_TOOLCHAIN_TRIPLE-objcopy"
|
||||||
|
export OBJDUMP="$BANAN_TOOLCHAIN_TRIPLE-objdump"
|
||||||
|
export STRIP="$BANAN_TOOLCHAIN_TRIPLE-strip"
|
||||||
|
export CXXFILT="$BANAN_TOOLCHAIN_TRIPLE-c++filt"
|
||||||
|
|
||||||
if [ ! -f "$BANAN_SYSROOT/usr/lib/libc.a" ]; then
|
if [ ! -f "$BANAN_SYSROOT/usr/lib/libc.a" ]; then
|
||||||
pushd "$BANAN_ROOT_DIR" >/dev/null
|
pushd "$BANAN_ROOT_DIR" >/dev/null
|
||||||
|
@ -102,28 +109,29 @@ if [ "$VERSION" = "git" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
regex=".*/(.*\.tar\..*)#(.*)"
|
regex='.*/(.*)#(.*)'
|
||||||
if [[ $DOWNLOAD_URL =~ $regex ]]; then
|
if [[ $DOWNLOAD_URL =~ $regex ]]; then
|
||||||
TAR_NAME="${BASH_REMATCH[1]}"
|
FILE_NAME="${BASH_REMATCH[1]}"
|
||||||
TAR_HASH="${BASH_REMATCH[2]}"
|
FILE_HASH="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
if [ -f "$TAR_NAME" ]; then
|
if [ -f "$FILE_NAME" ]; then
|
||||||
if ! echo "$TAR_HASH $TAR_NAME" | sha256sum --check >/dev/null; then
|
if ! echo "$FILE_HASH $FILE_NAME" | sha256sum --check >/dev/null; then
|
||||||
clean
|
clean
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$TAR_NAME" ]; then
|
if [ ! -f "$FILE_NAME" ]; then
|
||||||
wget "$DOWNLOAD_URL" || exit 1
|
wget "$DOWNLOAD_URL" || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! echo "$TAR_HASH $TAR_NAME" | sha256sum --check >/dev/null; then
|
if ! echo "$FILE_HASH $FILE_NAME" | sha256sum --check >/dev/null; then
|
||||||
echo "Tar hash does not match" >&2
|
echo "File hash does not match" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$build_dir" ]; then
|
regex='(.*\.tar\..*)'
|
||||||
tar xf "$TAR_NAME" || exit 1
|
if [[ $FILE_NAME =~ $regex ]] && [ ! -d "$build_dir" ]; then
|
||||||
|
tar xf "$FILE_NAME" || exit 1
|
||||||
|
|
||||||
: "${TAR_CONTENT:=$NAME-$VERSION}"
|
: "${TAR_CONTENT:=$NAME-$VERSION}"
|
||||||
mv "$TAR_CONTENT" "$build_dir" || exit 1
|
mv "$TAR_CONTENT" "$build_dir" || exit 1
|
||||||
|
@ -133,6 +141,10 @@ else
|
||||||
patch -ruN -p1 -d "$build_dir" < "$patch" || exit 1
|
patch -ruN -p1 -d "$build_dir" < "$patch" || exit 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [ ! -d "$build_dir" ]; then
|
||||||
|
mkdir -p "$build_dir" || exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Invalid format in DOWNLOAD_URL" >&2
|
echo "Invalid format in DOWNLOAD_URL" >&2
|
||||||
|
|
|
@ -63,4 +63,4 @@ sudo mkfs.ext2 -q $PARTITION2
|
||||||
sudo losetup -d $LOOP_DEV
|
sudo losetup -d $LOOP_DEV
|
||||||
|
|
||||||
# install bootloader
|
# install bootloader
|
||||||
$BANAN_SCRIPT_DIR/install-bootloader.sh
|
$BANAN_SCRIPT_DIR/install-bootloader.sh || exit 1
|
||||||
|
|
|
@ -16,7 +16,7 @@ if [ -z $BANAN_BUILD_DIR ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "full" ] || [ ! -f $BANAN_DISK_IMAGE_PATH ]; then
|
if [ "$1" == "full" ] || [ ! -f $BANAN_DISK_IMAGE_PATH ]; then
|
||||||
$BANAN_SCRIPT_DIR/image-create.sh
|
$BANAN_SCRIPT_DIR/image-create.sh || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
|
@ -62,9 +62,8 @@ install_grub_uefi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_banan_legacy() {
|
install_banan_legacy() {
|
||||||
ROOT_PARTITION_INDEX=2
|
ROOT_DISK_INFO=$(fdisk -x "$BANAN_DISK_IMAGE_PATH" | tr -s ' ')
|
||||||
ROOT_PARTITION_INFO=$(fdisk -x $BANAN_DISK_IMAGE_PATH | grep "^$BANAN_DISK_IMAGE_PATH" | head -$ROOT_PARTITION_INDEX | tail -1)
|
ROOT_PART_GUID=$(echo "$ROOT_DISK_INFO" | grep "^$BANAN_DISK_IMAGE_PATH" | head -2 | tail -1 | cut -d' ' -f6)
|
||||||
ROOT_PARTITION_GUID=$(echo $ROOT_PARTITION_INFO | cut -d' ' -f6)
|
|
||||||
|
|
||||||
INSTALLER_BUILD_DIR=$BANAN_ROOT_DIR/bootloader/installer/build/$BANAN_ARCH
|
INSTALLER_BUILD_DIR=$BANAN_ROOT_DIR/bootloader/installer/build/$BANAN_ARCH
|
||||||
BOOTLOADER_ELF=$BANAN_BUILD_DIR/bootloader/bios/bootloader
|
BOOTLOADER_ELF=$BANAN_BUILD_DIR/bootloader/bios/bootloader
|
||||||
|
@ -84,7 +83,7 @@ install_banan_legacy() {
|
||||||
ninja
|
ninja
|
||||||
|
|
||||||
echo installing bootloader
|
echo installing bootloader
|
||||||
$INSTALLER_BUILD_DIR/banan_os-bootloader-installer $BOOTLOADER_ELF $BANAN_DISK_IMAGE_PATH $ROOT_PARTITION_GUID
|
$INSTALLER_BUILD_DIR/banan_os-bootloader-installer "$BOOTLOADER_ELF" "$BANAN_DISK_IMAGE_PATH" "$ROOT_PART_GUID"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_banan_uefi() {
|
install_banan_uefi() {
|
||||||
|
|
Loading…
Reference in New Issue