From 152421339a3a52485d9f6c4be28aad5c58cd089c Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Fri, 12 Feb 2021 23:49:16 +0000
Subject: Installation: minor correction in links to system libraries

Until now when making a link to the system's 'dl' and 'pthread' libraries
we were simply linking the installed location on the system (in
'/usr/lib'). However, in some systems, these may themselves be links to
other locations and this could cause linking problems.

With this commit, we now use 'realpath' to extract the absolute address of
the final file that the libraries may link to, and directly link to them.

A minor cosmetic correction was also made in the build rule for CFITSIO:
the long line was broken into two!
---
 reproduce/software/make/basic.mk      | 5 ++++-
 reproduce/software/make/high-level.mk | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'reproduce/software')

diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk
index 9217ee9..efb7377 100644
--- a/reproduce/software/make/basic.mk
+++ b/reproduce/software/make/basic.mk
@@ -210,7 +210,10 @@ $(ibidir)/low-level-links: $(ibidir)/grep-$(grep-version) \
         #   POSIX Threads library for multi-threaded programs.
 	for l in dl pthread; do
 	  if [ -f /usr/lib/lib$$l.a ]; then
-	    ln -sf /usr/lib/lib$$l.* $(ildir)/
+	    for f in /usr/lib/lib$$l.*; do
+	      ln -sf $$(realpath $$f) \
+	         $$(echo $$f | sed -e's|/usr/lib|$(ildir)|')
+	    done
 	  fi
 	done
 
diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk
index d69722e..26a58f7 100644
--- a/reproduce/software/make/high-level.mk
+++ b/reproduce/software/make/high-level.mk
@@ -428,7 +428,8 @@ $(ibidir)/cfitsio-$(cfitsio-version):
 	export gbuild_tar=$(ddir)/$$customtar
 	$(call gbuild, cfitsio-$(cfitsio-version), , \
 	               --enable-sse2 --enable-reentrant \
-	               --with-bzip2=$(idir), , make shared fpack funpack)
+	               --with-bzip2=$(idir), , \
+	               make shared fpack funpack)
 	rm $$customtar
 	echo "CFITSIO $(cfitsio-version)" > $@
 
-- 
cgit v1.2.1