Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifying build so that we can have re-usable, external code
- Loading branch information
1 parent
de9ed2b
commit 81e71ee
Showing
5 changed files
with
208 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib/shellfire/build/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
core_dependency_requires '*' rm mkdir | ||
_build_createInitialFatten() | ||
{ | ||
local groupName="$1" | ||
|
||
core_message NOTICE "Initial fattening of '$groupName' as a self-hosting bootstrap" | ||
|
||
local fattenedOutputPath="$build_outputPath"/fattened/"$groupName"/all | ||
|
||
rm -rf "$fattenedOutputPath" 2>/dev/null || sudo -p "Please enter the password for user %p to let root rm -rf '$fattenedOutputPath': " rm -rf "$fattenedOutputPath" | ||
mkdir -m 0755 -p "$fattenedOutputPath" | ||
|
||
"$build_fattenPath_default" --verbose $(core_init_verbosity) --force --repository-path tools/fatten --output-path "$fattenedOutputPath" --bin-path "$build_binPath" -- fatten | ||
|
||
# Override to force use of our fattened fatten | ||
build_fattenPath="${fattenedOutputPath}${build_binPath}"/fatten | ||
} | ||
|
||
build() | ||
{ | ||
echo $_program_libPath | ||
echo WORKS | ||
return 0 | ||
|
||
build_travis_ci_updateGitSubmodulesRecursively | ||
build_travis_ci_ensureGnupgKeyringExists | ||
build_prepareOutput | ||
|
||
_build_createInitialFatten 'initial-fatten' | ||
|
||
build_fattenAndSwaddle 'shellfire' "$build_relativePath" paths.d-helper | ||
build_fattenAndSwaddle 'fatten' "$build_relativePath"/tools/fatten fatten | ||
build_fattenAndSwaddle 'swaddle' "$build_relativePath"/tools/swaddle swaddle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
#!/usr/bin/env sh | ||
# This file is part of shellfire. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/shellfire/master/COPYRIGHT. No part of shellfire, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file. | ||
# Copyright © 2014-2015 The developers of shellfire. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/shellfire-dev/shellfire/master/COPYRIGHT. | ||
|
||
|
||
_program() | ||
{ | ||
core_usesIn build script | ||
} | ||
|
||
_program_name='build' | ||
_program_namespace='build' | ||
_program_version='unversioned' | ||
_program_package_or_build='' | ||
_program_path="$([ "${_program_fattening_program_path+set}" = 'set' ] && printf '%s\n' "$_program_fattening_program_path" || ([ "${0%/*}" = "${0}" ] && printf '%s\n' '.' || printf '%s\n' "${0%/*}"))" | ||
_program_libPath="${_program_path}/lib" | ||
_program_etcPath="${_program_path}/etc" | ||
_program_entrypoint='build' | ||
|
||
_program_commandLine_parseInitialise() | ||
{ | ||
build_relativePath_default="$(pwd)" | ||
build_binPath_default="/usr/bin" | ||
build_outputPath_default="$relativeToPath"/output | ||
build_fattenPath_default="$relativeToPath"/tools/fatten/fatten | ||
build_swaddlePath_default="$relativeToPath"/tools/swaddle/swaddle | ||
|
||
# Force verbosity to 1 | ||
build_verbose=1 | ||
} | ||
|
||
_program_commandLine_helpMessage() | ||
{ | ||
_program_commandLine_helpMessage_usage="[OPTION]..." | ||
_program_commandLine_helpMessage_description="Builds shellfire tools (uses verbosity of 1 by default)" | ||
_program_commandLine_helpMessage_options=" | ||
-r, --relative-path PATH PATH to use for finding stuff. | ||
Defaults to pwd:- | ||
$build_relativePath_default | ||
-b, --bin-path PATH PATH to prefix executables with | ||
Defaults to:- | ||
$build_binPath_default | ||
-p, --output-path PATH PATH to build output to. | ||
Defaults to one based on current working directory:- | ||
$build_outputPath_default | ||
-f, --fatten-path PATH PATH to fatten executable. | ||
Defaults to one based on current working directory:- | ||
$build_fattenPath_default | ||
-s, --swaddle-path PATH PATH to swaddle executable. | ||
Defaults to one based on current working directory:- | ||
$build_swaddlePath_default" | ||
_program_commandLine_helpMessage_optionsSpacing=' ' | ||
_program_commandLine_helpMessage_configurationKeys=" | ||
build_relativePath Equivalent to --relative-path | ||
build_binPath Equivalent to --bin-path | ||
build_outputPath Equivalent to --output-path | ||
build_fattenPath Equivalent to --fatten-path | ||
build_swaddlePath Equivalent to --swaddle-path | ||
" | ||
_program_commandLine_helpMessage_examples=" | ||
./${_program_name} | ||
" | ||
} | ||
|
||
_program_commandLine_optionExists() | ||
{ | ||
case "$optionName" in | ||
|
||
r|relative-path) | ||
echo 'yes-argumented' | ||
;; | ||
|
||
b|bin-path) | ||
echo 'yes-argumented' | ||
;; | ||
|
||
o|output-path) | ||
echo 'yes-argumented' | ||
;; | ||
|
||
f|fatten-path) | ||
echo 'yes-argumented' | ||
;; | ||
|
||
s|swaddle-path) | ||
echo 'yes-argumented' | ||
;; | ||
|
||
*) | ||
echo 'no' | ||
;; | ||
|
||
esac | ||
} | ||
|
||
_program_commandLine_processOptionWithArgument() | ||
{ | ||
case "$optionName" in | ||
|
||
r|relative-path) | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue" | ||
build_relativePath="$optionValue" | ||
;; | ||
|
||
b|bin-path) | ||
build_binPath="$build_binPath_default" | ||
;; | ||
|
||
o|output-path) | ||
core_validate_folderPathIsReadableAndSearchableAndWritableOrCanBeCreated $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue" | ||
build_outputPath="$optionValue" | ||
;; | ||
|
||
f|fatten-path) | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue" | ||
build_outputPath="$optionValue" | ||
;; | ||
|
||
s|swaddle-path) | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_USAGE 'option' "$optionNameIncludingHyphens" "$optionValue" | ||
build_outputPath="$optionValue" | ||
;; | ||
|
||
esac | ||
} | ||
|
||
_program_commandLine_validate() | ||
{ | ||
if core_variable_isSet build_relativePath; then | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'configuration setting' 'build_relativePath' "$build_relativePath" | ||
else | ||
build_relativePath="$build_relativePath_default" | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'default' 'build_relativePath' "$build_relativePath" | ||
fi | ||
|
||
if core_variable_isUnset build_binPath; then | ||
build_binPath="$build_binPath_default" | ||
fi | ||
|
||
if core_variable_isSet build_outputPath; then | ||
core_validate_folderPathIsReadableAndSearchableAndWritableOrCanBeCreated $core_commandLine_exitCode_CONFIG 'configuration setting' 'build_outputPath' "$build_outputPath" | ||
else | ||
build_outputPath="$build_outputPath_default" | ||
core_validate_folderPathIsReadableAndSearchableAndWritableOrCanBeCreated $core_commandLine_exitCode_CONFIG 'default' 'build_outputPath' "$build_outputPath" | ||
fi | ||
|
||
if core_variable_isSet build_fattenPath; then | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'configuration setting' 'build_fattenPath' "$build_fattenPath" | ||
else | ||
build_fattenPath="$build_fattenPath_default" | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'default' 'build_fattenPath' "$build_fattenPath" | ||
fi | ||
|
||
if core_variable_isSet build_swaddlePath; then | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'configuration setting' 'build_swaddlePath' "$build_swaddlePath" | ||
else | ||
build_swaddlePath="$build_swaddlePath_default" | ||
core_validate_filePathReadableAndExecutable $core_commandLine_exitCode_CONFIG 'default' 'build_swaddlePath' "$build_swaddlePath" | ||
fi | ||
} | ||
|
||
. "$_program_libPath"/shellfire/core/init.functions "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
core_usesIn build | ||
core_usesIn build/travis ci | ||
|
||
build() | ||
{ | ||
core_exitError $core_commandLine_exitCode_CONFIG "Make sure to define build() in build.shellfire" | ||
} | ||
|
||
# relative symlink | ||
core_usesIn build shellfire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../build.shellfire |