From a25c2cf65c78fd504ec3cbf6f007b4011ba248a1 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Wed, 28 Nov 2018 01:24:42 +0000 Subject: Better control of shared library linking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now we weren't explicity writing the full path of the dynamic libraries necessary for linking a program. But now with `-Wl,-rpath=$(ildir)' we ensure that the linker keeps the address of the dynamic libraries necessary for linking at linking time, not running time. Also, `pkg-config' is also built when preparing the basics. Several other minor corrections were made thanks to the great help of Raúl Infante Sainz. --- paper.tex | 32 ++++++++++++------------ reproduce/config/pipeline/dependency-versions.mk | 3 ++- reproduce/src/make/dependencies-basic.mk | 28 ++++++++++++++++----- reproduce/src/make/dependencies-build-rules.mk | 1 - reproduce/src/make/dependencies.mk | 30 ++++++++++++---------- reproduce/src/make/initialize.mk | 23 +++++++++-------- 6 files changed, 70 insertions(+), 47 deletions(-) diff --git a/paper.tex b/paper.tex index 6aa30bd..3388ece 100644 --- a/paper.tex +++ b/paper.tex @@ -210,22 +210,22 @@ research (in alphabetical order): Bzip2 \bziptwoversion, CFITSIO 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. +Libgit2 \libgitwoversion, Libtiff \libtiffversion, Pkg-config +\pkgconfigversion, 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-versions.mk b/reproduce/config/pipeline/dependency-versions.mk index 9c6f18f..ca18f8b 100644 --- a/reproduce/config/pipeline/dependency-versions.mk +++ b/reproduce/config/pipeline/dependency-versions.mk @@ -11,12 +11,13 @@ flock-version = 0.2.3 gawk-version = 4.2.1 ghostscript-version = 9.26 git-version = 2.19.1 -gnuastro-version = 0.7.65-ff7a +gnuastro-version = 0.7.66-0ad3 grep-version = 3.1 gzip-version = 1.9.10-051e libtool-version = 2.4.6 lzip-version = 1.20 make-version = 4.2.90 +pkgconfig-version = 0.29.2 sed-version = 4.5 tar-version = 1.30 which-version = 2.21 diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk index a3d679e..196d457 100644 --- a/reproduce/src/make/dependencies-basic.mk +++ b/reproduce/src/make/dependencies-basic.mk @@ -55,12 +55,14 @@ syspath := $(PATH) # As we build more programs, we want to use our own pipeline's built # programs and libraries, not the host's. -PATH := $(ibdir):$(PATH) -LDFLAGS := -L$(ildir) $(LDFLAGS) -CPPFLAGS := -I$(idir)/include $(CPPFLAGS) -LD_LIBRARY_PATH := $(ildir):$(LD_LIBRARY_PATH) - -top-level-programs = bash which ls sed gawk grep diff find +export PATH := $(ibdir):$(PATH) +export PKG_CONFIG_PATH := $(ildir)/pkgconfig +export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig +export LDFLAGS := -L$(ildir) $(LDFLAGS) +export CPPFLAGS := -I$(idir)/include $(CPPFLAGS) +export LD_LIBRARY_PATH := $(ildir):$(LD_LIBRARY_PATH) + +top-level-programs = bash which ls sed gawk grep diff find pkg-config all: $(foreach p, $(top-level-programs), $(ibdir)/$(p)) @@ -99,6 +101,7 @@ tarballs = $(foreach t, bash-$(bash-version).tar.gz \ gzip-$(gzip-version).tar.gz \ lzip-$(lzip-version).tar.gz \ make-$(make-version).tar.lz \ + pkg-config-$(pkgconfig-version).tar.gz \ sed-$(sed-version).tar.xz \ tar-$(tar-version).tar.gz \ which-$(which-version).tar.gz \ @@ -123,6 +126,7 @@ $(tarballs): $(tdir)/%: elif [ $$n = gzip ]; then w=http://akhlaghi.org/src; \ elif [ $$n = lzip ]; then w=http://download.savannah.gnu.org/releases/lzip; \ elif [ $$n = make ]; then w=http://akhlaghi.org/src; \ + elif [ $$n = pkg ]; then w=https://pkg-config.freedesktop.org/releases; \ elif [ $$n = sed ]; then w=http://ftp.gnu.org/gnu/sed; \ elif [ $$n = tar ]; then w=http://ftp.gnu.org/gnu/tar; \ elif [ $$n = which ]; then w=http://ftp.gnu.org/gnu/which; \ @@ -171,6 +175,13 @@ $(ibdir)/low-level: | $(ibdir) # The linker $(call makelink,ar) $(call makelink,ld) + $(call makelink,nm) + $(call makelink,ps) + + # On Mac OS, libtool is different compared to GNU Libtool. The + # libtool we'll build in the high-level dependencies has the + # executable name `glibtool'. + $(call makelink,libtool) # GNU Gettext (translate messages) $(call makelink,msgfmt) @@ -279,6 +290,11 @@ $(ibdir)/ls: $(tdir)/coreutils-$(coreutils-version).tar.xz \ $(ibdir)/make $(call gbuild, $<, coreutils-$(coreutils-version), static) +$(ibdir)/pkg-config: $(tdir)/pkg-config-$(pkgconfig-version).tar.gz \ + $(ibdir)/make + $(call gbuild, $<, pkg-config-$(pkgconfig-version), static, \ + --with-internal-glib) + $(ibdir)/sed: $(tdir)/sed-$(sed-version).tar.xz \ $(ibdir)/make $(call gbuild, $<, sed-$(sed-version), static) diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk index 7b3a419..c0561a7 100644 --- a/reproduce/src/make/dependencies-build-rules.mk +++ b/reproduce/src/make/dependencies-build-rules.mk @@ -53,7 +53,6 @@ gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ fi; \ check="$(6)"; \ if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \ - export SHELL=$(ibdir)/bash; \ cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) && \ ./configure $(4) --prefix=$(idir) && \ make $(5) && \ diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index c795b34..6f4aa78 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -51,12 +51,14 @@ all: $(foreach p, $(top-level-programs), $(ibdir)/$(p)) # compiler and linker. For the library binaries and headers, we are only # using our internally built libraries. .ONESHELL: -.SHELLFLAGS := -ec -PATH := $(ibdir) -LD_LIBRARY_PATH := $(ildir) -LDFLAGS := -L$(ildir) -SHELL := $(ibdir)/bash -CPPFLAGS := -I$(idir)/include +.SHELLFLAGS := -ec +export PATH := $(ibdir) +export LD_LIBRARY_PATH := $(ildir) +export SHELL := $(ibdir)/bash +export CPPFLAGS := -I$(idir)/include +export PKG_CONFIG_PATH := $(ildir)/pkgconfig +export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig +export LDFLAGS := -Wl,-rpath=$(ildir) -L$(ildir) @@ -183,15 +185,14 @@ $(ilidir)/gsl: $(tdir)/gsl-$(gsl-version).tar.gz | $(ilidir) $(ilidir)/libjpeg: $(tdir)/jpegsrc.$(libjpeg-version).tar.gz | $(ilidir) $(call gbuild, $<, jpeg-9b, static) && echo "Libjpeg is built" > $@ -$(ilidir)/libtiff: $(tdir)/tiff-$(libtiff-version).tar.gz | $(ilidir) +$(ilidir)/libtiff: $(tdir)/tiff-$(libtiff-version).tar.gz \ + $(ilidir)/libjpeg | $(ilidir) $(call gbuild, $<, tiff-$(libtiff-version), static) \ && echo "Libtiff is built" > $@ $(ilidir)/wcslib: $(tdir)/wcslib-$(wcslib-version).tar.bz2 \ $(ilidir)/cfitsio | $(ilidir) - # Unfortunately WCSLIB forces the building of shared libraries. So - # we'll allow it to finish, then remove the shared libraries - # afterwards. + # Unfortunately WCSLIB forces the building of shared libraries. $(call gbuild, $<, wcslib-$(wcslib-version), , \ LIBS="-pthread -lcurl -lm" --without-pgplot \ --disable-fortran) \ @@ -225,8 +226,11 @@ $(ibdir)/curl: $(tdir)/curl-$(curl-version).tar.gz \ $(ilidir)/zlib $(call gbuild, $<, curl-$(curl-version), static, --without-brotli) -$(ibdir)/libtool: $(tdir)/libtool-$(libtool-version).tar.xz - $(call gbuild, $<, libtool-$(libtool-version), static) +# On Mac OS, libtool does different things, so to avoid confusion, we'll +# prefix GNU's libtool executables with `glibtool'. +$(ibdir)/glibtool: $(tdir)/libtool-$(libtool-version).tar.xz + $(call gbuild, $<, libtool-$(libtool-version), static, \ + --program-prefix=g) $(ibdir)/gs: $(tdir)/ghostscript-$(ghostscript-version).tar.gz $(call gbuild, $<, ghostscript-$(ghostscript-version)) @@ -243,7 +247,7 @@ $(ibdir)/astnoisechisel: $(tdir)/gnuastro-$(gnuastro-version).tar.lz \ $(ibdir)/gs \ $(ilidir)/gsl \ $(ilidir)/wcslib \ - $(ibdir)/libtool \ + $(ibdir)/glibtool \ $(ilidir)/libjpeg \ $(ilidir)/libtiff \ $(ilidir)/libgit2 diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk index 3453d4e..9141b30 100644 --- a/reproduce/src/make/initialize.mk +++ b/reproduce/src/make/initialize.mk @@ -42,6 +42,7 @@ texbdir = $(texdir)/build tikzdir = $(texbdir)/tikz mtexdir = $(texdir)/macros pconfdir = reproduce/config/pipeline +installdir = $(BDIR)/dependencies/installed # --------- Delete for no Gnuastro --------- gconfdir = reproduce/config/gnuastro # ------------------------------------------ @@ -72,12 +73,12 @@ curdir := $(shell echo $$(pwd)) # environment variables, we are setting it to prefer the software we have # build here. .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 +.SHELLFLAGS = -ec +export PATH := $(installdir)/bin +export LD_LIBRARY_PATH := $(installdir)/lib +export LDFLAGS := -L$(installdir)/lib +export SHELL := $(installdir)/bin/bash +export CPPFLAGS := -I$(installdir)/include @@ -197,18 +198,20 @@ $(mtexdir)/initialize.tex: | $(mtexdir) $(call pvcheck, curl, $(curl-version), cURL, curlversion) $(call pvcheck, diff, $(diffutils-version), GNU Diffutils, \ diffutilsversion) - $(call pvcheck, find, $(findutils-version), GNU Findutils, \ + $(call pvcheck, find, $(findutils-version), GNU Findutils, \ findutilsversion) $(call pvcheck, gs, $(ghostscript-version), GPL Ghostscript, \ - ghostscriptversion) + ghostscriptversion) $(call pvcheck, git, $(git-version), Git, gitversion) $(call pvcheck, grep, $(grep-version), GNU Grep, grepversion) - $(call pvcheck, libtool, $(libtool-version), GNU Libtool, \ + $(call pvcheck, glibtool, $(libtool-version), GNU Libtool, \ libtoolversion) $(call pvcheck, ls, $(coreutils-version), GNU Coreutils, \ coreutilsversion) $(call pvcheck, lzip, $(lzip-version), Lzip, lzipversion) $(call pvcheck, make, $(make-version), GNU Make, makeversion) + $(call pvcheck, pkg-config, $(pkgconfig-version), pkg-config, \ + pkgconfigversion) $(call pvcheck, sed, $(sed-version), GNU SED, sedversion) $(call pvcheck, tar, $(tar-version), GNU Tar, tarversion) $(call pvcheck, which, $(which-version), GNU Which, whichversion) @@ -216,7 +219,7 @@ $(mtexdir)/initialize.tex: | $(mtexdir) # --------- Delete for no Gnuastro --------- $(call pvcheck, astnoisechisel, $(gnuastro-version), Gnuastro, \ - gnuastroversion) + gnuastroversion) # ------------------------------------------ # Bzip2 prints its version in standard error, not standard output! -- cgit v1.2.1