Skip to contentSkip to conversation

build: Disable make install for most of builds

PATCH New Petr Vorel 2 participants 4 messages Feb 7, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 build: Disable make install for most of builds

build.sh: add -i option which enables make install (default off) Enable it in Debian powerpc64le cross-compilation (out of tree) and latest Fedora.

This 1) speedup builds 2) fixes often "No space left on device" on s390x.

---
 .travis.yml |  7 ++++---
 build.sh    | 32 +++++++++++++++++++++++---------
 2 files changed, 27 insertions(+), 12 deletions(-)
.travis.yml +4 -3
index 3ef42f029..df233f43e 100644
@@ -14,7 +14,7 @@ matrix:
 
         # cross compilation builds
         - os: linux
-          env: DISTRO=debian:stable VARIANT=cross-compile.ppc64le TREE=out
+          env: DISTRO=debian:stable VARIANT=cross-compile.ppc64le TREE=out MAKE_INSTALL=1
           compiler: powerpc64le-linux-gnu-gcc
 
         - os: linux
@@ -46,7 +46,7 @@ matrix:
 
         # other builds
         - os: linux
-          env: DISTRO=fedora:latest
+          env: DISTRO=fedora:latest MAKE_INSTALL=1
           compiler: clang
 
         - os: linux
@@ -99,6 +99,7 @@ before_install:
 script:
     - INSTALL="${DISTRO%%:*}"
     - INSTALL="${INSTALL%%/*}"
+    - if [ "$MAKE_INSTALL" = 1 ]; then INSTALL_OPT="-i"; fi
     - if [ ! "$TREE" ]; then TREE="in"; fi
     - case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac
-    - docker run -t ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && ../build.sh -o $TREE -t $BUILD -c $CC"
+    - docker run -t ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && ../build.sh -o $TREE -t $BUILD -c $CC $INSTALL_OPT"
build.sh +23 -9
index c6d146335..e12a0b27d 100755
@@ -46,20 +46,24 @@ build_cross()
 build()
 {
 	local tree="$1"
-	shift
+	local install="$2"
+	shift 2
 
 	echo "=== autotools ==="
 	make autotools
 
 	if [ "$tree" = "in" ]; then
-		build_in_tree $@
+		build_in_tree $install $@
 	else
-		build_out_tree $@
+		build_out_tree $install $@
 	fi
 }
 
 build_out_tree()
 {
+	local install="$1"
+	shift
+
 	local tree="$PWD"
 	local build="$tree/../ltp-build"
 	local make_opts="$MAKE_OPTS -C $build -f $tree/Makefile top_srcdir=$tree top_builddir=$build"
@@ -71,8 +75,12 @@ build_out_tree()
 	echo "=== build ==="
 	make $make_opts
 
-	echo "=== install ==="
-	make $make_opts DESTDIR="$PREFIX" SKIP_IDCHECK=1 install
+	if [ "$install" = 1 ]; then
+		echo "=== install ==="
+		make $make_opts DESTDIR="$PREFIX" SKIP_IDCHECK=1 install
+	else
+		echo "make install skipped, use -i to run it"
+	fi
 }
 
 build_in_tree()
@@ -82,8 +90,12 @@ build_in_tree()
 	echo "=== build ==="
 	make $MAKE_OPTS
 
-	echo "=== install ==="
-	make $MAKE_OPTS install
+	if [ "$install" = 1 ]; then
+		echo "=== install ==="
+		make $MAKE_OPTS install
+	else
+		echo "make install skipped, use -i to run it"
+	fi
 }
 
 run_configure()
@@ -139,11 +151,13 @@ EOF
 PREFIX="$DEFAULT_PREFIX"
 build="$DEFAULT_BUILD"
 tree="$DEFAULT_TREE"
+install=0
 
-while getopts "c:ho:p:t:" opt; do
+while getopts "c:hio:p:t:" opt; do
 	case "$opt" in
 	c) CC="$OPTARG";;
 	h) usage; exit 0;;
+	i) install=1;;
 	o) case "$OPTARG" in
 		in|out) tree="$OPTARG";;
 		*) echo "Wrong build tree '$OPTARG'" >&2; usage; exit 1;;
@@ -166,4 +180,4 @@ echo
 echo "=== compiler version ==="
 $CC --version
 
-eval build_$build $tree
+eval build_$build $tree $install
Signature · 1 line
2.24.1
author
#1 lore raw

PATCH 1/1 build: Disable make install for most of builds

Quoted 3 lines

build.sh: add -i option which enables make install (default off) Enable it in Debian powerpc64le cross-compilation (out of tree) and latest Fedora.

Hm, it requires a fix, below.

Script is getting ugly, but it's just a build script.

Verification:
https://travis-ci.org/pevik/ltp/builds/647410565

build.sh +6 -3
index e12a0b27d..e3d268c83 100755
@@ -24,13 +24,13 @@ build_32()
 {
 	echo "===== 32-bit ${1}-tree build into $PREFIX ====="
 	CFLAGS="-m32 $CFLAGS" LDFLAGS="-m32 $LDFLAGS"
-	build $1
+	build $1 $2
 }
 
 build_native()
 {
 	echo "===== native ${1}-tree build into $PREFIX ====="
-	build $1
+	build $1 $2
 }
 
 build_cross()
@@ -40,7 +40,7 @@ build_cross()
 		{ echo "Missing CC variable, pass it with -c option." >&2; exit 1; }
 
 	echo "===== cross-compile ${host} ${1}-tree build into $PREFIX ====="
-	build $1 "--host=$host" CROSS_COMPILE="${host}-"
+	build $1 $2 "--host=$host" CROSS_COMPILE="${host}-"
 }
 
 build()
@@ -85,6 +85,9 @@ build_out_tree()
 
 build_in_tree()
 {
+	local install="$1"
+	shift
+
 	run_configure ./configure $CONFIGURE_OPTS_IN_TREE --prefix=$PREFIX $@
 
 	echo "=== build ==="
author
#2 lore raw

PATCH 1/1 build: Disable make install for most of builds

In reply to Petr Vorel

Hi,

Quoted 5 lines

build.sh: add -i option which enables make install (default off) Enable it in Debian powerpc64le cross-compilation (out of tree) and latest Fedora.

This 1) speedup builds 2) fixes often "No space left on device" on s390x.

Merged.
There still might be some failures on s390x, when space isn't enough for even starting docker, but that should be less often.

Kind regards,
Petr

#3 lore raw

PATCH 1/1 build: Disable make install for most of builds

Hi!
Thanks for looking after the travis.

Signature · 2 lines
Cyril Hrubis
[email protected]