From 6fa2c4f35f56420dea960099fed35f5a1f98bfd3 Mon Sep 17 00:00:00 2001
From: Raul Infante-Sainz <infantesainz@gmail.com>
Date: Fri, 31 May 2019 17:44:15 +0100
Subject: Fixing rpath problem in CFITSIO installation

`cfitsio' was recently updated and it cames up with a problem when
trying to build shared libraries (on Mac OS system laptop). This is
because the `configure' script for building `cfitsio' include by default
`rpath'.

With this commit, this issue is fixed by modifying the installation of
`cfitsio'. Using `sed', each ocurrence of `@rpath' in `configure' is
replaced by `$(ildir)'. Once it has been done, the installation of
`cfitsio' goes as normal.

In this commit, the version of the `cfitsio' has been also updated to
the most recent one.
---
 .file-metadata                                     | Bin 6796 -> 6796 bytes
 reproduce/software/config/installation/versions.mk |   2 +-
 reproduce/software/make/high-level.mk              |  24 ++++++++++-----------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/.file-metadata b/.file-metadata
index 288d4a4..656429f 100644
Binary files a/.file-metadata and b/.file-metadata differ
diff --git a/reproduce/software/config/installation/versions.mk b/reproduce/software/config/installation/versions.mk
index 0783a5f..18a4a2e 100644
--- a/reproduce/software/config/installation/versions.mk
+++ b/reproduce/software/config/installation/versions.mk
@@ -72,7 +72,7 @@ astrometrynet-version = 0.77
 atlas-version = 3.10.3
 cairo-version = 1.16.0
 cdsclient-version = 3.84
-cfitsio-version = 3.45
+cfitsio-version = 3.47
 cmake-version = 3.14.2
 fftw-version = 3.3.8
 flock-version = 0.2.3
diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk
index 98cdf76..2c35982 100644
--- a/reproduce/software/make/high-level.mk
+++ b/reproduce/software/make/high-level.mk
@@ -259,22 +259,22 @@ $(tarballs): $(tdir)/%: | $(lockdir)
 $(ibidir)/cfitsio: $(tdir)/cfitsio-$(cfitsio-version).tar.gz \
                    $(ibidir)/curl
 
-        # CFITSIO hard-codes the absolute address of cURL's `curl-config'
-        # program (which gives the necessary header and linking
-        # information) into the configure script. So we'll have to modify
-        # it manually before doing the standard build.
+	# CFITSIO hard-codes '@rpath' inside the shared library on
+	# Mac systems. So we need to change it to our library
+	# installation path. It doesn't affect GNU/Linux, so we'll
+	# just do it in any case to keep things clean.
 	topdir=$(pwd); cd $(ddir); tar xf $<
 	customtar=cfitsio-$(cfitsio-version)-custom.tar.gz
-	sed cfitsio/configure \
-	    -e's|/usr/bin/curl-config|$(ibdir)/curl-config|g' \
-	    > cfitsio/configure_tmp
-	mv cfitsio/configure_tmp cfitsio/configure
-	chmod +x cfitsio/configure
-	tar cf $$customtar cfitsio
+	cd cfitsio-$(cfitsio-version)
+	sed configure -e's|@rpath|$(ildir)|g' > configure_tmp
+	mv configure_tmp configure
+	chmod +x configure
+	cd ..
+	tar cf $$customtar cfitsio-$(cfitsio-version)
 	cd $$topdir
 
-        # Continue the standard build on the customized tarball.
-	$(call gbuild, $$customtar, cfitsio, , \
+	# Continue the standard build on the customized tarball.
+	$(call gbuild, $$customtar, cfitsio-$(cfitsio-version), , \
 	               --enable-sse2 --enable-reentrant, , \
 	               make shared) \
 	&& rm $$customtar \
-- 
cgit v1.2.1