aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-14 12:39:23 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-14 13:28:27 +0000
commita56b46a7dde09d7cb24abb53598bd777b5c89577 (patch)
treed436e27b05710753c2e7e553a82d4335e8117c61
parent78727050424174fdee340190cdc458e491aaf18c (diff)
Configuration stops if a dependency cannot be built
Until now, we used semicolons in Make's Call function definitions to build the programs with GNU build system or CMake. Therefore, if any step of the process failed, the rest would be ignorant to it and pass. Now, we use `&&' to separate the different processing steps. In this way, we can be sure that if any of them fails (during configuration, or building for example), the pipeline will also stop and not continue to the next command (in the same recipe). Since the two Make Call functions were identical in the two `dependencies-basic.mk' and `dependencies.mk', they are now in one file to be imported in both. This bug was found by Raul Infante Sainz.
-rwxr-xr-xconfigure22
-rw-r--r--reproduce/src/make/dependencies-basic.mk20
-rw-r--r--reproduce/src/make/dependencies-build-rules.mk80
-rw-r--r--reproduce/src/make/dependencies.mk27
-rw-r--r--reproduce/src/make/initialize.mk3
5 files changed, 103 insertions, 49 deletions
diff --git a/configure b/configure
index 67804e8..8e15000 100755
--- a/configure
+++ b/configure
@@ -271,6 +271,7 @@ EOF
ddir=$tmpddir
echo " -- Using '$ddir'"
fi
+ echo
fi
@@ -399,12 +400,21 @@ ln -s $(pwd)/reproduce/config/gnuastro .gnuastro
# Build basic dependencies
# ------------------------
tsec=10
-echo "----------------"
-echo "Necessary reproduction pipeline dependencies will be built in $tsec sec."
-echo
-echo "NOTE: the built software will NOT BE INSTALLED on your system, they"
-echo "are only for local usage by this reproduction pipeline (in '$bdir/dependencies/installed')"
-echo
+cat <<EOF
+
+-------------------------
+Building dependencies ...
+-------------------------
+
+Necessary dependency programs and libraries will be built in $tsec sec.
+
+NOTE: the built software will NOT BE INSTALLED on your system (no root
+access is required). They are only for local usage by this reproduction
+pipeline. They will be installed in:
+
+$bdir/dependencies/installed
+
+EOF
sleep $tsec
make -f reproduce/src/make/dependencies-basic.mk #-j2
diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index dad9c5f..33b682b 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -38,6 +38,7 @@
# Top level environment
include reproduce/config/pipeline/LOCAL.mk
+include reproduce/src/make/dependencies-build-rules.mk
include reproduce/config/pipeline/dependency-versions.mk
ddir = $(BDIR)/dependencies
@@ -67,7 +68,8 @@ $(tarballs): $(tdir)/%:
if [ -f $(DEPENDENCIES-DIR)/$* ]; then \
cp $(DEPENDENCIES-DIR)/$* $@; \
else \
- n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \
+ n=$$(echo $* | sed -e's/[0-9\-]/ /g' \
+ -e's/\./ /g' \
| awk '{print $$1}' ); \
\
mergenames=1; \
@@ -91,20 +93,6 @@ $(tarballs): $(tdir)/%:
-# Build system rules
-# ------------------
-gbuild = cd $(ddir); rm -rf $(2); tar xf $(tdir)/$(1); cd $(2); \
- if [ $(3)x = staticx ]; then \
- opts="CFLAGS=--static --disable-shared"; \
- fi; \
- ./configure $$opts $(4) --prefix=$(idir); make $(5); \
- check="$(6)"; if [ x"$$check" != x ]; then $$check; fi; \
- make install; cd ..; rm -rf $(2)
-
-
-
-
-
# GNU Bash
# --------
#
@@ -125,4 +113,4 @@ $(ibdir)/bash: $(tdir)/bash-$(bash-version).tar.gz
# `--disable-load', but unfortunately I don't know any way to fix the
# second. So, we'll have to build it dynamically for now.
$(ibdir)/make: $(tdir)/make-$(make-version).tar.gz
- $(call gbuild,$(subst $(tdir),,$<), make-$(make-version))
+ $(call gbuild,$(subst $(tdir),,$<), make-$(make-version), , , ,)
diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk
new file mode 100644
index 0000000..a4d25aa
--- /dev/null
+++ b/reproduce/src/make/dependencies-build-rules.mk
@@ -0,0 +1,80 @@
+# Generic configurable recipes to build packages with GNU Build system or
+# CMake. This is Makefile is not intended to be run directly, it will be
+# imported into `dependencies-basic.mk' and `dependencies.mk'. They should
+# be activated with Make's `Call' function.
+#
+# Original author:
+# Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Contributing author(s):
+# Your name <your@email.address>
+# Copyright (C) 2018, Your Name.
+#
+# This Makefile is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This Makefile is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# A copy of the GNU General Public License is available at
+# <http://www.gnu.org/licenses/>.
+
+
+
+
+
+# IMPORTANT note
+# --------------
+#
+# Without using `&&', if a step fails, the process will continue. However,
+# in the `if' statements, we need `;' (particularly between `]' and
+# `then'). So we need to put any necessary checks at the start, then when
+# we start the process, every command will be separated by an `&&'.
+
+
+
+
+
+# GNU Build system
+# ----------------
+#
+# Arguments:
+# 1: Tarball full address.
+# 2: Directory name after unpacking.
+# 3: Set to `static' for a static build.
+# 4: Extra configuration options.
+# 5: Extra options/arguments to pass to Make.
+# 6: Step to run between `make' and `make install': usually `make check'.
+gbuild = if [ $(3)x = staticx ]; then \
+ configopts="CFLAGS=--static --disable-shared"; \
+ fi; \
+ check="$(6)"; \
+ if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \
+ cd $(ddir) && rm -rf $(2) && tar xf $(tdir)/$(1) && cd $(2) && \
+ ./configure $$configopts $(4) --prefix=$(idir) && \
+ make $(5) && \
+ $$check && \
+ make install&& \
+ cd ..&& rm -rf $(2)
+
+
+
+
+
+# CMake
+# -----
+cbuild = if [ $(3)x = staticx ]; then \
+ export CFLAGS="--static $$CFLAGS"; \
+ opts="-DBUILD_SHARED_LIBS=OFF"; \
+ fi; \
+ cd $(ddir) && rm -rf $(2) && tar xf $(tdir)/$(1) && cd $(2) && \
+ rm -rf my-build && mkdir my-build && cd my-build && opts="" && \
+ cmake .. $$opts $(4) && \
+ cmake --build . && \
+ cmake .. -DCMAKE_INSTALL_PREFIX=$(idir) && \
+ cmake --build . --target install && \
+ cd ../.. && \
+ rm -rf $(2)
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk
index 1e29973..6da554c 100644
--- a/reproduce/src/make/dependencies.mk
+++ b/reproduce/src/make/dependencies.mk
@@ -31,6 +31,7 @@
# Top level environment
include reproduce/config/pipeline/LOCAL.mk
+include reproduce/src/make/dependencies-build-rules.mk
include reproduce/config/pipeline/dependency-versions.mk
ddir = $(BDIR)/dependencies
@@ -148,32 +149,6 @@ $(tarballs): $(tdir)/%:
-# Build system rules
-# ------------------
-gbuild = cd $(ddir); rm -rf $(2); tar xf $(tdir)/$(1); cd $(2); \
- if [ $(3)x = staticx ]; then \
- opts="CFLAGS=--static --disable-shared"; \
- fi; \
- ./configure $$opts $(4) --prefix=$(idir); make $(5); \
- check="$(6)"; if [ x"$$check" != x ]; then $$check; fi; \
- make install; cd ..; rm -rf $(2)
-
-
-cbuild = cd $(ddir); rm -rf $(2); tar xf $(tdir)/$(1); cd $(2); \
- rm -rf my-build; mkdir my-build; cd my-build; opts=""; \
- if [ $(3)x = staticx ]; then \
- export CFLAGS="--static $$CFLAGS"; \
- opts="-DBUILD_SHARED_LIBS=OFF"; \
- fi; \
- cmake .. $$opts $(4); \
- cmake --build .; \
- cmake .. -DCMAKE_INSTALL_PREFIX=$(idir); \
- cmake --build . --target install; cd ../..; rm -rf $(2)
-
-
-
-
-
# Libraries
# ---------
$(ildir)/libcfitsio.a: $(tdir)/cfitsio-$(cfitsio-version).tar.gz \
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index 563462f..d0f69a3 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -139,7 +139,8 @@ distclean: clean
# `rm' program. So for this recipe, we'll use the host system's
# `rm', not our own.
$(sys-rm) -rf $(BDIR) reproduce/build
- $(sys-rm) -f Makefile $(pconfdir)/LOCAL.mk .gnuastro .local
+ $(sys-rm) -f Makefile .gnuastro .local
+ $(sys-rm) -f $(pconfdir)/LOCAL.mk $(gconfdir)/gnuastro-local.conf