diff options
Diffstat (limited to 'reproduce/src')
-rw-r--r-- | reproduce/src/make/dependencies.mk | 43 | ||||
-rw-r--r-- | reproduce/src/make/initialize.mk | 92 | ||||
-rw-r--r-- | reproduce/src/make/paper.mk | 6 |
3 files changed, 121 insertions, 20 deletions
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index 4610226..80a787e 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -43,7 +43,7 @@ ildir = $(BDIR)/dependencies/installed/lib ilidir = $(BDIR)/dependencies/installed/lib/built # Define the top-level programs to build (installed in `.local/bin'). -top-level-programs = astnoisechisel metastore flock +top-level-programs = astnoisechisel metastore flock zip unzip all: $(ddir)/texlive-versions.tex \ $(foreach p, $(top-level-programs), $(ibdir)/$(p)) @@ -90,19 +90,21 @@ export LDFLAGS := $(rpath_command) -L$(ildir) tarballs = $(foreach t, cfitsio-$(cfitsio-version).tar.gz \ cmake-$(cmake-version).tar.gz \ curl-$(curl-version).tar.gz \ - flock-$(flock-version).tar.xz \ - ghostscript-$(ghostscript-version).tar.gz \ - git-$(git-version).tar.xz \ - gnuastro-$(gnuastro-version).tar.lz \ - gsl-$(gsl-version).tar.gz \ + flock-$(flock-version).tar.xz \ + ghostscript-$(ghostscript-version).tar.gz \ + git-$(git-version).tar.xz \ + gnuastro-$(gnuastro-version).tar.lz \ + gsl-$(gsl-version).tar.gz \ install-tl-unx.tar.gz \ - jpegsrc.$(libjpeg-version).tar.gz \ - libbsd-$(libbsd-version).tar.xz \ + jpegsrc.$(libjpeg-version).tar.gz \ + libbsd-$(libbsd-version).tar.xz \ libtool-$(libtool-version).tar.xz \ libgit2-$(libgit2-version).tar.gz \ metastore-$(metastore-version).tar.gz \ + unzip-$(unzip-version).tar.gz \ tiff-$(libtiff-version).tar.gz \ - wcslib-$(wcslib-version).tar.bz2 \ + zip-$(zip-version).tar.gz \ + wcslib-$(wcslib-version).tar.bz2 \ , $(tdir)/$(t) ) $(tarballs): $(tdir)/%: if [ -f $(DEPENDENCIES-DIR)/$* ]; then @@ -140,7 +142,13 @@ $(tarballs): $(tdir)/%: w=https://github.com/libgit2/libgit2/archive/v$(libgit2-version).tar.gz elif [ $$n = metastore ]; then w=http://akhlaghi.org/src elif [ $$n = tiff ]; then w=https://download.osgeo.org/libtiff + elif [ $$n = unzip ]; then w=ftp://ftp.info-zip.org/pub/infozip/src + mergenames=0; v=$$(echo $(unzip-version) | sed -e's/\.//') + w=ftp://ftp.info-zip.org/pub/infozip/src/unzip$$v.tgz elif [ $$n = wcslib ]; then w=ftp://ftp.atnf.csiro.au/pub/software/wcslib + elif [ $$n = zip ]; then + mergenames=0; v=$$(echo $(zip-version) | sed -e's/\.//') + w=ftp://ftp.info-zip.org/pub/infozip/src/zip$$v.tgz else echo; echo; echo; echo "'$$n' not recognized as a dependency name to download." @@ -438,6 +446,23 @@ endif $$staticopts, -j$(numthreads), \ make check -j$(numthreads)) +$(ibdir)/unzip: $(tdir)/unzip-$(unzip-version).tar.gz + v=$$(echo $(unzip-version) | sed -e's/\.//') + $(call gbuild, $<, unzip$$v, static,, \ + -f unix/Makefile generic_gcc \ + CFLAGS="-DBIG_MEM -DMMAP",,pwd, \ + -f unix/Makefile \ + BINDIR=$(ibdir) MANDIR=$(idir)/man/man1 ) + +$(ibdir)/zip: $(tdir)/zip-$(zip-version).tar.gz + v=$$(echo $(zip-version) | sed -e's/\.//') + $(call gbuild, $<, zip$$v, static,, \ + -f unix/Makefile generic_gcc \ + CFLAGS="-DBIG_MEM -DMMAP",,pwd, \ + -f unix/Makefile \ + BINDIR=$(ibdir) MANDIR=$(idir)/man/man1 ) + + diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk index 57565b9..b3180e3 100644 --- a/reproduce/src/make/initialize.mk +++ b/reproduce/src/make/initialize.mk @@ -158,10 +158,15 @@ $(mtexdir) $(texbdir): | $(texdir); mkdir $@ # we want to ensure that the file is always built in every run: it contains # the pipeline version which may change between two separate runs, even # when no file actually differs. -.PHONY: all clean distclean clean-mmap $(mtexdir)/initialize.tex +packagebasename := $(shell echo paper-$$(git describe --dirty --always)) +packagecontents = $(texdir)/$(packagebasename) +.PHONY: all clean distclean clean-mmap tarball zip $(packagecontents) \ + $(mtexdir)/initialize.tex + # --------- Delete for no Gnuastro --------- clean-mmap:; rm -f reproduce/config/gnuastro/mmap* # ------------------------------------------ + clean: clean-mmap # Delete the top-level PDF file. rm -f *.pdf @@ -173,6 +178,7 @@ clean: clean-mmap # are using afterwards. shopt -s extglob rm -rf $(BDIR)/!(dependencies) + distclean: clean # We'll be deleting the built environent programs and just need the # `rm' program. So for this recipe, we'll use the host system's @@ -185,13 +191,75 @@ distclean: clean +# Packaging rules +# --------------- +# +# With the rules in this section, you can package the project in a state +# that is ready for building the final PDF with LaTeX. This is useful for +# collaborators who only want to contribute to the text of your project, +# without having to worry about the technicalities of the analysis. +$(packagecontents): | $(texdir) + + # Set up the output directory, delete it if it exists and remake it + # to fill with new contents. + dir=$(texdir)/$(packagebasename) + rm -rf $$dir + mkdir $$dir + + # Copy the top-level contents into it. + cp configure COPYING for-group README.md README-hacking.md $$dir/ + + # Since the tarball is mainly intended for high-level building of + # the PDF with LaTeX, we'll comment the `makepdf' LaTeX macro in + # the paper. + sed -e's|\\newcommand{\\makepdf}{}|%\\newcommand{\\makepdf}{}|' \ + paper.tex > $$dir/paper.tex + + # Copy all the `reproduce' contents except for the `build' symbolic + # link. + shopt -s extglob + mkdir $$dir/reproduce $$dir/tex $$dir/tex/tikz + cp tex/*.tex $$dir/tex + cp -r reproduce/!(build) $$dir/reproduce + cp tex/tikz/*.pdf $$dir/tex/tikz + + # PIPELINE SPECIFIC: add or remove any of the copied files above, + # specific to your pipeline here. + + # Clean all temporary files. + cd $(texdir) + find $(packagebasename) -name \*~ -delete + +# Package into `.tar.gz'. +tarball: $(packagecontents) + curdir=$$(pwd) + cd $(texdir) + tar -cf $(packagebasename).tar $(packagebasename) + gzip -f --best $(packagebasename).tar + cd $$curdir + mv $(texdir)/$(packagebasename).tar.gz ./ + +# Package into `.zip'. +zip: $(packagecontents) + curdir=$$(pwd) + cd $(texdir) + zip -q -r $(packagebasename).zip $(packagebasename) + cd $$curdir + mv $(texdir)/$(packagebasename).zip ./ + + + + + # Check the version of programs which write their version # ------------------------------------------------------- pvcheck = prog="$(strip $(1))"; \ ver="$(strip $(2))"; \ name="$(strip $(3))"; \ macro="$(strip $(4))"; \ - v=$$($$prog --version | awk '/'$$ver'/{print "y"; exit 0}'); \ + verop="$(strip $(5))"; \ + if [ "x$$verop" = x ]; then V="--version"; else V=$$verop; fi; \ + v=$$($$prog $$V | awk '/'$$ver'/{print "y"; exit 0}'); \ if [ x$$v != xy ]; then \ echo; echo "PIPELINE ERROR: Not running $$name $$ver"; echo; \ exit 1; \ @@ -228,7 +296,12 @@ $(mtexdir)/initialize.tex: | $(mtexdir) echo "\newcommand{\pipelineversion}{$$v}" > $@ @echo "\newcommand{\bdir}{$(BDIR)}" >> $@ - # Versions of programs (same order as 'dependency-versions.mk'). + # Versions of programs (same order as 'dependency-versions.mk'), + # ordered alphabetically (by their executable name). + # --------- Delete for no Gnuastro --------- + $(call pvcheck, astnoisechisel, $(gnuastro-version), Gnuastro, \ + gnuastroversion) + # ------------------------------------------ $(call pvcheck, awk, $(gawk-version), GNU AWK, gawkversion) $(call pvcheck, bash, $(bash-version), GNU Bash, bashversion) $(call pvcheck, cmake, $(cmake-version), CMake, cmakeversion) @@ -237,12 +310,12 @@ $(mtexdir)/initialize.tex: | $(mtexdir) diffutilsversion) $(call pvcheck, find, $(findutils-version), GNU Findutils, \ findutilsversion) - $(call pvcheck, gs, $(ghostscript-version), GPL Ghostscript, \ - ghostscriptversion) $(call pvcheck, git, $(git-version), Git, gitversion) - $(call pvcheck, grep, $(grep-version), GNU Grep, grepversion) $(call pvcheck, glibtool, $(libtool-version), GNU Libtool, \ libtoolversion) + $(call pvcheck, grep, $(grep-version), GNU Grep, grepversion) + $(call pvcheck, gs, $(ghostscript-version), GPL Ghostscript, \ + ghostscriptversion) $(call pvcheck, gzip, $(gzip-version), GNU Gzip, gzipversion) $(call pvcheck, ls, $(coreutils-version), GNU Coreutils, \ coreutilsversion) @@ -254,14 +327,11 @@ $(mtexdir)/initialize.tex: | $(mtexdir) pkgconfigversion) $(call pvcheck, sed, $(sed-version), GNU SED, sedversion) $(call pvcheck, tar, $(tar-version), GNU Tar, tarversion) + $(call pvcheck, unzip, $(unzip-version), Unzip, unzipversion, -v) $(call pvcheck, wget, $(wget-version), GNU Wget, wgetversion) $(call pvcheck, which, $(which-version), GNU Which, whichversion) $(call pvcheck, xz, $(xz-version), XZ Utils, xzversion) - - # --------- Delete for no Gnuastro --------- - $(call pvcheck, astnoisechisel, $(gnuastro-version), Gnuastro, \ - gnuastroversion) - # ------------------------------------------ + $(call pvcheck, zip, $(zip-version), Zip, zipversion, -v) # Bzip2 prints its version in standard error, not standard output! echo "" | bzip2 --version &> $@_bzip2_ver; diff --git a/reproduce/src/make/paper.mk b/reproduce/src/make/paper.mk index 17d59bf..aea6c60 100644 --- a/reproduce/src/make/paper.mk +++ b/reproduce/src/make/paper.mk @@ -126,6 +126,12 @@ paper.pdf: tex/pipeline.tex paper.tex $(texbdir)/paper.bbl \ @macros=$$(cat tex/pipeline.tex) if [ x"$$macros" != x ]; then + # If it doesn't exist, make the `tex/tikz' symbolic link + # directory. This is necessary for situations when we just want + # TeX to use built figures instead of actually building the + # figures. + if [ ! -e tex/tikz ]; then ln -s $(tikzdir) tex/tikz; fi + # Go into the top TeX build directory and make the paper. p=$$(pwd) export TEXINPUTS=$$p:$$TEXINPUTS |