This commit is contained in:
Timerix 2024-08-09 05:59:19 +03:00
parent 144b333b60
commit 3b7f72c8b3
8 changed files with 56 additions and 16 deletions

View File

@ -1 +1 @@
2.1.2 2.1.3

View File

@ -1,3 +1,7 @@
# v2.1.3
+ added `DEP_OTHER_OUT_FILES` to dependency configs
+ if `PRESERVE_OUT_DIRECTORY_STRUCTURE=true` then `DEP_DYNAMIC_OUT_FILES` and `DEP_OTHER_OUT_FILES` are copied to `OUTDIR` preserving directory structure (example_dir/lib1.so -> $OUTDIR/example_dir/lib1.so)
# v2.1.2 # v2.1.2
+ changed compile_c and compile_cpp functions + changed compile_c and compile_cpp functions
+ bootstrap now can print help and list of installed versions + bootstrap now can print help and list of installed versions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
INSTALLED_CBUILD_VERSION=2.1.2 INSTALLED_CBUILD_VERSION=2.1.3
# set \t size to 4 spaces # set \t size to 4 spaces
tabs 4 tabs 4

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CBUILD_VERSION=2.1.2 CBUILD_VERSION=2.1.3
CONFIG_VERSION=1 CONFIG_VERSION=1
PROJECT="%PROJECT_NAME%" PROJECT="%PROJECT_NAME%"

View File

@ -6,5 +6,8 @@ DEP_POST_BUILD_COMMAND=''
DEP_CLEAN_COMMAND='make clean' DEP_CLEAN_COMMAND='make clean'
# won't be copied to project $OUTDIR # won't be copied to project $OUTDIR
DEP_STATIC_OUT_FILES='libexample1.a libexample1_addon.a' DEP_STATIC_OUT_FILES='libexample1.a libexample1_addon.a'
# will be copied tp project $OUTDIR PRESERVE_OUT_DIRECTORY_STRUCTURE=false;
# will be copied to project $OUTDIR
DEP_DYNAMIC_OUT_FILES='libexample1.config.json' DEP_DYNAMIC_OUT_FILES='libexample1.config.json'
# will be copied to project $OUTDIR
DEP_OTHER_OUT_FILES=''

View File

@ -4,14 +4,17 @@ DEP_PRE_BUILD_COMMAND=''
DEP_POST_BUILD_COMMAND='' DEP_POST_BUILD_COMMAND=''
DEP_CLEAN_COMMAND='make clean' DEP_CLEAN_COMMAND='make clean'
DEP_STATIC_OUT_FILES='' DEP_STATIC_OUT_FILES=''
DEP_OTHER_OUT_FILES=''
case $OS in case $OS in
WINDOWS) WINDOWS)
DEP_BUILD_COMMAND='make libexample2.dll' DEP_BUILD_COMMAND='make libexample2.dll && mkdir -p win-x64 && mv libexample.dll win-x64'
DEP_DYNAMIC_OUT_FILES='libexample2.dll' DEP_DYNAMIC_OUT_FILES='win-x64/libexample2.dll'
PRESERVE_OUT_DIRECTORY_STRUCTURE=true # library will be copied to $OUTDIR/win-x64
;; ;;
LINUX) LINUX)
DEP_BUILD_COMMAND='make libexample2.so' DEP_BUILD_COMMAND='make libexample2.so && mkdir -p linux-x64 && mv libexample.so linux-x64'
DEP_DYNAMIC_OUT_FILES='libexample2.so' DEP_DYNAMIC_OUT_FILES='linux-x64/libexample2.so'
PRESERVE_OUT_DIRECTORY_STRUCTURE=true # library will be copied to $OUTDIR/linux-x64
;; ;;
*) *)
error "operating system $OS has no configuration variants" error "operating system $OS has no configuration variants"

View File

@ -64,7 +64,7 @@ function build_dependency {
local build_needed="$force_build" local build_needed="$force_build"
if [ "$build_needed" != true ]; then if [ "$build_needed" != true ]; then
for file in $DEP_STATIC_OUT_FILES $DEP_DYNAMIC_OUT_FILES; do for file in $DEP_STATIC_OUT_FILES $DEP_DYNAMIC_OUT_FILES $DEP_OTHER_OUT_FILES; do
if [ ! -f "$file" ]; then if [ ! -f "$file" ]; then
myprint "${GRAY}missing file '$file'" myprint "${GRAY}missing file '$file'"
local build_needed=true local build_needed=true
@ -82,17 +82,36 @@ function build_dependency {
fi fi
if [ ! -z "$DEP_DYNAMIC_OUT_FILES" ]; then if [ ! -z "$DEP_DYNAMIC_OUT_FILES" ]; then
# copy each file to $OUTDIR # copies each file to $OUTDIR and creates symbolic link in $OBJDIR/dynamic_libs
cp -rv $DEP_DYNAMIC_OUT_FILES "$proj_root_dir/$OUTDIR"
# symlink each file to $OBJDIR/dynamic_libs
for file in $DEP_DYNAMIC_OUT_FILES; do for file in $DEP_DYNAMIC_OUT_FILES; do
# doesnt return error if called not like this # doesnt return error if called not like this
f=$(realpath $file) real_file=$(realpath $file)
ln -sfv $f "$proj_root_dir/$OBJDIR/dynamic_libs" file_dir=$(dirname $file)
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ] && [ "$file_dir" != '.' ]; then
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
mkdir -p "$proj_root_dir/$OBJDIR/dynamic_libs/$file_dir"
cp -v "$file" "$proj_root_dir/$OUTDIR/$file"
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/$file"
else
cp -v "$file" "$proj_root_dir/$OUTDIR/"
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/"
fi
done
fi
if [ ! -z "$DEP_OTHER_OUT_FILES" ]; then
# copies each file to $OUTDIR
for file in $DEP_OTHER_OUT_FILES; do
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ]; then
file_dir=$(dirname $file)
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
cp -v "$file" "$proj_root_dir/$OUTDIR/$file"
else
cp -v "$file" "$proj_root_dir/$OUTDIR/"
fi
done done
fi fi
if [ ! -z "$DEP_STATIC_OUT_FILES" ]; then if [ ! -z "$DEP_STATIC_OUT_FILES" ]; then
# symlink each file to $OBJDIR/static_libs # creates symbolic link to each file in $OBJDIR/static_libs
for file in $DEP_STATIC_OUT_FILES; do for file in $DEP_STATIC_OUT_FILES; do
# doesnt return error if called not like this # doesnt return error if called not like this
f=$(realpath $file) f=$(realpath $file)
@ -101,6 +120,17 @@ function build_dependency {
fi fi
cd "$proj_root_dir" cd "$proj_root_dir"
# unsed all dependency config variables to not mess with next dependencies
unset DEP_WORKING_DIR
unset DEP_PRE_BUILD_COMMAND
unset DEP_BUILD_COMMAND
unset DEP_POST_BUILD_COMMAND
unset DEP_CLEAN_COMMAND
unset DEP_STATIC_OUT_FILES
unset PRESERVE_OUT_DIRECTORY_STRUCTURE
unset DEP_DYNAMIC_OUT_FILES
unset DEP_OTHER_OUT_FILES
} }
function build_dependencies { function build_dependencies {

View File

@ -4,7 +4,7 @@
# exit on errors # exit on errors
set -xeo pipefail set -xeo pipefail
CBUILD_VERSION=2.1.2 CBUILD_VERSION=$(<CBUILD_VERSION)
function version_parse { function version_parse {
local value="$1" local value="$1"