Revision 8161194d68665648b93389adb333e741ba230497 authored by Mohammad Akhlaghi on 22 May 2023, 22:44:20 UTC, committed by Mohammad Akhlaghi on 23 May 2023, 06:42:11 UTC
SUMMARY: no change is necessary in your project, unless you use the Fortran features of WCSLIB in your project. Until now, there were two compilation failures on recent macOS computers with an M1 CPU: Less would crash because it couldn't find the relevant PCRE (perl-compatible regular expression) libraries and WCSLIB would crash because the LLVM compiler's Fortran features could not be built. With this commit, both issues have been fixed by disabling the relevant feature. Extensive comments have been placed in both places in case your project needs these features, so please see the comments in the relevant part of 'reproduce/software/make/basic.mk' for Less and 'reproduce/software/make/high-level.mk' for WCSLIB. In fact the previous solution (where we would not have Fortran features in WCSLIB on macOS systems was problematic and non-reproducibile (the features of WCSLIB depended on the operating system!). Another minor change was that for macOS, we now directly use the version-string of WCSLIB to fix the internal linking issue there. As a result, WCSLIB is no longer a "Version-dependent build" software (in 'reproduce/software/config/versions.conf'). Recall that these are software that when changing the version, it is also necessary to inspect their build recipe. These two issues and their fix were discovered and fixed with the help of James Robinson.
1 parent 644a236
build-rules.mk
# Generic configurable recipes to build packages with GNU Build system or
# CMake. This is Makefile is not intended to be run directly, it will be
# imported into 'basic.mk' and 'high-level.mk'. They should be activated
# with Make's 'Call' function.
#
# Copyright (C) 2018-2023 Mohammad Akhlaghi <mohammad@akhlaghi.org>
#
# This Makefile is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This Makefile is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this Makefile. If not, see <http://www.gnu.org/licenses/>.
# Import/download project's source
# --------------------------------
#
# Copy/Download the raw tarball into an '.unchecked' suffix. Then calculate
# its checksum and if it is correct, remove the extra suffix.
#
# Arguments:
# 1: The optional base URL (directory) to use for this tarball.
# 2: The expected checksum of the tarball.
# 3: The upstream name of the tarball file, if not automatically derived
# from the version number.
# 4: [Optional]: Alternative upstream base URL (directory) for the
# tarball, to be used in preference to user or Maneage backup
# servers.
#
# Necessary shell variables
# 'tarball': This is the name of the actual tarball file without a
# directory.
import-source = final=$(tdir)/$$tarball; \
url=$(strip $(1)); \
exp_checksum="$(strip $(2))"; \
if [ -f $$final ]; then \
echo "$(tdir)/$$tarball: already present in project."; \
else \
unchecked="$$final.unchecked"; \
rm -f "$$unchecked"; \
if [ -f $(DEPENDENCIES-DIR)/$$tarball ]; then \
if type realpath > /dev/null 2> /dev/null; then \
ln -sf "$$(realpath $(DEPENDENCIES-DIR)/$$tarball)" \
"$$unchecked"; \
else \
cp $(DEPENDENCIES-DIR)/$$tarball "$$unchecked"; \
fi; \
else \
if [ x"$$url" = x ]; then \
bservers="$(backupservers)"; \
tarballurl=$(topbackupserver)/$$tarball; \
else \
bservers="$(backupservers_all)"; \
if [ "x$(strip $(3))" = "x" ]; then \
tarballurl=$$url/$$tarball; \
else \
tarballurl=$$url/$(strip $(3)); \
fi; \
fi; \
if [ x"$(4)" != x ]; then \
bservers="$(strip $(4)) $$bservers"; \
fi; \
if [ -f $(ibdir)/wget ]; then \
downloader="wget --no-use-server-timestamps -O"; \
else \
downloader="$(DOWNLOADER)"; \
fi; \
touch $(lockdir)/download; \
$(downloadwrapper) "$$downloader" $(lockdir)/download \
$$tarballurl "$$unchecked" "$$bservers"; \
fi; \
if [ x"$$exp_checksum" = x"NO-CHECK-SUM" ]; then \
mv "$$unchecked" "$$final"; \
else \
if type sha512sum > /dev/null 2>/dev/null; then \
checksum=$$(sha512sum "$$unchecked" | awk '{print $$1}'); \
if [ x"$$checksum" = x"$$exp_checksum" ]; then \
mv "$$unchecked" "$$final"; \
else \
echo "ERROR: Non-matching checksum: $$tarball"; \
echo "Checksum should be: $$exp_checksum"; \
echo "Checksum is: $$checksum"; \
exit 1; \
fi; \
else mv "$$unchecked" "$$final"; \
fi; \
fi; \
fi
# Double-check an already downloaded R source
# -------------------------------------------
#
# It is probably too late to protect the system if you have already
# installed an insecure or wrong R package. However, it's still useful
# to check that the source package is the one that you think it is.
#
# Calculate the checksum and exit with a non-zero error code if
# there's a mismatch, after informing the user.
#
# Arguments:
# 1: The expected checksum of the tarball.
#
# Necessary shell variables
# 'tarball': This is the name of the actual tarball file without a
# directory.
double-check-R-source = final=$(tdir)/R-project/$$tarball; \
exp_checksum="$(strip $(1))"; \
if [ x"$$exp_checksum" = x"NO-CHECK-SUM" ]; then \
result=0; \
else \
if type sha512sum > /dev/null 2>/dev/null; then \
checksum=$$(sha512sum "$$final" | awk '{print $$1}'); \
if [ x"$$checksum" = x"$$exp_checksum" ]; then \
result=0; \
else \
echo "ERROR: Non-matching checksum: $$final"; \
echo "Checksum should be: $$exp_checksum"; \
echo "Checksum is: $$checksum"; \
result=1; \
exit 1; \
fi; \
else \
echo "ERROR: sha512sum is unavailable."; \
exit 1; \
fi; \
fi
# Unpack a tarball
# ----------------
#
# Unpack a tarball in the current directory. The issue is that until we
# install GNU Tar within Maneage, we have to use the host's Tar
# implementation and in some cases, they don't recognize '.lz'.
uncompress = csuffix=$$(echo $$utarball \
| sed -e's/\./ /g' \
| awk '{print $$NF}'); \
if [ x$$csuffix = xlz ]; then \
intarrm=1; \
intar=$$(echo $$utarball | sed -e's/.lz//'); \
lzip -c -d $$utarball > $$intar; \
else \
intarrm=0; \
intar=$$utarball; \
fi; \
if tar -xf $$intar; then \
if [ x$$intarrm = x1 ]; then rm $$intar; fi; \
else \
echo; echo "Tar error"; exit 1; \
fi
# GNU Build system
# ----------------
#
# Arguments:
# 1: Directory name after unpacking.
# 2: Set to 'static' for a static build.
# 3: Extra configuration options.
# 4: Extra options/arguments to pass to Make.
# 5: Step to run between 'make' and 'make install': usually 'make check'.
# 6: The configuration script ('configure' by default).
# 7: Arguments for 'make install'.
#
# NOTE: Unfortunately the configure script of 'zlib' doesn't recognize
# 'SHELL'. So we'll have to remove it from the call to the configure
# script.
#
# NOTE: A program might not contain any configure script. In this case,
# we'll just pass a non-relevant function like 'pwd'. So SED should be used
# to modify 'confscript' or to set 'configop'.
gbuild = if [ x$(static_build) = xyes ] && [ "x$(2)" = xstatic ]; then \
export LDFLAGS="$$LDFLAGS -static"; \
fi; \
check="$(5)"; \
if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \
cd $(ddir); \
rm -rf $(1); \
if [ x"$$gbuild_tar" = x ]; then utarball=$(tdir)/$$tarball; \
else utarball=$$gbuild_tar; \
fi; \
$(call uncompress); \
cd $(1); \
\
if [ x"$(strip $(6))" = x ]; then confscript=./configure; \
else confscript="$(strip $(6))"; \
fi; \
\
if [ -f $(ibdir)/bash ]; then \
if [ -f "$$confscript" ]; then \
sed -e's|\#\! /bin/sh|\#\! $(ibdir)/bash|' \
-e's|\#\!/bin/sh|\#\! $(ibdir)/bash|' \
$$confscript > $$confscript-tmp; \
mv $$confscript-tmp $$confscript; \
chmod +x $$confscript; \
fi; \
shellop="SHELL=$(ibdir)/bash"; \
elif [ -f /bin/bash ]; then shellop="SHELL=/bin/bash"; \
else shellop="SHELL=/bin/sh"; \
fi; \
\
if [ x$$gbuild_prefix = x ]; then prefixdir="$(idir)"; \
else prefixdir="$$gbuild_prefix"; fi; \
\
if [ -f "$$confscript" ]; then \
if [ x"$(strip $(1))" = x"zlib-$(zlib-version)" ]; then \
configop="--prefix=$$prefixdir"; \
else configop="$$shellop --prefix=$$prefixdir"; \
fi; \
fi; \
\
echo; echo "Using '$$confscript' to configure:"; echo; \
echo "$$confscript $(3) $$configop"; echo; \
if [ x$$configure_in_different_directory = x1 ]; then \
mkdir build; \
cd build; \
../$$confscript $(3) $$configop; \
make "$$shellop" $(4); \
$$check; \
make "$$shellop" install $(7); \
cd ../..; \
else \
$$confscript $(3) $$configop; \
make "$$shellop" $(4); \
$$check; \
make "$$shellop" install $(7); \
cd ..; \
fi; \
rm -rf $(1);
# CMake
# -----
#
# According to the link below, in CMake '/bin/sh' is hardcoded, so there is
# no way to change it unfortunately!
#
# https://stackoverflow.com/questions/21167014/how-to-set-shell-variable-in-makefiles-generated-by-cmake
cbuild = if [ x$(static_build) = xyes ] && [ $(2)x = staticx ]; then \
export LDFLAGS="$$LDFLAGS -static"; \
opts="-DBUILD_SHARED_LIBS=OFF"; \
fi; \
cd $(ddir); \
rm -rf $(1); \
utarball=$(tdir)/$$tarball; \
$(call uncompress); \
cd $(1); \
rm -rf project-build; \
mkdir project-build; \
cd project-build; \
cmake .. -DCMAKE_LIBRARY_PATH=$(ildir) \
-DCMAKE_INSTALL_PREFIX=$(idir) \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON $$opts $(3); \
make; \
make install; \
cd ../..; \
rm -rf $(1)

Computing file changes ...