aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <major@homeonderanged.org>2014-03-18 11:04:26 -0700
committerMark Ferrell <major@homeonderanged.org>2014-03-18 11:04:26 -0700
commitf097158d8eb5a84a7accc58a22d39ce70999f6d6 (patch)
tree7db4753ecb90dd36f52c7c013970bf061a6bfa08
parent8b684d6538eb4405ed8d6bf594a203f1d5892954 (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-xbuild35
-rwxr-xr-xlibexec/build-make-clean (renamed from libexec/build-clean)0
-rwxr-xr-xlibexec/build-make-distclean (renamed from libexec/build-distclean)0
-rwxr-xr-xlibexec/build-make-export (renamed from libexec/build-export)0
-rwxr-xr-xlibexec/build-make-fetch (renamed from libexec/build-fetch)0
-rwxr-xr-xlibexec/build-make-install (renamed from libexec/build-install)0
-rwxr-xr-xlibexec/build-make-package (renamed from libexec/build-package)0
-rwxr-xr-xlibexec/build-make-source (renamed from libexec/build-source)0
8 files changed, 20 insertions, 15 deletions
diff --git a/build b/build
index 356209c..dea2d67 100755
--- a/build
+++ b/build
@@ -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