diff --git a/build.sh b/build.sh index 989753a..675a9c8 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,124 @@ #!/bin/bash -# ^ bash is required for the "if" syntax used here. +# This file should be identical in all projects. See documentation +# under "usage" below. + +usage(){ + cat < options must be used. - _O_FILES="$_O_FILES $OBJDIR/$fn.o" + _O_FILES="$_O_FILES $THIS_OBJ_PATH" done +# only for pc file if exists for irrlicht: +#if [ -z "$PKG_CONFIG_PATH" ]; then +# PKG_CONFIG_PATH=$IRR_PATH +#else +# PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$IRR_PATH +#fi +#gcc -o build/$BIN_NAME $_I_FILES $(pkg-config --libs --cflags irrlicht --cflags freetype2) +#^ can't find a pc file +# gcc -o build/$BIN_NAME $_I_FILES -I$FT2_INCDIR + if [ -f "$$OUT_BIN" ]; then mv "$OUT_BIN" "$OUT_BIN.BAK" @@ -106,7 +238,32 @@ else echo "Building $OUT_BIN is complete." fi -INSTALLED_BIN="$HOME/.local/bin/b3view" +if [ ! -z "$DIST_FILES" ]; then + echo "* copying dist files..." + for fn in $DIST_FILES + do + printf " * $fn..." + if [ -d "$fn" ]; then + cp -R "$fn" $BUILD_DIR/ + if [ $? -ne 0 ]; then + echo "Error: 'cp -R \"$fn\" $BUILD_DIR/' failed in \"`pwd`\"." + exit 1 + else + echo "OK" + fi + else + cp -f "$fn" $BUILD_DIR/ + if [ $? -ne 0 ]; then + echo "Error: 'cp -f \"$fn\" $BUILD_DIR/' failed in \"`pwd`\"." + exit 1 + else + echo "OK" + fi + fi + done +fi + +INSTALLED_BIN="$HOME/.local/bin/$BIN_NAME" if [ "@$RUN_DEBUG" = "@true" ]; then if [ "@$DEBUG" = "@true" ]; then @@ -149,3 +306,4 @@ if [ "@$DEBUG" != "@true" ]; then fi fi echo "Done" + diff --git a/debug-and-show-tb.sh b/debug-and-show-tb.sh index 921ed1f..17d394c 100755 --- a/debug-and-show-tb.sh +++ b/debug-and-show-tb.sh @@ -1,8 +1,19 @@ #!/bin/bash # ^ bash for if syntax and to avoid "Bad fd number" on using $? + +# This file should be identical in each project as it uses build-settings.rc. See build.sh for documentation and license. + # echo "run" > gdb.batch.txt # echo "bt" >> gdb.batch.txt -MY_EXE=build/b3view +if [ ! -f "build-settings.rc" ]; then + echo "This file requires build-settings.rc. For documentation see build.sh." + exit 1 +fi +. build-settings.rc +if [ -z "$BIN_NAME" ]; then + echo "BIN_NAME is required from build-settings.rc or the environment. For documentation see build.sh." +fi +MY_EXE=build/$BIN_NAME # gdb "$MY_EXE" --command=gdb.batch.txt --batch echo ERR_TXT=err.txt