local variables=
local settings_file=data/build/settings
local operation=
+ local operation_failure=
local path_build=build/
local path_c=sources/c/
+ local path_s=data/settings/
local path_bash=sources/bash/
local project_built=
+ local enable_shared=
+ local enable_static=
+
if [[ $# -gt 0 ]] ; then
t=$#
grab_next=path_bash
elif [[ $p == "-c" || $p == "--c_path" ]] ; then
grab_next=path_c
+ elif [[ $p == "-S" || $p == "--s_path" ]] ; then
+ grab_next=path_s
elif [[ $p == "-p" || $p == "--project" ]] ; then
grab_next=project_built
+ elif [[ $p == "--enable-shared" ]] ; then
+ enable_shared="yes"
+ elif [[ $p == "--disable-shared" ]] ; then
+ enable_shared="no"
+ elif [[ $p == "--enable-static" ]] ; then
+ enable_static="yes"
+ elif [[ $p == "--disable-static" ]] ; then
+ enable_static="no"
elif [[ $operation == "" ]] ; then
- operation=$p
- else
- operation=fail-multiple
+ operation="$p"
+ elif [[ $operation_failure == "" ]] ; then
+ operation_failure=fail-multiple
fi
else
if [[ $grab_next == "path_build" ]] ; then
path_build=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
elif [[ $grab_next == "settings_file" ]] ; then
- settings_file=$(echo $p | sed -e 's|^//*|/|')
+ settings_file=$(echo $p | sed -e 's|^//*|/|' -e 's|^//*|/|')
elif [[ $grab_next == "path_bash" ]] ; then
- path_bash=$(echo $p | sed -e 's|/*$|/|')
+ path_bash=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
elif [[ $grab_next == "path_c" ]] ; then
- path_c=$(echo $p | sed -e 's|/*$|/|')
+ path_c=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ elif [[ $grab_next == "path_s" ]] ; then
+ path_s=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
elif [[ $grab_next == "project_built" ]] ; then
project_built="-$(echo $p | sed -e 's|/*$||')"
fi
exit 0
fi
- if [[ $operation == "build" ]] ; then
+ if [[ $operation_failure == "fail-multiple" ]] ; then
+ echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset"
+ elif [[ $operation == "build" ]] ; then
if [[ -f ${path_build}.built$project_built ]] ; then
echo -e "${c_warning}WARNING: this project has already been built.$c_reset"
else
fi
elif [[ $operation == "clean" ]] ; then
generate_operation_clean
- elif [[ $operation == "fail-multiple" ]] ; then
- echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset"
elif [[ $operation == "" ]] ; then
echo -e "${c_error}ERROR: no operation was given.$c_reset"
else
echo -e " ${c_notice}Version $version$c_reset"
echo
echo -e "$c_highlight$system_name$c_reset $c_notice<${c_reset}operation$c_notice>$c_reset"
- echo -e " ${c_important}build${c_reset} Build or compile the code"
- echo -e " ${c_important}clean${c_reset} Delete all build files"
+ echo -e " ${c_important}build${c_reset} Build or compile the code"
+ echo -e " ${c_important}clean${c_reset} Delete all build files"
echo
echo -e "${c_highlight}Options:$c_reset"
echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen"
echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program"
echo
echo -e "${c_highlight}Generate Options:$c_reset"
- echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Specify a custom build directory"
- echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset} Specify a custom build settings file"
- echo -e " -${c_important}B$c_reset, --${c_important}bash_path${c_reset} Specify a custom path to the bash source files"
- echo -e " -${c_important}c$c_reset, --${c_important}c_path${c_reset} Specify a custom path to the c source files"
- echo -e " -${c_important}p$c_reset, --${c_important}project${c_reset} Specify a project name for storing built status"
+ echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Specify a custom build directory"
+ echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset} Specify a custom build settings file"
+ echo -e " -${c_important}B$c_reset, --${c_important}bash_path${c_reset} Specify a custom path to the bash source files"
+ echo -e " -${c_important}c$c_reset, --${c_important}c_path${c_reset} Specify a custom path to the c source files"
+ echo -e " -${c_important}S$c_reset, --${c_important}s_path${c_reset} Specify a custom path to the settings files"
+ echo -e " -${c_important}p$c_reset, --${c_important}project${c_reset} Specify a project name for storing built status"
+ echo
+ echo -e "${c_highlight}Special Options:$c_reset"
+ echo -e " --${c_important}enable-shared${c_reset} Forcibly do install shared files"
+ echo -e " --${c_important}disable-shared${c_reset} Forcibly do not install shared files"
+ echo -e " --${c_important}enable-static${c_reset} Forcibly do install static files"
+ echo -e " --${c_important}disable-static${c_reset} Forcibly do not install static files"
echo
}
local i=
local alt=$1
+ if [[ $enable_shared == "yes" ]] ; then
+ shared="yes"
+ elif [[ $enable_shared == "no" ]] ; then
+ shared="no"
+ fi
+
+ if [[ $enable_static == "yes" ]] ; then
+ static="yes"
+ elif [[ $enable_static == "no" ]] ; then
+ static="no"
+ fi
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"
if [[ $sources_settings != "" ]] ; then
for i in $sources_settings ; do
- cp -vf $path_c$i ${path_build}settings/ || failure=1
+ cp -vR $path_s$i ${path_build}settings/ || failure=1
done
fi
local variables=
local operation=
+ local operation_failure=
local mode_individual=
local mode_level=
local mode_monolithic=
elif [[ $p == "-s" || $p == "--sources" ]] ; then
grab_next=path_sources
elif [[ $operation == "" ]] ; then
- operation=$p
- else
- operation=fail-multiple
+ operation="$p"
+ elif [[ $operation_failure == "" ]] ; then
+ operation_failure=fail-multiple
+ operation="$p"
fi
else
if [[ $grab_next == "path_build" ]] ; then
path_build=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
elif [[ $grab_next == "path_destination" ]] ; then
- path_destination=$(echo $p | sed -e 's|/*$|/|')
+ path_destination=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
elif [[ $grab_next == "path_sources" ]] ; then
- path_sources=$(echo $p | sed -e 's|/*$|/|')
+ path_sources=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
fi
grab_next=
exit 1
fi
- if [[ $operation == "build" ]] ; then
+ if [[ $operation_failure == "fail-multiple" ]] ; then
+ echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset"
+ elif [[ $operation == "build" ]] ; then
if [[ $mode_individual == "" && $mode_level == "" && $mode_monolithic == "" && $mode_program == "" ]] ; then
mode_individual="yes"
fi
fi
elif [[ $operation == "clean" ]] ; then
package_operation_clean
- elif [[ $operation == "fail-multiple" ]] ; then
- echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset"
elif [[ $operation == "" ]] ; then
echo -e "${c_error}ERROR: no operation was given.$c_reset"
else
echo -e " ${c_notice}Version $version$c_reset"
echo
echo -e "$c_highlight$system_name$c_reset $c_notice<${c_reset}operation$c_notice>$c_reset"
- echo -e " ${c_important}build${c_reset} Build the package"
- echo -e " ${c_important}clean${c_reset} Delete all built packages"
+ echo -e " ${c_important}build${c_reset} Build the package"
+ echo -e " ${c_important}clean${c_reset} Delete all built packages"
echo
echo -e "${c_highlight}Options:$c_reset"
echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen"
echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color"
echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program"
echo
- echo -e "${c_highlight}Generate Options:$c_reset"
+ echo -e "${c_highlight}Package Options:$c_reset"
echo -e " -${c_important}d$c_reset, --${c_important}destination${c_reset} Specify a custom package destination directory"
echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset} Specify a custom build directory"
echo -e " -${c_important}i$c_reset, --${c_important}individual${c_reset} Build packages by individual package (levels 0. 1. and 2)"
failure=1
fi
- if [[ $failire == "" ]] ; then
+ if [[ $failure == "" ]] ; then
chmod ugo+x ${package}generate.sh
if [[ $? -ne 0 ]] ; then
failure=1
fi
fi
+
+ if [[ $failure == "" ]] ; then
+ cp -vR ${path_build}scripts/install.sh $package
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to copy script $c_notice${path_build}install.sh$c_error to $c_notice$package$c_error.$c_reset"
+ failure=1
+ fi
+ fi
+
+ if [[ $failure == "" ]] ; then
+ chmod ugo+x ${package}install.sh
+
+ if [[ $? -ne 0 ]] ; then
+ echo -e "${c_error}ERROR: failed to set executable permissions on script $c_notice${package}install.sh$c_error.$c_reset"
+ failure=1
+ fi
+ fi
fi
if [[ $failure != "" && ! -d ${package}build ]] ; then
name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")"
package="${path_destination}individual/${name}-${version}/"
- echo -e "${c_important}Processing Package $c_reset$c_notice$package$c_reset${c_important}.$c_reset"
+ echo
+ echo -e "${c_highlight}Processing Package$c_reset (individual) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
package_create_base_files
name="fll-$level"
package="${path_destination}level/${name}-${version}/"
- echo -e "${c_important}Processing Package $c_reset$c_notice$package$c_reset${c_important}.$c_reset"
+ echo
+ echo -e "${c_highlight}Processing Package$c_reset (level) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
if [[ ! -d $path_build$level ]] ; then
echo -e "${c_error}ERROR: build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset"
name="$(echo $directory | sed -e "s|${path_sources}level_3/||")"
package="${path_destination}program/${name}-${version}/"
- echo -e "${c_important}Processing Package $c_reset$c_notice$package$c_reset${c_important}.$c_reset"
+ echo
+ echo -e "${c_highlight}Processing Package$c_reset (program) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset"
package_create_base_files