diff options
author | Mark Ferrell <major@homeonderanged.org> | 2014-03-18 11:04:26 -0700 |
---|---|---|
committer | Mark Ferrell <major@homeonderanged.org> | 2014-03-18 11:04:26 -0700 |
commit | f097158d8eb5a84a7accc58a22d39ce70999f6d6 (patch) | |
tree | 7db4753ecb90dd36f52c7c013970bf061a6bfa08 | |
parent | 8b684d6538eb4405ed8d6bf594a203f1d5892954 (diff) |
Reorg build builtins
* Added a few new builtins to help performance in some minor use cases.
* Move generic builtin routines to top of build script
-rwxr-xr-x | build | 35 | ||||
-rwxr-xr-x | libexec/build-make-clean (renamed from libexec/build-clean) | 0 | ||||
-rwxr-xr-x | libexec/build-make-distclean (renamed from libexec/build-distclean) | 0 | ||||
-rwxr-xr-x | libexec/build-make-export (renamed from libexec/build-export) | 0 | ||||
-rwxr-xr-x | libexec/build-make-fetch (renamed from libexec/build-fetch) | 0 | ||||
-rwxr-xr-x | libexec/build-make-install (renamed from libexec/build-install) | 0 | ||||
-rwxr-xr-x | libexec/build-make-package (renamed from libexec/build-package) | 0 | ||||
-rwxr-xr-x | libexec/build-make-source (renamed from libexec/build-source) | 0 |
8 files changed, 20 insertions, 15 deletions
@@ -1,6 +1,24 @@ #!/bin/sh set -e +## true +# avoid the shell overhead of fork/exec'ing just to call /bin/true +# returns true +true() { : ; } + +## false +# avoid the shell overhead of fork/exec'ing just to call /bin/false +# returns false +false() { ! : ; } + +## error <message> +# displays the supplied <message> on stderr +error() { echo "error: $*" >&2; } + +## die <message> +# display the supplied <message> and exit with an error +die() { error "$*"; exit 1; } + ## mkenv # prepare the environment structure for the current package mkenv() @@ -20,27 +38,14 @@ mkenv() ## cleanup # deal with temporary junk when we exit +# FIXME we need a way to universally deal w/ cleanup of junk created by +# imported commands. cleanup() { test -f "${BUILDER_MAKEFILE}" && rm -f "${BUILDER_MAKEFILE}" test -p "${BUILDER_PIPE}" && rm -f "${BUILDER_PIPE}" } -## error <message> -# displays the supplied <message> on stderr -error() -{ - echo "error: $*" >&2 -} - -## die <message> -# display the supplied <message> and exit with an error -die() -{ - error "$*" - exit 1 -} - ## load_rules <package> # load the Buildrules of a package into the current program space load_rules() diff --git a/libexec/build-clean b/libexec/build-make-clean index b7c0927..b7c0927 100755 --- a/libexec/build-clean +++ b/libexec/build-make-clean diff --git a/libexec/build-distclean b/libexec/build-make-distclean index 1b61e4a..1b61e4a 100755 --- a/libexec/build-distclean +++ b/libexec/build-make-distclean diff --git a/libexec/build-export b/libexec/build-make-export index d611088..d611088 100755 --- a/libexec/build-export +++ b/libexec/build-make-export diff --git a/libexec/build-fetch b/libexec/build-make-fetch index ea50e61..ea50e61 100755 --- a/libexec/build-fetch +++ b/libexec/build-make-fetch diff --git a/libexec/build-install b/libexec/build-make-install index 7a2c121..7a2c121 100755 --- a/libexec/build-install +++ b/libexec/build-make-install diff --git a/libexec/build-package b/libexec/build-make-package index 27940fe..27940fe 100755 --- a/libexec/build-package +++ b/libexec/build-make-package diff --git a/libexec/build-source b/libexec/build-make-source index 4b9e14c..4b9e14c 100755 --- a/libexec/build-source +++ b/libexec/build-make-source |