From 7c7b79cae6302999851230cf1d186ad5153b99a9 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 30 Nov 2018 16:02:37 +0000 Subject: Setting libgit2 to build statically in any case On the Libgit2 webpage, it has recommended to build it statically on Mac systems. By default we are doing this on Linux systems, but the `-static' flag failed on Mac. But apparently CMake might be able to deal with the issue in a different way. --- configure | 4 ++-- reproduce/src/make/dependencies-build-rules.mk | 4 +++- reproduce/src/make/dependencies.mk | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/configure b/configure index b10f536..840a350 100755 --- a/configure +++ b/configure @@ -591,8 +591,8 @@ fi # some versions of Make complain about not having enough 'pipe' (memory) on # some systems. After some searching, I found out its because of too many # threads. -if which nproc 2> /dev/null; then numthreads=$(nproc --all); -else numthreads=4; +if which nproc &> /dev/null; then numthreads=$(nproc --all); +else numthreads=2; fi make -f reproduce/src/make/dependencies-basic.mk \ static_build=$static_build -j$numthreads diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk index 479b008..f613975 100644 --- a/reproduce/src/make/dependencies-build-rules.mk +++ b/reproduce/src/make/dependencies-build-rules.mk @@ -57,7 +57,9 @@ gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ fi; \ check="$(6)"; \ if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \ - cd $(ddir); rm -rf $(2); tar xf $(1); cd $(2); \ + cd $(ddir); rm -rf $(2); \ + if ! tar xf $(1); then echo; echo "Tar error"; exit 1; fi; \ + cd $(2); \ \ if [ -f $(ibdir)/bash ]; then \ sed configure -e's|\#\! /bin/sh|\#\! $(ibdir)/bash|' \ diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index 9f16615..e84de28 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -171,12 +171,19 @@ $(ilidir)/cfitsio: $(tdir)/cfitsio-$(cfitsio-version).tar.gz \ && echo "CFITSIO is built" > $@ +# The libgit2 page recommends doing a static build, especially for Mac +# systems. 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 | $(ilidir) $(call cbuild, $<, libgit2-$(libgit2-version), static, \ -DUSE_SSH=OFF -DUSE_OPENSSL=OFF -DBUILD_CLAR=OFF \ - -DTHREADSAFE=ON) \ + -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF) \ && echo "Libgit2 is built" > $@ $(ilidir)/gsl: $(tdir)/gsl-$(gsl-version).tar.gz | $(ilidir) -- cgit v1.2.1