aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-18 19:45:46 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-18 19:49:13 +0000
commit6a9990b5a4d13d7628902b0dc067c74e782922de (patch)
tree58411b1eb165fb18c18fb8386b82076682409915
parentb15818ddc06d499bac1bac5640682d40901e9588 (diff)
Pipeline also installs TeX live and necessary packages
Since the final product of the pipeline is a LaTeX-created PDF file, it was necessary to also have LaTeX within the pipeline. With this commit, TeX Live is also built as part of the configuration and all the necessary packages to build the PDF are also installed and mentioned in the paper along with their versions.
-rwxr-xr-xconfigure7
-rw-r--r--paper.tex34
-rw-r--r--reproduce/config/pipeline/dependency-texlive.mk14
-rw-r--r--reproduce/config/pipeline/dependency-versions.mk1
-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
-rw-r--r--tex/preamble-necessary.tex1
10 files changed, 143 insertions, 52 deletions
diff --git a/configure b/configure
index 5f21e04..0663e15 100755
--- a/configure
+++ b/configure
@@ -145,6 +145,7 @@ if [ -f $pconf ] || [ -f $glconf ]; then
do
read -p"Re-write existing configuration file(s) (y/n)? " userread
done
+ userread=n
# Set `rewriteconfig'.
if [ $userread = "n" ]; then
@@ -408,8 +409,8 @@ ln -s $(pwd)/reproduce/config/gnuastro .gnuastro
# See if the C compiler can build static libraries
# ------------------------------------------------
-oprog=$ddir/static-test
-cprog=$ddir/static-test.c
+oprog=$depdir/static-test
+cprog=$depdir/static-test.c
echo "#include <stdio.h>" > $cprog
echo "int main(void) {return 0;}" >> $cprog
if [ x$CC = x ]; then CC=gcc; fi;
@@ -452,7 +453,7 @@ fi
# Inform the user that the build process is starting
# -------------------------------------------------
-tsec=0
+tsec=10
cat <<EOF
-------------------------
diff --git a/paper.tex b/paper.tex
index f37ec6e..39c63f3 100644
--- a/paper.tex
+++ b/paper.tex
@@ -178,18 +178,28 @@ SUNDIAL ITN, and from the Spanish Ministry of Economy and Competitiveness
(MINECO) under grant number AYA2016-76219-P.
The following free software tools were also critical component of this
-research (in alphabetical order): Bzip2 \bziptwoversion, {\small CFITSIO}
-\cfitsioversion, CMake \cmakeversion, c{\small URL} \curlversion, Git
-\gitversion, \gnu{Bash} \bashversion, \gnu{Binutils} \binutilsversion,
-\gnu{Coreutils} \coreutilsversion, \gnu{{\small AWK}} \gawkversion,
-\gnu{Grep} \grepversion, \gnu{Libtool} \libtoolversion, \gnu{Make}
-\makeversion, \gnu{Sed} \sedversion, \gnu{Scientific Library} ({\small
- GSL}) \gslversion, \gnu{Tar} \tarversion, Lzip \lzipversion, {\small GPL}
-Ghostscript \ghostscriptversion, Libgit2 \libgitwoversion, Libtiff
-\libtiffversion, {{\small WCSLIB}} \wcslibversion, {\small XZ} Utils
-\xzversion, and ZLib \zlibversion. We are very grateful to all their
-creators for freely providing this necessary infrastructure. This research
-would not be possible without them.
+research (in alphabetical order): Bzip2 \bziptwoversion, CFITSIO
+\cfitsioversion, CMake \cmakeversion, cURL \curlversion, Git \gitversion,
+GNU Bash \bashversion, GNU Binutils \binutilsversion, GNU Coreutils
+\coreutilsversion, GNU AWK \gawkversion, GNU Grep \grepversion, GNU Libtool
+\libtoolversion, GNU Make \makeversion, GNU Sed \sedversion, GNU Scientific
+Library (GSL) \gslversion, GNU Tar \tarversion, GNU Which \whichversion,
+Lzip \lzipversion, GPL Ghostscript \ghostscriptversion, Libgit2
+\libgitwoversion, Libtiff \libtiffversion, WCSLIB \wcslibversion, XZ Utils
+\xzversion, and ZLib \zlibversion. The final paper was produced with \TeX{}
+Live \texliveversion, using the following packages: \TeX{} \textexversion,
+EC \texecversion, NewTX \texnewtxversion, Fontaxes \texfontaxesversion,
+Keyval, \texxkeyvalversion, Etoolbox \texetoolboxversion, Xcolor
+\texxcolorversion, Setspace \texsetspaceversion, Caption
+\texcaptionversion, Footmisc \texfootmiscversion, Datetime
+\texdatetimeversion, Fmtcount \texfmtcountversion, Titlesec
+\textitlesecversion, Preprint \texpreprintversion, Ulem \texulemversion,
+Bib\LaTeX{} \texbiblatexversion, Biber \texbiberversion, Logreq
+\texlogreqversion, PGF/TiKZ \texpgfversion, PGFPlots \texpgfplotsversion,
+FP \texfpversion, Courier \texcourierversion, \TeX-gyre \textexgyreversion,
+TXFonts \textxfontsversion, Times \textimesversion. We are very grateful to
+all their creators for freely providing this necessary infrastructure. This
+research would not be possible without them.
%% Tell BibLaTeX to put the bibliography list here.
\printbibliography
diff --git a/reproduce/config/pipeline/dependency-texlive.mk b/reproduce/config/pipeline/dependency-texlive.mk
new file mode 100644
index 0000000..9d7365f
--- /dev/null
+++ b/reproduce/config/pipeline/dependency-texlive.mk
@@ -0,0 +1,14 @@
+# Necessary packages to install in TeX Live.
+#
+# If any extra TeX package is necessary to build your paper, just add its
+# name to this variable (you can check in `ctan.org' to find the official
+# name).
+#
+# Note on `tex' and `fancyhdr': These two packages are installed along with
+# the basic installation scheme that we used to install tlmgr, they will be
+# ignored in the `tlmgr install' command, but will be used later when we
+# want their versions.
+texlive-packages = tex fancyhdr ec newtx fontaxes xkeyval etoolbox xcolor \
+ setspace caption footmisc datetime fmtcount titlesec \
+ preprint ulem biblatex biber logreq pgf pgfplots fp \
+ courier tex-gyre txfonts times
diff --git a/reproduce/config/pipeline/dependency-versions.mk b/reproduce/config/pipeline/dependency-versions.mk
index c123f55..07f755c 100644
--- a/reproduce/config/pipeline/dependency-versions.mk
+++ b/reproduce/config/pipeline/dependency-versions.mk
@@ -17,6 +17,7 @@ lzip-version = 1.20
make-version = 4.2.90
sed-version = 4.5
tar-version = 1.30
+which-version = 2.21
xz-version = 5.2.4
# Libraries
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
diff --git a/tex/preamble-necessary.tex b/tex/preamble-necessary.tex
index 329352a..bef5a2f 100644
--- a/tex/preamble-necessary.tex
+++ b/tex/preamble-necessary.tex
@@ -11,7 +11,6 @@
% Macros for to help in typing, remove them if you don't need them, but
% this can help as a demo on how you can simply writing of commonly used
% words that need special formatting (like software names).
-\newcommand{\gnu}[1]{{\small GNU} #1}
\newcommand{\snsign}{{\small S}/{\small N}}
\newcommand{\originsoft}{\textsf{ORIGIN}}
\newcommand{\sextractor}{\textsf{SE\-xtractor}}