aboutsummaryrefslogtreecommitdiff
path: root/reproduce
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-12-04 20:42:56 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-12-04 20:53:13 +0000
commita218b814196983e00c19c3bca8f8dc9698334a13 (patch)
tree01d1451608334315a304d6f991514dc328e96bc4 /reproduce
parentfa912a33396487aa213fbc3cf66305fdbfd312de (diff)
Shared library absolute address fixed in Libgit2 and WCSLIB on Mac OS
The build systems of Libgit2 and WCSLIB on Mac OS does not account for installation in non-standard addresses: `Libgit2' keeps the absolute address of its build directory (not the installation directory) and WCSLIB doesn't write any absolute address at all (so the system uses the first one it finds). To address these issues, we are now using Mac OS's `install_name_tool' program to fix the absolute path within the installed shared library. Since the version of the library is actually present in its shared library name, in `dependency-versions.mk' we have also separated these two libraries so later when their version is changed, we are careful in correcting the shared library name also.
Diffstat (limited to 'reproduce')
-rw-r--r--reproduce/config/pipeline/dependency-versions.mk12
-rw-r--r--reproduce/src/make/dependencies-basic.mk3
-rw-r--r--reproduce/src/make/dependencies.mk73
3 files changed, 64 insertions, 24 deletions
diff --git a/reproduce/config/pipeline/dependency-versions.mk b/reproduce/config/pipeline/dependency-versions.mk
index 99d55ee..dc161c6 100644
--- a/reproduce/config/pipeline/dependency-versions.mk
+++ b/reproduce/config/pipeline/dependency-versions.mk
@@ -36,7 +36,15 @@ cfitsio-version = 3.45
curl-version = 7.62.0
gsl-version = 2.5
libjpeg-version = v9b
-libgit2-version = 0.26.0
libtiff-version = 4.0.10
-wcslib-version = 6.2
zlib-version = 1.2.11
+
+# Special libraries
+# -----------------
+#
+# The shared library name of the following libraries is explicity mentioned
+# the software build Makefiles (`reproduce/src/make/dependencies*.mk'). If
+# you change their version, also please change the explicit shared library
+# names also.
+libgit2-version = 0.26.0
+wcslib-version = 6.2
diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index b007778..bedf0a0 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -208,8 +208,9 @@ $(ibdir)/low-level-links: | $(ibdir) $(ildir)
$(call makelink,ps)
$(call makelink,ranlib)
- # Mac OS information (used by TeX Live).
+ # Mac OS specific
$(call makelink,sw_vers)
+ $(call makelink,install_name_tool)
# On Mac OS, libtool is different compared to GNU Libtool. The
# libtool we'll build in the high-level dependencies has the
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk
index e309473..24f42a9 100644
--- a/reproduce/src/make/dependencies.mk
+++ b/reproduce/src/make/dependencies.mk
@@ -188,23 +188,6 @@ $(ilidir)/cfitsio: $(tdir)/cfitsio-$(cfitsio-version).tar.gz \
--enable-sse2 --enable-reentrant) \
&& echo "CFITSIO is built" > $@
-
-# The libgit2 page recommends doing a static build, especially for Mac
-# systems (with `-DBUILD_SHARED_LIBS=OFF'). Under XCode, the following link
-# has written "It’s highly recommended that you build libgit2 as a static
-# library for Xcode projects. This simplifies distribution significantly,
-# as the resolution of dynamic libraries at runtime can be extremely
-# problematic.". This is a major problem we have been having so far with
-# Mac systems: https://libgit2.org/docs/guides/build-and-link
-$(ilidir)/libgit2: $(tdir)/libgit2-$(libgit2-version).tar.gz \
- $(ibdir)/cmake \
- $(ibdir)/curl
- export LDFLAGS="$$LDFLAGS -lssl -lcrypto -lz"; \
- $(call cbuild, $<, libgit2-$(libgit2-version), static, \
- -DUSE_SSH=OFF -DBUILD_CLAR=OFF \
- -DTHREADSAFE=ON ) \
- && echo "Libgit2 is built" > $@
-
$(ilidir)/gsl: $(tdir)/gsl-$(gsl-version).tar.gz
$(call gbuild, $<, gsl-$(gsl-version), static) \
&& echo "GNU Scientific Library is built" > $@
@@ -217,20 +200,68 @@ $(ilidir)/libtiff: $(tdir)/tiff-$(libtiff-version).tar.gz \
$(call gbuild, $<, tiff-$(libtiff-version), static) \
&& echo "Libtiff is built" > $@
+
+
+
+
+# Libraries with special attention on Mac OS
+# ------------------------------------------
+#
+# Libgit2 and WCSLIB don't set their installation path, or don't do it
+# properly, in their finally installed shared libraries. But since we are
+# linking everything (including OpenSSL and its dependencies) dynamically,
+# we need to also make a shared libraries and can't use static
+# libraries. So for Mac OS systems we have to correct their addresses
+# manually.
+#
+# For example, Libgit2 page recommends doing a static build, especially for
+# Mac systems (with `-DBUILD_SHARED_LIBS=OFF'): "It’s highly recommended
+# that you build libgit2 as a static library for Xcode projects. This
+# simplifies distribution significantly, as the resolution of dynamic
+# libraries at runtime can be extremely problematic.". This is a major
+# problem we have been having so far with Mac systems:
+# https://libgit2.org/docs/guides/build-and-link
+$(ilidir)/libgit2: $(tdir)/libgit2-$(libgit2-version).tar.gz \
+ $(ibdir)/cmake \
+ $(ibdir)/curl
+ # Build and install the library.
+ $(call cbuild, $<, libgit2-$(libgit2-version), static, \
+ -DUSE_SSH=OFF -DBUILD_CLAR=OFF \
+ -DTHREADSAFE=ON )
+
+ # The builders didn't set the shared library name (ID) for Mac OS
+ # systems. So we'll have to fix it manually.
+ if [ x$(on_mac_os) = xyes ]; then
+ install_name_tool -id $(ildir)/libgit2.26.dylib
+ $(ildir)/libgit2.26.dylib
+ fi
+
+ # Write the target file.
+ echo "Libgit2 is built" > $@
+
$(ilidir)/wcslib: $(tdir)/wcslib-$(wcslib-version).tar.bz2 \
$(ilidir)/cfitsio
- # Unfortunately WCSLIB forces the building of shared libraries. So
- # we'll just delete any shared library that is produced afterwards.
- $(call gbuild, $<, wcslib-$(wcslib-version), , \
+ # Build and install the library.
+ $(call gbuild, $<, wcslib-$(wcslib-version), , \
LIBS="-pthread -lcurl -lssl -lcrypto -lz -lm" \
--with-cfitsiolib=$(ildir) \
--with-cfitsioinc=$(idir)/include \
- --without-pgplot --disable-fortran) && \
+ --without-pgplot --disable-fortran)
+
+ # The builders didn't set the shared library name (ID) for Mac OS
+ # systems. So we'll have to fix it manually.
+ if [ x$(on_mac_os) = xyes ]; then
+ install_name_tool -id $(ildir)/libwcs.6.2.dylib
+ $(ildir)/libwcs.6.2.dylib;
+ fi
+
+ # Write the target file.
echo "WCSLIB is built" > $@
+
# Programs
# --------
#