diff options
Diffstat (limited to 'reproduce/src/make')
-rw-r--r-- | reproduce/src/make/Top-Makefile | 33 | ||||
-rw-r--r-- | reproduce/src/make/dependencies.mk | 122 | ||||
-rw-r--r-- | reproduce/src/make/paper.mk | 43 |
3 files changed, 116 insertions, 82 deletions
diff --git a/reproduce/src/make/Top-Makefile b/reproduce/src/make/Top-Makefile index abd0f45..4c547be 100644 --- a/reproduce/src/make/Top-Makefile +++ b/reproduce/src/make/Top-Makefile @@ -93,19 +93,30 @@ tex/pipeline.tex: $(foreach f, initialize \ , $(mtexdir)/$(f).tex) # 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 + # continue to building the final PDF. Otherwise, merge all the TeX + # macros into one for building the PDF. + @if [ -f .local/bin/pdflatex ] && [ x"$(pdf-build-final)" != x ]; then + cat $(mtexdir)/*.tex > $@ + else echo echo "-----" - echo "The processing has COMPLETED SUCCESSFULLY! But we won't be" - echo "building the final LaTeX-built PDF." + echo "The processing has COMPLETED SUCCESSFULLY! But the final " + echo "LaTeX-built PDF paper will not be built." 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'." + if [ x$(more-on-building-pdf) = x1 ]; then + echo "To do so, make sure you have LaTeX within the pipeline (you" + echo "can check by running './.local/bin/latex --version'), _AND_" + echo "make sure that the 'pdf-build-final' variable has a value." + echo "'pdf-build-final' is defined in: " + echo "'reproduce/config/pipeline/pdf-build.mk'." + echo + echo "If you don't have LaTeX within the pipeline, please re-run" + echo "'./configure' when you have internet access. To speed it up," + echo "you can keep the previous configuration files (answer 'n'" + echo "when it asks about re-writing previous configuration files)." + else + echo "For more, run './.local/bin/make more-on-building-pdf=1'" + fi echo - exit 1 + echo "" > $@ fi - - # Merge all the TeX macros that are prepared for building the PDF. - @cat $(mtexdir)/*.tex > $@ diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index 768bafb..455a3b8 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -270,56 +270,70 @@ endif # Since we want to avoid complicating the PATH, we are putting a symbolic -# link of all the TeX Live executables in $(ibdir). Therefore, since the -# symbolic link is hard to track for Make (as a target), we'll make a -# simple ASCII file called `texlive-ready' when it is complete and use that -# as a target. -$(ibdir)/texlive-ready: reproduce/config/pipeline/dependency-texlive.mk - - # We'll need the current directory later down. - topdir=$$(pwd) - - # 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 \ +# link of all the TeX Live executables in $(ibdir). But symbolic links are +# hard to track for Make (as a target). So we'll make a simple ASCII file +# called `texlive-ready' when it is complete and use that as a target. +$(ibdir)/texlive-ready-tlmgr: reproduce/config/pipeline/texlive.conf + + # To work with TeX live installation, we'll need the internet. + if ping -c1 ctan.org; then + # Download the TeX Live installation tarball. + $(DOWNLOADER) $(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-* $(tdir)/install-tl-unx.tar.gz - - # 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)/ - fi + + # Unpack, enter the directory, and install based on the given + # configuration (prerequisite of this rule). + topdir=$$(pwd) + 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/$< > texlive.conf + ./install-tl --profile=texlive.conf + + # Put a symbolic link of the TeX Live executables in `ibdir'. The + # main problem is that the year and build system (for example + # `x86_64-linux') are also in the directory names, making it hard + # to be generic. We are using wildcards here, but only in this + # Makefile, not in any other. + ln -fs $(idir)/texlive/20*/bin/*/* $(ibdir)/ + + # Clean up and build the final target. + cd .. && rm -rf install-tl-* $(tdir)/install-tl-unx.tar.gz + echo "TeX Live is ready." > $@ 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 + + + + +# To keep things modular and simple, we'll break up the installation of TeX +# Live itself (only very basic TeX and LaTeX) and the installation of its +# necessary packages into two packages. +$(ibdir)/texlive-ready: reproduce/config/pipeline/dependency-texlive.mk \ + $(ibdir)/texlive-ready-tlmgr + + # To work with TeX live installation, we'll need the internet. + res=$(cat $(ibdir)/texlive-ready-tlmgr) + if ping -c1 ctan.org \ + && [ -f $(ibdir)/texlive-ready-tlmgr ] \ + && [ x$$res != x"NOT" ]; then + # The current directory is necessary later. + topdir=$$(pwd) # 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. + # about not finding a command/file/what-ever/XXXXXX, simply run + # the following command to find which package its in, then add it + # to the `texlive-packages' variable of the first prerequisite. + # + # ./.local/bin/tlmgr info XXXXXX # - # tlmgr info XXXXXX.sty + # We are putting a notice, because if there is no internet, + # `tlmgr' just hangs waiting. + echo; echo; echo "Downloading necessary TeX packages..."; echo; tlmgr install $(texlive-packages) + echo "returned: $$?"; echo; echo; # Make a symbolic link of all the TeX Live executables in the bin # directory so we don't have to modify `PATH'. @@ -333,16 +347,14 @@ $(ibdir)/texlive-ready: reproduce/config/pipeline/dependency-texlive.mk # 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 + '$$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 + + # Write the target if TeX live was actually installed. + echo "TeX Live's packages are also ready." > $@ fi - - # Write the target if TeX live was actually installed. - if [ -f $(idir)/texlive/20*/bin/*/latex ]; then - echo "TeX Live is installed." > $@ - fi; diff --git a/reproduce/src/make/paper.mk b/reproduce/src/make/paper.mk index 79d7722..d50c59a 100644 --- a/reproduce/src/make/paper.mk +++ b/reproduce/src/make/paper.mk @@ -37,14 +37,19 @@ # PDF. $(texbdir)/paper.bbl: tex/references.tex \ | $(tikzdir) $(texbdir) tex/pipeline.tex + # If `tex/pipeline.tex' is empty, then the PDF must not be built. + @macros=$$(cat tex/pipeline.tex) + if [ x"$$macros" != x ]; then - # We'll run LaTeX first to generate the `.bcf' file (necessary for - # `biber') and then run `biber' to generate the `.bbl' file. - p=$$(pwd); - export TEXINPUTS=$$p:$$TEXINPUTS; - cd $(texbdir); - pdflatex -shell-escape -halt-on-error $$p/paper.tex; - biber paper + # We'll run LaTeX first to generate the `.bcf' file (necessary + # for `biber') and then run `biber' to generate the `.bbl' file. + p=$$(pwd); + export TEXINPUTS=$$p:$$TEXINPUTS; + cd $(texbdir); + pdflatex -shell-escape -halt-on-error $$p/paper.tex; + biber paper + + fi @@ -61,13 +66,19 @@ $(texbdir)/paper.bbl: tex/references.tex \ paper.pdf: tex/pipeline.tex paper.tex $(texbdir)/paper.bbl \ | $(tikzdir) $(texbdir) - # Go into the top TeX build directory and make the paper. - p=$$(pwd) - export TEXINPUTS=$$p:$$TEXINPUTS - cd $(texbdir) - pdflatex -shell-escape -halt-on-error $$p/paper.tex + # If `tex/pipeline.tex' is empty, then the PDF must not be built. + @macros=$$(cat tex/pipeline.tex) + if [ x"$$macros" != x ]; then + + # Go into the top TeX build directory and make the paper. + p=$$(pwd) + export TEXINPUTS=$$p:$$TEXINPUTS + cd $(texbdir) + pdflatex -shell-escape -halt-on-error $$p/paper.tex + + # Come back to the top pipeline directory and copy the built PDF + # file here. + cd $$p + cp $(texbdir)/$@ $@ - # Come back to the top pipeline directory and copy the built PDF - # file here. - cd $$p - cp $(texbdir)/$@ $@ + fi |