public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix
@ 2017-12-13 13:13 Petr Vorel
  2017-12-13 13:59 ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2017-12-13 13:13 UTC (permalink / raw)
  To: ltp

with LTP_PREFIX environment variable.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Note about using environment variables and parameters not prefixed with '-' (no options):
I like getopt(s) and the reason I didn't use them is:
* I don't like short opts which provides getopts build-in (the one we use in LTP).
* Long getopts are supported by getopt binary from util-linux which I didn't
  want to depend on.
---
 build.sh | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/build.sh b/build.sh
index 29da4d29e..bf791d083 100755
--- a/build.sh
+++ b/build.sh
@@ -9,9 +9,9 @@
 
 set -e
 
-PREFIX="$HOME/ltp-install"
+LTP_PREFIX="${LTP_PREFIX:-$HOME/ltp-install}"
 
-CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite --prefix=$PREFIX"
+CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite --prefix=$LTP_PREFIX"
 
 # TODO: open posix testsuite is currently broken in out-tree-build. Enable it once it's fixed.
 CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite"
@@ -20,13 +20,13 @@ MAKE_OPTS="-j$(getconf _NPROCESSORS_ONLN)"
 
 build_32()
 {
-	echo "===== 32-bit in-tree build into $PREFIX ====="
+	echo "===== 32-bit in-tree build into $LTP_PREFIX ====="
 	build_in_tree CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32"
 }
 
 build_native()
 {
-	echo "===== native in-tree build into $PREFIX ====="
+	echo "===== native in-tree build into $LTP_PREFIX ====="
 	build_in_tree
 }
 
@@ -37,7 +37,7 @@ build_cross()
 	[ -n "$host" ] || \
 		{ echo "Missing CROSS_COMPILE and CC variables. You need to set at least one" >&2; exit 1; }
 
-	echo "===== cross-compile ${host} in-tree build into $PREFIX ====="
+	echo "===== cross-compile ${host} in-tree build into $LTP_PREFIX ====="
 	build_in_tree "--host=$host" CROSS_COMPILE="${host}-"
 }
 
@@ -47,7 +47,7 @@ build_out_tree()
 	local build="$tree/../ltp-build"
 	local make_opts="$MAKE_OPTS -C $build -f $tree/Makefile top_srcdir=$tree top_builddir=$build"
 
-	echo "===== native out-of-tree build into $PREFIX ====="
+	echo "===== native out-of-tree build into $LTP_PREFIX ====="
 	mkdir -p $build
 
 	echo "=== autotools ==="
@@ -64,7 +64,7 @@ build_out_tree()
 	cat include/config.h
 
 	make $make_opts
-	make $make_opts DESTDIR="$PREFIX" SKIP_IDCHECK=1 install
+	make $make_opts DESTDIR="$LTP_PREFIX" SKIP_IDCHECK=1 install
 }
 
 build_in_tree()
@@ -106,6 +106,9 @@ native  native in-tree build
 out     out-of-tree build
 
 Default build is native in-tree build.
+
+LTP is installed into '$LTP_PREFIX'.
+The destination can be changed by setting LTP_PREFIX environment variable.
 EOF
 }
 
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-14 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-13 13:13 [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix Petr Vorel
2017-12-13 13:59 ` Cyril Hrubis
2017-12-13 14:41   ` Petr Vorel
2017-12-13 16:12     ` Cyril Hrubis
2017-12-14 19:19       ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox