diff --git a/tools/README.bldr b/tools/README.bldr new file mode 100644 index 0000000..e171370 --- /dev/null +++ b/tools/README.bldr @@ -0,0 +1,89 @@ ++------+ +| bldr | ++------+ + +bldr is a program that builds binary packages from an Everest package. It is intened for system image development. + +bldr is compatible with Everest packages. That being said, it's only recommended to build packages designated as bldr compatible. + ++--------------+ +| Installation | ++--------------+ + +Copy bldr to a convenient location: + + (user)$ cp bldr PROJECT_DIR + +Then, copy bldr.conf to either of the following locations: + + /etc/bldr.conf + $HOME/.config/bldr.conf + PROJECT_DIR/bldr.conf + ++-------+ +| Usage | ++-------+ + + bldr [-h] [-v] [-b] PACKAGE + ++-------------------+ +| Building packages | ++-------------------+ + + (user)$ ./bldr -b /path/to/package + +It is important to provide the full path. + +bldr will compile the package, and install it to $BLDR_OUT_DIR/pkgs/PACKAGE_NAME. + +$BLDR_OUT_DIR can be defined in bldr.conf. + +After a package has been compiled, you can either import the package-agnostic installation script, +or write your own. + ++---------------------------+ +| Writing packages for bldr | ++---------------------------+ + +Everest packages only require slight modification in order to be compatible with bldr. + +First, ensure the getsource() function looks similar to this: + + getsource() { + command1 + command2 + cd ${SOURCES[1]} + } + +The last command in this function is very important. It MUST be "cd ${SOURCES[1]}", otherwise +bldr will throw an error when a user attempts to build. + +It is safe to assume most people using bldr will be cross compiling packages. +In this case, ensure the toolchain is being used. Toolchains will always be located +in $BLDR_OUT_DIR/toolchain. + +When configuring a package for compilation, ensure the target triplet matches the +desired system profile. In the case of "x86-musl": + + TARGET="x86_64-linux-musl" + +ALWAYS install bldr packages to $BLDR_OUT_DIR/pkgs/PACKAGE_NAME +bldr packages must not support system functions. + ++-----------+ +| Copyright | ++-----------+ + +(C) 2023 Everest Linux +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with +this program. +If not, see . diff --git a/tools/bldr b/tools/bldr index c98ff51..d7597c1 100755 --- a/tools/bldr +++ b/tools/bldr @@ -22,16 +22,27 @@ usage_small() { load_config() { if [ -f "/etc/bldr.conf" ]; then source /etc/bldr.conf - elif [ -f "${HOME}/.config/bldr.conf"]; then + 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" + printf "/etc/bldr.conf\n" + printf "${HOME}/.config/bldr.conf\n" + printf "$(pwd)/bldr.conf\n" + exit 1 + fi +} + +check_for_toolchain() { + if [ -d "${TOOLCHAIN_PATH}" ]; then + printf "Toolchain found, adding to temporary PATH...\n" + PATH=${PATH}:${TOOLCHAIN_PATH}/bin + else + printf "Toolchain not found. Use the following command to download:\n" + printf "curl -O -J https://musl.cc/$(uname -m)-linux-musl-cross.tgz\n" exit 1 fi } @@ -79,6 +90,10 @@ case $1 in ;; -b|--build) load_config "$@" + check_for_toolchain "$@" + if [ "$?" != 0 ]; then + exit 1 + fi shift check_if_input_is_blank "$@" mkdir /tmp/bldr-workspace diff --git a/tools/bldr.conf b/tools/bldr.conf index 63555c4..a2108a6 100644 --- a/tools/bldr.conf +++ b/tools/bldr.conf @@ -10,6 +10,9 @@ export CFLAGS="-O2 -fstack-protector-strong -static -pie" export CXXFLAGS="${CFLAGS}" export LDFLAGS="-static" +# Path to Everest toolchain +export TOOLCHAIN_PATH="/home/arco/Projects/x86_64-linux-musl-toolchain" + # # end bldr.conf #