aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/make
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/src/make')
-rw-r--r--reproduce/src/make/Top-Makefile25
-rw-r--r--reproduce/src/make/dependencies-basic.mk11
-rw-r--r--reproduce/src/make/dependencies.mk90
-rw-r--r--reproduce/src/make/initialize.mk6
-rw-r--r--reproduce/src/make/paper.mk6
5 files changed, 102 insertions, 36 deletions
diff --git a/reproduce/src/make/Top-Makefile b/reproduce/src/make/Top-Makefile
index 5d94766..abd0f45 100644
--- a/reproduce/src/make/Top-Makefile
+++ b/reproduce/src/make/Top-Makefile
@@ -92,17 +92,20 @@ tex/pipeline.tex: $(foreach f, initialize \
delete-me \
, $(mtexdir)/$(f).tex)
- # If no PDF is requested, then just exit here.
-ifeq ($(pdf-build-final),)
- @echo
- @echo
- @echo "-----"
- @echo "Everything is OK until this point, but not building PDF."
- @echo "To do so, give a value to the 'pdf-build-final' variable."
- @echo "It is defined in 'reproduce/config/pipeline/pdf-build.mk'."
- @echo
- @exit 1
-endif
+ # If no PDF is requested, or if LaTeX isn't available, don't
+ # continue to building LaTeX.
+ @if ! latex --version &> /dev/null || [ x$(pdf-build-final) = x ]; then
+ echo
+ echo "-----"
+ echo "The processing has COMPLETED SUCCESSFULLY! But we won't be"
+ echo "building the final LaTeX-built PDF."
+ echo
+ echo "To do so, make sure you have LaTeX within the pipeline and"
+ echo "give a value to the 'pdf-build-final' variable. It is defined"
+ echo "in 'reproduce/config/pipeline/pdf-build.mk'."
+ echo
+ exit 1
+ fi
# Merge all the TeX macros that are prepared for building the PDF.
@cat $(mtexdir)/*.tex > $@
diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index 45a4192..dcc0b59 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -92,6 +92,7 @@ tarballs = $(foreach t, bash-$(bash-version).tar.gz \
lzip-$(lzip-version).tar.gz \
make-$(make-version).tar.lz \
tar-$(tar-version).tar.gz \
+ which-$(which-version).tar.gz \
xz-$(xz-version).tar.gz \
zlib-$(zlib-version).tar.gz \
, $(tdir)/$(t) )
@@ -111,6 +112,7 @@ $(tarballs): $(tdir)/%:
elif [ $$n = lzip ]; then w=http://download.savannah.gnu.org/releases/lzip; \
elif [ $$n = make ]; then w=http://akhlaghi.org/src; \
elif [ $$n = tar ]; then w=http://ftp.gnu.org/gnu/tar; \
+ elif [ $$n = which ]; then w=http://ftp.gnu.org/gnu/which; \
elif [ $$n = xz ]; then w=http://tukaani.org/xz; \
elif [ $$n = zlib ]; then w=http://www.zlib.net; \
else \
@@ -218,6 +220,14 @@ $(ibdir)/tar: $(tdir)/tar-$(tar-version).tar.gz \
+# GNU Which:
+$(ibdir)/which: $(tdir)/which-$(which-version).tar.gz
+ $(call gbuild,$(subst $(tdir)/,,$<), which-$(which-version), static)
+
+
+
+
+
# GNU Make: Unfortunately it 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
@@ -233,6 +243,7 @@ $(ibdir)/make: $(tdir)/make-$(make-version).tar.lz \
# GNU Bash
$(ibdir)/bash: $(tdir)/bash-$(bash-version).tar.gz \
+ $(ibdir)/which \
$(ibdir)/make
ifeq ($(static_build),yes)
$(call gbuild,$(subst $(tdir)/,,$<), bash-$(bash-version), , \
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk
index 70b0a9e..fe5fb19 100644
--- a/reproduce/src/make/dependencies.mk
+++ b/reproduce/src/make/dependencies.mk
@@ -32,6 +32,7 @@
# Top level environment
include reproduce/config/pipeline/LOCAL.mk
include reproduce/src/make/dependencies-build-rules.mk
+include reproduce/config/pipeline/dependency-texlive.mk
include reproduce/config/pipeline/dependency-versions.mk
ddir = $(BDIR)/dependencies
@@ -42,7 +43,7 @@ ildir = $(BDIR)/dependencies/installed/lib
# Define the top-level programs to build (installed in `.local/bin', so for
# Coreutils, only one of its executables is enough).
-top-level-programs = ls gawk gs grep libtool sed git tex astnoisechisel
+top-level-programs = ls gawk gs grep libtool sed git latex astnoisechisel
all: $(foreach p, $(top-level-programs), $(ibdir)/$(p))
# Other basic environment settings.
@@ -226,7 +227,7 @@ $(ibdir)/gs: $(tdir)/ghostscript-$(ghostscript-version).tar.gz \
$(call gbuild,$(subst $(tdir)/,,$<), ghostscript-$(ghostscript-version))
$(ibdir)/git: $(tdir)/git-$(git-version).tar.xz \
- $(ibdir)/ls
+ $(ibdir)/ls
$(call gbuild,$(subst $(tdir)/,,$<), git-$(git-version), static)
$(ibdir)/astnoisechisel: $(tdir)/gnuastro-$(gnuastro-version).tar.lz \
@@ -242,21 +243,74 @@ $(ibdir)/astnoisechisel: $(tdir)/gnuastro-$(gnuastro-version).tar.lz \
static, --enable-static=yes --enable-shared=no, -j8, \
make check -j8)
-$(ibdir)/tex:
-
- # First we'll download the tarball. Note that since the most recent
- # installer is downloaded by day, the installer's version is hard
- # to configure at this stage.
- #wget -O$(tdir)/install-tl-unx.tar.gz \
- # http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
+$(ibdir)/latex: reproduce/config/pipeline/dependency-texlive.mk
- # Unpack, enter the directory and run the installer.
+ # We'll need the current directory later down.
topdir=$$(pwd)
- cd $(ddir)
- tar xf $(tdir)/install-tl-unx.tar.gz
- cd install-tl-*
- sed -e's|@installdir[@]|$(idir)|g' -e's|@topdir[@]|'"$$topdir"'|g' \
- $$topdir/reproduce/config/pipeline/texlive.conf > texlive.conf
- ./install-tl --profile=texlive.conf
- cd ..
- rm -rf install-tl-*
+
+ # First, if necessary, we'll download the tarball. Note that since
+ # a new version of the installer is created every day, the
+ # installer's version is hard to configure at this stage and is
+ # mostly irrelevant.
+ if $(ibdir)/tlmgr --version &> /dev/null; then
+ echo "TeX Live manager ('tlmgr') is already installed."
+ else
+ if wget -O$(tdir)/install-tl-unx.tar.gz \
+ http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
+ then
+ # Unpack, enter the directory, and do a basic installation.
+ cd $(ddir)
+ rm -rf install-tl-*
+ tar xf $(tdir)/install-tl-unx.tar.gz
+ cd install-tl-*
+ sed -e's|@installdir[@]|$(idir)|g' -e's|@topdir[@]|'"$$topdir"'|g' \
+ $$topdir/reproduce/config/pipeline/texlive.conf > texlive.conf
+ ./install-tl --profile=texlive.conf
+ cd ..
+ rm -rf install-tl-*
+
+ # Put a symbolic link of the TeX Live executables in
+ # `ibdir'. For `latex' do a copy, because it is the target of
+ # this rule and it won't cause problems.
+ ln -fs $(idir)/texlive/20*/bin/*/* $(ibdir)/
+ rm $@
+ cp $(idir)/texlive/20*/bin/*/latex $@
+ else
+ echo "Not able to download TeX Live installer" > $@
+ fi
+ fi
+
+ # In scenarios like having no internet on the first run, its
+ # possible to get to this point without actually having `tlmgr'
+ # ready for usage. Since the pipeline can still do its processing
+ # without building the final PDF, we don't want to stop the build.
+ if $(ibdir)/tlmgr --version &> /dev/null; then
+
+ # Install all the extra necessary packages. If LaTeX complains
+ # about not finding a package, simply run the following command
+ # to find which package its in, then add it to the
+ # `texlive-packages' variable.
+ #
+ # tlmgr info XXXXXX.sty
+ tlmgr install $(texlive-packages)
+
+ # Make a symbolic link of all the TeX Live executables in the bin
+ # directory so we don't have to modify `PATH'.
+ ln -fs $(idir)/texlive/20*/bin/*/* $(ibdir)/
+
+ # Get all the necessary versions.
+ tv=$(ddir)/texlive-versions.tex
+ texlive=$$(pdflatex --version | awk 'NR==1' | sed 's/.*(\(.*\))/\1/' \
+ | awk '{print $$NF}');
+ echo "\newcommand{\\texliveversion}{$$texlive}" > $$tv
+
+ # LaTeX Package versions.
+ tlmgr info $(texlive-packages) --only-installed | awk \
+ '$$1=="package:" {version=0; \
+ if($$NF=="tex-gyre") name="texgyre"; \
+ else name=$$NF} \
+ $$1=="cat-version:" {version=$$NF} \
+ $$1=="cat-date:" {if(version==0) version=$$2; \
+ printf("\\newcommand{\\tex%sversion}{%s}\n",\
+ name, version)}' >> $$tv
+ fi
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index 943efdd..9639c79 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -72,10 +72,10 @@ curdir := $(shell echo $$(pwd))
.ONESHELL:
.SHELLFLAGS = -ec
SHELL := .local/bin/bash
+PATH := $(curdir)/.local/bin
LD_LIBRARY_PATH := $(curdir)/.local/lib
LDFLAGS := -L$(curdir)/.local/lib
CPPFLAGS := -I$(curdir)/.local/include
-PATH := $(curdir)/.local/bin:$(shell ls -d $$(pwd)/.local/texlive/2018/bin/*)
@@ -208,6 +208,7 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
$(call pvcheck, make, $(make-version), GNU Make, makeversion)
$(call pvcheck, sed, $(sed-version), GNU SED, sedversion)
$(call pvcheck, tar, $(tar-version), GNU Tar, tarversion)
+ $(call pvcheck, which, $(which-version), GNU Which, whichversion)
$(call pvcheck, xz, $(xz-version), XZ Utils, xzversion)
# Bzip2 prints its version in standard error, not standard output!
@@ -233,3 +234,6 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
$(call lvcheck, wcslib/wcsconfig.h, $(wcslib-version), WCSLIB, \
wcslibversion)
$(call lvcheck, zlib.h, $(zlib-version), zlib, zlibversion)
+
+ # TeX versions
+ cat $(BDIR)/dependencies/texlive-versions.tex >> $@
diff --git a/reproduce/src/make/paper.mk b/reproduce/src/make/paper.mk
index aec29c7..79d7722 100644
--- a/reproduce/src/make/paper.mk
+++ b/reproduce/src/make/paper.mk
@@ -38,9 +38,6 @@
$(texbdir)/paper.bbl: tex/references.tex \
| $(tikzdir) $(texbdir) tex/pipeline.tex
- # To find LaTeX (which currently isn't internally installed).
- #PATH=$(sys-path)
-
# We'll run LaTeX first to generate the `.bcf' file (necessary for
# `biber') and then run `biber' to generate the `.bbl' file.
p=$$(pwd);
@@ -64,9 +61,6 @@ $(texbdir)/paper.bbl: tex/references.tex \
paper.pdf: tex/pipeline.tex paper.tex $(texbdir)/paper.bbl \
| $(tikzdir) $(texbdir)
- # To find LaTeX (which currently isn't internally installed).
- #PATH=$(sys-path)
-
# Go into the top TeX build directory and make the paper.
p=$$(pwd)
export TEXINPUTS=$$p:$$TEXINPUTS