aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/src')
-rw-r--r--reproduce/src/make/dependencies-basic.mk128
-rw-r--r--reproduce/src/make/dependencies.mk34
2 files changed, 132 insertions, 30 deletions
diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
new file mode 100644
index 0000000..dad9c5f
--- /dev/null
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -0,0 +1,128 @@
+# Build the VERY BASIC reproduction pipeline dependencies (programs and
+# libraries).
+#
+# ------------------------------------------------------------------------
+# !!!!! IMPORTANT NOTES !!!!!
+#
+# This Makefile will be run by the initial `./configure' script. It is not
+# included into the reproduction pipe after that.
+#
+# This Makefile builds very low-level and basic tools like GNU Bash and GNU
+# Make. Therefore this is the only Makefile in the reproduction pipeline
+# where you MUST NOT assume that modern GNU Bash or GNU Make are used.
+#
+# This Makefile is a very simplified version of `dependencies.mk' in the
+# same directory. See there for more comments.
+#
+# ------------------------------------------------------------------------
+#
+# 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/>.
+
+
+# Top level environment
+include reproduce/config/pipeline/LOCAL.mk
+include reproduce/config/pipeline/dependency-versions.mk
+
+ddir = $(BDIR)/dependencies
+tdir = $(BDIR)/dependencies/tarballs
+idir = $(BDIR)/dependencies/installed
+ibdir = $(BDIR)/dependencies/installed/bin
+ildir = $(BDIR)/dependencies/installed/lib
+
+top-level-programs = bash make
+all: $(foreach p, $(top-level-programs), $(ibdir)/$(p))
+
+
+
+
+
+# Tarballs
+# --------
+#
+# Prepare tarballs. Difference with that in `dependencies.mk': `.ONESHELL'
+# is not recognized by some versions of Make (even older GNU Makes). So
+# we'll have to make sure the recipe doesn't break into multiple shell
+# calls (so we can preserve the variables).
+tarballs = $(foreach t, bash-$(bash-version).tar.gz \
+ make-$(make-version).tar.gz \
+ , $(tdir)/$(t) )
+$(tarballs): $(tdir)/%:
+ if [ -f $(DEPENDENCIES-DIR)/$* ]; then \
+ cp $(DEPENDENCIES-DIR)/$* $@; \
+ else \
+ n=$$(echo $* | sed -e's/[0-9\-]/ /g' -e's/\./ /g' \
+ | awk '{print $$1}' ); \
+ \
+ mergenames=1; \
+ if [ $$n = bash ]; then w=http://ftp.gnu.org/gnu/bash; \
+ elif [ $$n = make ]; then w=http://akhlaghi.org/src; \
+ else \
+ echo; echo; echo; \
+ echo "'$$n' not recognized as a dependency name to download." \
+ echo; echo; echo; \
+ exit 1; \
+ fi; \
+ \
+ if [ $$mergenames = 1 ]; then tarballurl=$$w/"$*"; \
+ else tarballurl=$$w; \
+ fi; \
+ echo "Downloading $$tarballurl"; \
+ $(DOWNLOADER) $@ $$tarballurl; \
+ fi
+
+
+
+
+
+# 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
+# --------
+#
+# Everything is standard and we can make it statically.
+$(ibdir)/bash: $(tdir)/bash-$(bash-version).tar.gz
+ $(call gbuild,$(subst $(tdir),,$<), bash-$(bash-version), static)
+
+
+
+
+
+# GNU Make
+# --------
+#
+# Unfortunately GNU Make needs dynamic linking in two instances: when
+# loading objects (dynamically linked libraries), or when using the
+# `getpwnam' function (for tilde expansion). The first can be disabled with
+# `--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))
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk
index 1a0a5d1..1e29973 100644
--- a/reproduce/src/make/dependencies.mk
+++ b/reproduce/src/make/dependencies.mk
@@ -6,10 +6,6 @@
# This Makefile will be run by the initial `./configure' script. It is not
# included into the reproduction pipe after that.
#
-# This Makefile also builds GNU Bash and GNU Make. Therefore this is the
-# only Makefile in the reproduction pipeline where you MUST NOT assume that
-# GNU Bash or GNU Make are to be used.
-#
# ------------------------------------------------------------------------
#
# Original author:
@@ -48,17 +44,10 @@ ildir = $(BDIR)/dependencies/installed/lib
top-level-programs = ls gawk gs grep libtool sed git astnoisechisel
all: $(foreach p, $(top-level-programs), $(ibdir)/$(p))
-# This Makefile will be called to also build Bash locally. So when we don't
-# have it yet, we'll have to use the system's bash.
-ifeq ($(USE_LOCAL_BASH),yes)
-SHELL := $(ibdir)/bash
-else
-SHELL := /bin/sh
-endif
-
# Other basic environment settings.
.ONESHELL:
-.SHELLFLAGS = -ec
+.SHELLFLAGS := -ec
+SHELL := $(ibdir)/bash
PATH := $(ibdir):$(PATH)
LDFLAGS := -L$(ildir) $(LDFLAGS)
CPPFLAGS := -I$(idir)/include $(CPPFLAGS)
@@ -78,8 +67,7 @@ LD_LIBRARY_PATH := $(ildir):$(LD_LIBRARY_PATH)
# convention, but include the name/version in their tarball names with
# another format, we'll do the modification before the download so the
# downloaded file has our desired format.
-tarballs = $(foreach t, bash-$(bash-version).tar.gz \
- cfitsio-$(cfitsio-version).tar.gz \
+tarballs = $(foreach t, cfitsio-$(cfitsio-version).tar.gz \
cmake-$(cmake-version).tar.gz \
coreutils-$(coreutils-version).tar.xz \
curl-$(curl-version).tar.gz \
@@ -94,7 +82,6 @@ tarballs = $(foreach t, bash-$(bash-version).tar.gz \
libtool-$(libtool-version).tar.gz \
libgit2-$(libgit2-version).tar.gz \
sed-$(sed-version).tar.xz \
- make-$(make-version).tar.gz \
wcslib-$(wcslib-version).tar.bz2 \
zlib-$(zlib-version).tar.gz \
, $(tdir)/$(t) )
@@ -109,8 +96,7 @@ $(tarballs): $(tdir)/%:
# Set the top download link of the requested tarball.
mergenames=1
- if [ $$n = bash ]; then w=http://ftp.gnu.org/gnu/bash
- elif [ $$n = cfitsio ]; then
+ if [ $$n = cfitsio ]; then
mergenames=0
v=$$(echo $(cfitsio-version) | sed -e's/\.//' \
| awk '{l=length($1); \
@@ -133,7 +119,6 @@ $(tarballs): $(tdir)/%:
elif [ $$n = libgit ]; then
mergenames=0
w=https://github.com/libgit2/libgit2/archive/v$(libgit2-version).tar.gz
- elif [ $$n = make ]; then w=http://akhlaghi.org/src
elif [ $$n = sed ]; then w=http://ftp.gnu.org/gnu/sed
elif [ $$n = tiff ]; then w=https://download.osgeo.org/libtiff
elif [ $$n = wcslib ]; then w=ftp://ftp.atnf.csiro.au/pub/software/wcslib
@@ -239,21 +224,10 @@ $(ildir)/libz.a: $(tdir)/zlib-$(zlib-version).tar.gz
# Programs
# --------
-$(ibdir)/bash: $(tdir)/bash-$(bash-version).tar.gz
- $(call gbuild,$(subst $(tdir),,$<), bash-$(bash-version), static)
-
$(ibdir)/cmake: $(tdir)/cmake-$(cmake-version).tar.gz \
$(ibdir)/ls
$(call cbuild,$(subst $(tdir),,$<), cmake-$(cmake-version))
-# Unfortunately GNU Make needs dynamic linking in two instances: when
-# loading objects (dynamically linked libraries), or when using the
-# `getpwnam' function (for tilde expansion). The first can be disabled with
-# `--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))
-
$(ibdir)/ls: $(tdir)/coreutils-$(coreutils-version).tar.xz
$(call gbuild,$(subst $(tdir),,$<), coreutils-$(coreutils-version), \
static)