* [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* [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix
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
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-12-13 13:59 UTC (permalink / raw)
To: ltp
Hi!
> 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).
Why so, readability concerns?
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix
2017-12-13 13:59 ` Cyril Hrubis
@ 2017-12-13 14:41 ` Petr Vorel
2017-12-13 16:12 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2017-12-13 14:41 UTC (permalink / raw)
To: ltp
Hi Cyril,
> > 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).
> Why so, readability concerns?
Yes. It works well how it is, I just find it quite unusual not to use getopt(s). And
mixing parameters with and without '-' as I did is bad.
Whole point of these changes is to make the script usable also for local development
(sometimes one may want to run two builds, thats why it's good to allow overwrite prefix).
Maybe I should have used getopts short option with values, even I don't like short values:
./build.sh [ -t 32|cross|out ] [ -p PREFIX_DIR ] [ -c CC ]
I decided leave out-of-tree on it's own (native only). But it would be possible to have
e.g. out-of-tree 32-bit compilation, but I don't see much advantages for it.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix
2017-12-13 14:41 ` Petr Vorel
@ 2017-12-13 16:12 ` Cyril Hrubis
2017-12-14 19:19 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-12-13 16:12 UTC (permalink / raw)
To: ltp
Hi!
> Yes. It works well how it is, I just find it quite unusual not to use getopt(s). And
> mixing parameters with and without '-' as I did is bad.
> Whole point of these changes is to make the script usable also for local development
> (sometimes one may want to run two builds, thats why it's good to allow overwrite prefix).
>
> Maybe I should have used getopts short option with values, even I don't like short values:
>
> ./build.sh [ -t 32|cross|out ] [ -p PREFIX_DIR ] [ -c CC ]
This does not seem that bad to me.
I would like to avoid passing half of the parameters via argv and half
via env variables if possible.
> I decided leave out-of-tree on it's own (native only). But it would be possible to have
> e.g. out-of-tree 32-bit compilation, but I don't see much advantages for it.
I think that as well, the out/in tree build is orthogonal problem to the
compiler and it's unlikely that things would break.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [RFC PATCH 3/3] build.sh: Allow to overwrite prefix
2017-12-13 16:12 ` Cyril Hrubis
@ 2017-12-14 19:19 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2017-12-14 19:19 UTC (permalink / raw)
To: ltp
Hi!
> > Maybe I should have used getopts short option with values, even I don't like short values:
> > ./build.sh [ -t 32|cross|out ] [ -p PREFIX_DIR ] [ -c CC ]
> This does not seem that bad to me.
> I would like to avoid passing half of the parameters via argv and half
> via env variables if possible.
Right. I rewrote the script and clean it a bit (see master). Everything now uses
getopts (shell built-in).
IMHO script is now suitable for local development as well.
I also added that 2 ARM cross-compile builds.
Kind regards,
Petr
^ permalink raw reply [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