update bldr

This commit is contained in:
Liam Waldron 2023-04-28 10:39:14 -04:00
parent 86d6736495
commit 5f22f33d9c
2 changed files with 52 additions and 1 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env /bin/sh #!/bin/sh
# bldr - build a binary package from an Everest package file # bldr - build a binary package from an Everest package file
pkgs=("${@}") pkgs=("${@}")
@ -19,6 +19,23 @@ usage_small() {
printf "usage: ${0} [-h] [-v] [-b] PACKAGE\n" printf "usage: ${0} [-h] [-v] [-b] PACKAGE\n"
} }
load_config() {
if [ -f "/etc/bldr.conf" ]; then
source /etc/bldr.conf
elif [ -f "${HOME}/.config/bldr.conf"]; then
source ${HOME}/.config/bldr.conf
elif [ -f "$(pwd)/bldr.conf" ]; then
source $(pwd)/bldr.conf
else
printf "No valid bldr.conf found\n"
printf "Valid files are:\n"
printf "/etc/bldr.conf"
printf "${HOME}/.config/bldr.conf"
printf "$(pwd)/bldr.conf"
exit 1
fi
}
check_if_input_is_blank() { check_if_input_is_blank() {
if [[ "${@}" == "" ]]; then if [[ "${@}" == "" ]]; then
printf "No package(s) specified.\n" printf "No package(s) specified.\n"
@ -43,6 +60,13 @@ mkpkg() {
done done
} }
clean_after_failed() {
printf "${0} failed to build packages.\n"
printf "exiting...\n"
cd .. && rm -rf /tmp/bldr-workspace
exit 1
}
case $1 in case $1 in
-h|--help) -h|--help)
usage "$@" usage "$@"
@ -54,10 +78,22 @@ case $1 in
exit 0 exit 0
;; ;;
-b|--build) -b|--build)
load_config "$@"
shift shift
check_if_input_is_blank "$@" check_if_input_is_blank "$@"
mkdir /tmp/bldr-workspace
cd /tmp/bldr-workspace
get_pkg_sources "$@" get_pkg_sources "$@"
pwd
if [ "$?" != 0 ]; then
clean_after_failed "$@"
exit 1
fi
mkpkg "$@" mkpkg "$@"
if [ "$?" != 0 ]; then
clean_after_failed "$@"
exit 1
fi
;; ;;
*) *)
usage_small "$@" usage_small "$@"

15
tools/bldr.conf Normal file
View File

@ -0,0 +1,15 @@
#
# bldr.conf - settings for bldr
#
# Which directory bldr will output packages to
export BLDR_OUT_DIR="/home/arco/Projects/bldr-pkgs"
# Compilation flags
export CFLAGS="-O2 -fstack-protector-strong -static -pie"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="-static"
#
# end bldr.conf
#