build_compiler gcc
build_linker ar
build_libraries -lc
+build_libraries_fll
build_sources_library console.c conversion.c file.c memory.c pipe.c print.c utf.c
build_sources_program
build_sources_headers colors.h console.h conversion.h errors.h file.h fss.h memory.h fll_paths.h filesystem_paths.h pipe.h print.h serialized.h strings.h types.h types_array.h utf.h
build_shared yes
build_static yes
+defines_all
+defines_static
+defines_shared
+
flags_all -z now
flags_shared
flags_static
build_compiler gcc
build_linker ar
-build_libraries -lc -lfll_0
-build_sources_library colors.c console.c directory.c errors.c file.c fss.c fss_basic.c fss_basic_list.c fss_extended.c program.c serialized.c strings.c
+build_libraries -lc
+build_libraries_fll -lfll_0
+build_sources_library level_1/colors.c level_1/console.c level_1/directory.c level_1/errors.c level_1/file.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/program.c level_1/serialized.c level_1/strings.c level_2/colors.c level_2/execute.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_errors.c
build_sources_program
-build_sources_headers colors.h console.h directory.h errors.h file.h fss.h fss_basic.h fss_basic_list.h fss_errors.h fss_extended.h fss_macro.h program.h serialized.h strings.h
+build_sources_headers level_1/colors.h level_1/console.h level_1/directory.h level_1/errors.h level_1/file.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_errors.h level_1/fss_extended.h level_1/fss_macro.h level_1/program.h level_1/serialized.h level_1/strings.h level_2/colors.h level_2/execute.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_errors.h
build_shared yes
build_static yes
+defines_all
+defines_static
+defines_shared
+
flags_all -z now
flags_shared
flags_static
build_compiler gcc
build_linker ar
-build_libraries -lc -lfll_0 -lfll_1
-build_sources_library colors.c execute.c fss_basic.c fss_basic_list.c fss_extended.c fss_errors.c
+build_libraries -lc
+build_libraries_fll -lfll_0 -lfll_1
+build_sources_library level_2/colors.c level_2/execute.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_errors.c
build_sources_program
-build_sources_headers colors.h execute.h fss_basic.h fss_basic_list.h fss_extended.h fss_errors.h
+build_sources_headers level_2/colors.h level_2/execute.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_errors.h
build_shared yes
build_static yes
+defines_all
+defines_static
+defines_shared
+
flags_all -z now
flags_shared
flags_static
--- /dev/null
+# fss-0000
+
+project_name fll
+project_level
+
+version_major 0
+version_minor 5
+version_micro 0
+
+build_compiler gcc
+build_linker ar
+build_libraries -lc
+build_libraries_fll
+build_sources_library level_0/console.c level_0/conversion.c level_0/file.c level_0/memory.c level_0/pipe.c level_0/print.c level_0/utf.c level_1/colors.c level_1/console.c level_1/directory.c level_1/errors.c level_1/file.c level_1/fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/program.c level_1/serialized.c level_1/strings.c
+build_sources_program
+build_sources_headers level_0/colors.h level_0/console.h level_0/conversion.h level_0/errors.h level_0/file.h level_0/fss.h level_0/memory.h level_0/fll_paths.h level_0/filesystem_paths.h level_0/pipe.h level_0/print.h level_0/serialized.h level_0/strings.h level_0/types.h level_0/types_array.h level_0/utf.h level_1/colors.h level_1/console.h level_1/directory.h level_1/errors.h level_1/file.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_errors.h level_1/fss_extended.h level_1/fss_macro.h level_1/program.h level_1/serialized.h level_1/strings.h
+build_sources_bash
+build_sources_settings
+build_shared yes
+build_static yes
+
+defines_all
+defines_static
+defines_shared
+
+flags_all -z now
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE
# programmer: Kevin Day
#
# The purpose of this script is to provide a simple bootstrap tool to compile any part of the FLL project.
-# The dependencies of this script are: bash, grep, and sed.
+# The dependencies of this script are: bash, dirname, grep, and sed.
generate_main(){
local public_name="Simple FLL Project Make Script"
local flags_program=${variables[$(generate_id flags_program)]}
local i=
local alt=$1
+ local directory=
if [[ $work_directory != "" ]] ; then
flags_all="-I${work_directory}includes/ $flags_all"
static="no"
fi
- if [[ $shared != "yes" && $static != "yes" ]] ;then
+ if [[ $shared != "yes" && $static != "yes" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.$c_reset"
generate_cleanup
exit -1
fi
+ for i in $sources_library ; do
+ if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ echo -e "${c_error}ERROR: Cannot Build, invalid source_library path provided: '$i'.$c_reset"
+ generate_cleanup
+ exit -1
+ fi
+ done
+
+ for i in $sources_program ; do
+ if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ echo -e "${c_error}ERROR: Cannot Build, invalid sources_program path provided: '$i'.$c_reset"
+ generate_cleanup
+ exit -1
+ fi
+ done
+
+ for i in $sources_headers ; do
+ if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ echo -e "${c_error}ERROR: Cannot Build, invalid sources_headers path provided: '$i'.$c_reset"
+ generate_cleanup
+ exit -1
+ fi
+ done
+
+ for i in $sources_bash ; do
+ if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ echo -e "${c_error}ERROR: Cannot Build, invalid sources_bash path provided: '$i'.$c_reset"
+ generate_cleanup
+ exit -1
+ fi
+ done
+
+ for i in $sources_settings ; do
+ if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ echo -e "${c_error}ERROR: Cannot Build, invalid sources_settings path provided: '$i'.$c_reset"
+ generate_cleanup
+ exit -1
+ fi
+ done
+
if [[ $sources_settings != "" ]] ; then
for i in $sources_settings ; do
- cp -vR $path_settings$i ${path_build}settings/ || failure=1
+ directory=$(dirname $i)
+
+ if [[ $directory == "." ]] ; then
+ cp -vR $path_settings$i ${path_build}settings/ || failure=1
+ else
+ mkdir -vp ${path_build}settings/$directory || failure=1
+
+ if [[ $failure == "" ]] ; then
+ cp -vR $path_settings$i ${path_build}settings/${directory}/ || failure=1
+ fi
+ fi
done
fi
if [[ $failure == "" && $sources_headers != "" ]] ; then
- for i in $sources_headers ; do
- cp -vf $path_c$i ${path_build}includes/level_$level/ || failure=1
- done
+ if [[ $level == "" ]] ; then
+ for i in $sources_headers ; do
+ directory=$(dirname $i)
+
+ if [[ $directory == "." ]] ; then
+ cp -vf $path_c$i ${path_build}includes/ || failure=1
+ else
+ mkdir -vp ${path_build}includes/$directory || failure=1
+
+ if [[ $failure == "" ]] ; then
+ cp -vf $path_c$i ${path_build}includes/$i || failure=1
+ fi
+ fi
+ done
+ else
+ for i in $sources_headers ; do
+ cp -vf $path_c$i ${path_build}includes/level_$level/ || failure=1
+ done
+ fi
fi
if [[ $failure == "" && $shared == "yes" ]] ; then
sources=
if [[ $sources_library != "" ]] ; then
for i in $sources_library ; do
+ directory=$(dirname $i)
+
+ if [[ $directory != "." && ! -d ${path_build}objects/$directory ]] ; then
+ mkdir -vp ${path_build}objects/$directory
+
+ if [[ $? -ne 0 ]] ; then
+ failure=1
+ break;
+ fi
+ fi
+
sources="$sources${path_build}objects/$i.o "
echo $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_library
if [[ $failure == "" && $sources_bash != "" ]] ; then
for i in $sources_bash ; do
- cp -vf $path_bash$i ${path_build}bash/ || failure=1
+ directory=$(dirname $i)
+
+ if [[ $directory == "." ]] ; then
+ cp -vf $path_bash$i ${path_build}bash/ || failure=1
+ else
+ mkdir -vp ${path_build}bash/$directory || failure=1
+
+ if [[ $failure == "" ]] ; then
+ cp -vf $path_bash$i ${path_build}bash/${directory}/ || failure=1
+ fi
+ fi
done
fi
#
# The purpose of this script is to create release directories from the project source.
# These release directories can then be used to compile the project or to package the project.
-# The dependencies of this script are: bash, chmod, grep, and sed.
+# The dependencies of this script are: basename, bash, chmod, grep, and sed.
package_main(){
local public_name="Simple FLL Project Package Script"
fi
fi
- if [[ -d ${package}data/build ]] ; then
- cp -vR $path_build$level ${package}data
+ if [[ -d $path_build${level}/build ]] ; then
+ cp -vR $path_build${level}/build ${package}data/
else
cp -vR $path_build$level ${package}data/build
fi
fi
done
- if [[ $falure != "" ]] ; then
+ if [[ $failure != "" ]] ; then
break;
fi
done
package_operation_monolithic(){
local failure=
local name=
+ local level=
local directory=
+ local subdirectory=
+ local pathname=
+
+ name="fll"
+ package="${path_destination}monolithic/${name}-${version}/"
+
+ echo
+ echo -e "${c_highlight}Processing Package$c_reset (monolithic) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
+
+ if [[ ! -d ${path_build}monolithic ]] ; then
+ echo -e "${c_error}ERROR: build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset"
+ package_cleanup
+ exit 1
+ fi
+
+ package_create_base_files
+
+ if [[ ! -d ${package}data/ ]] ; then
+ mkdir -v ${package}data/
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset"
+ package_cleanup
+ exit 1
+ fi
+ fi
+
+ if [[ -d ${path_build}monolithic/build ]] ; then
+ cp -vR ${path_build}monolithic/build ${package}data
+ else
+ cp -vR ${path_build}monolithic ${package}data/build
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset"
+ package_cleanup
+ exit 1
+ fi
+
+ if [[ ! -d ${package}sources/ ]] ; then
+ mkdir -v ${package}sources/
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset"
+ package_cleanup
+ exit 1
+ fi
+ fi
+
+ for level in level_0 level_1 level_2 ; do
+ for directory in $path_sources${level}/* ; do
+ for subdirectory in $directory/* ; do
+ pathname="$(basename $subdirectory)"
+
+ if [[ $pathname == "data" ]] ; then
+ if [[ ! -d ${package}data/$level ]] ; then
+ mkdir -vp ${package}data/$level
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset"
+ failure=1
+ break
+ fi
+ fi
+
+ cp -vR $subdirectory ${package}sources/data
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/data$level$c_error.$c_reset"
+ failure=1
+ break
+ fi
+
+ rm -vRf ${package}sources/data/build/
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset"
+ failure=1
+ break
+ fi
+
+ if [[ "$(ls ${package}sources/data)" != "" ]] ; then
+ cp -vR ${package}sources/data/* ${package}data/$level
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset"
+ failure=1
+ break
+ fi
+ fi
+
+ rm -vRf ${package}sources/data
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset"
+ failure=1
+ break
+ fi
+ else
+ if [[ ! -d ${package}sources/$pathname/$level ]] ; then
+ mkdir -vp ${package}sources/$pathname/$level
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to create package sources directory $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
+ failure=1
+ break
+ fi
+ fi
+
+ cp -vR $subdirectory/* ${package}sources/$pathname/$level
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$subdirectory$c_error to $c_notice${package}sources/$pathname/$level$c_error.$c_reset"
+ failure=1
+ break
+ fi
+ fi
+ done
- echo -e "${c_error}ERROR: monolithic build is not implemented.$c_reset"
- package_cleanup
- exit $failure
+ if [[ $failure != "" ]] ; then
+ break;
+ fi
+ done
- # TODO
+ if [[ $failure != "" ]] ; then
+ break;
+ fi
+ done
if [[ $failure != "" ]] ; then
package_cleanup