From 5844981147a4af48fc3ffb8d2794487f0236b335 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Thu, 29 Nov 2018 15:17:16 +0000 Subject: Ignoring building of GCC for pipeline GNU Binutils (which provides the GNU Linker) is not ported to Mac OS systems. GCC also takes a very long time to build, and if we are to still have linking problems with LLVM's linker, it would be better to just ignore GCC also and use the system's C compiler and linker together. So for the time being, GCC isn't a main target of the basic dependencies and won't be installed. But we have kept the rules that were checked on a GNU/Linux operating system. --- configure | 11 ++++++- reproduce/src/make/dependencies-basic.mk | 42 ++++++++++++++++++++------ reproduce/src/make/dependencies-build-rules.mk | 22 ++++++++++++-- reproduce/src/make/dependencies.mk | 24 +++++++++------ 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 4753320..f1e820a 100755 --- a/configure +++ b/configure @@ -563,8 +563,17 @@ fi # Build Basic dependencies # ------------------------ +# +# Since the system might not have GNU Coreutils at this stage, we'll just +# default to 4 threads if the actual number isn't found. This is because +# 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; +fi make -f reproduce/src/make/dependencies-basic.mk \ - static_build=$static_build -j8 + static_build=$static_build -j$numthreads diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk index 6bd389e..74ca429 100644 --- a/reproduce/src/make/dependencies-basic.mk +++ b/reproduce/src/make/dependencies-basic.mk @@ -63,7 +63,7 @@ export LDFLAGS := -L$(ildir) $(LDFLAGS) export CPPFLAGS := -I$(idir)/include $(CPPFLAGS) export LD_LIBRARY_PATH := $(ildir):$(LD_LIBRARY_PATH) -top-level-programs = gcc pkg-config +top-level-programs = ls sed gawk grep diff find bash which pkg-config all: $(foreach p, $(top-level-programs), $(ibdir)/$(p)) @@ -168,13 +168,29 @@ $(tarballs): $(tdir)/%: # For the time being, we aren't building a local C compiler, but we'll use # any C compiler that the system already has and just make a symbolic link # to it. -makelink = a=$$(which $(1) 2> /dev/null); \ +makelink = export PATH=$(syspath); a=$$(which $(1) 2> /dev/null); \ if [ x$$a != x ]; then ln -s $$a $(ibdir)/$(1); fi $(ibdir):; mkdir $@ $(ibdir)/low-level: | $(ibdir) - # We aren't building these low-levels tools yet ourselves. We'll - # thus just use what the host operating system has available. - PATH=$(syspath) + # The Assembler + $(call makelink,as) + + # The compiler + $(call makelink,clang) + $(call makelink,gcc) + $(call makelink,g++) + $(call makelink,cc) + + # The linker + $(call makelink,ar) + $(call makelink,ld) + $(call makelink,nm) + $(call makelink,ps) + + # On Mac OS, libtool is different compared to GNU Libtool. The + # libtool we'll build in the high-level dependencies has the + # executable name `glibtool'. + $(call makelink,libtool) # GNU Gettext (translate messages) $(call makelink,msgfmt) @@ -328,8 +344,8 @@ endif -# GCC prerequisites -# ----------------- +# (CURRENTLY IGNORED) GCC prerequisites +# ------------------------------------- $(ildir): | $(idir); mkdir $@ $(ilidir): | $(ildir); mkdir $@ $(ilidir)/gmp: $(tdir)/gmp-$(gmp-version).tar.lz \ @@ -372,8 +388,16 @@ $(ibdir)/ld: $(tdir)/binutils-$(binutils-version).tar.lz \ -# Build GCC -# --------- +# (CURRENTLY IGNORED) Build GCC +# ----------------------------- +# +# The building is currently ignored because GNU Binutils currently doesn't +# install critical components of building a compiler on Mac systems. So we +# can install and use the GNU C compiler, but we're still going to have the +# crazy issues with linking on a Mac OS. Since almost no natural science +# paper's processing depends so strongly on the compiler used, for now, +# we'll just use the host operating system's C library, compiler, and +# linker. # # We want to build GCC after building all the basic tools that are often # used in a configure script to enable GCC's configure script to work as diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk index eafa29c..b7d6c1a 100644 --- a/reproduce/src/make/dependencies-build-rules.mk +++ b/reproduce/src/make/dependencies-build-rules.mk @@ -48,17 +48,33 @@ # 4: Extra configuration options. # 5: Extra options/arguments to pass to Make. # 6: Step to run between `make' and `make install': usually `make check'. +# +# 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. gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ export LDFLAGS="$$LDFLAGS -static"; \ fi; \ check="$(6)"; \ if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \ - if [ -f $(ibdir)/bash ]; then shellop="SHELL=$(ibdir)/bash"; \ + cd $(ddir); rm -rf $(2); tar xf $(1); cd $(2); \ + \ + if [ -f $(ibdir)/bash ]; then \ + sed configure -e's|\#\! /bin/sh|\#\! $(ibdir)/bash|' \ + -e's|\#\!/bin/sh|\#\! $(ibdir)/bash|'> configure-t; \ + mv configure-t configure; \ + chmod +x configure; \ + shellop="SHELL=$(ibdir)/bash"; \ elif [ -f /bin/bash ]; then shellop="SHELL=/bin/bash"; \ else shellop="SHELL=/bin/sh"; \ fi; \ - cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) && \ - ./configure $(4) "$$shellop" --prefix=$(idir) && \ + \ + if [ x"$(2)" = x"zlib-$(zlib-version)" ]; then \ + configop="--prefix=$(idir)"; \ + else configop="$$shellop --prefix=$(idir)"; \ + fi; \ + \ + ./configure $(4) $$configop && \ make "$$shellop" $(5) && \ $$check && \ make "$$shellop" install && \ diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index 6acfdf9..dc9e053 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -104,7 +104,7 @@ $(tarballs): $(tdir)/%: if [ $$n = cfitsio ]; then mergenames=0 v=$$(echo $(cfitsio-version) | sed -e's/\.//' \ - | awk '{l=length($1); \ + | awk '{l=length($$1); \ printf (l==4 ? "%d\n" \ : (l==3 ? "%d0\n" \ : (l==2 ? "%d00\n" \ @@ -164,34 +164,35 @@ $(tarballs): $(tdir)/%: # for us here. So, we'll make an `$(ildir)/built' directory and make a # simple plain text file in it with the basic library name (an no prefix) # and create/write into it when the library is successfully built. +$(ilidir): | $(ildir); mkdir $@ $(ilidir)/cfitsio: $(tdir)/cfitsio-$(cfitsio-version).tar.gz \ - $(ibdir)/curl + $(ibdir)/curl | $(ilidir) $(call gbuild, $<,cfitsio, static, --enable-sse2 --enable-reentrant) \ && echo "CFITSIO is built" > $@ $(ilidir)/libgit2: $(tdir)/libgit2-$(libgit2-version).tar.gz \ $(ibdir)/cmake \ - $(ibdir)/curl + $(ibdir)/curl | $(ilidir) $(call cbuild, $<, libgit2-$(libgit2-version), static, \ -DUSE_SSH=OFF -DUSE_OPENSSL=OFF -DBUILD_CLAR=OFF \ -DTHREADSAFE=ON) \ && echo "Libgit2 is built" > $@ -$(ilidir)/gsl: $(tdir)/gsl-$(gsl-version).tar.gz +$(ilidir)/gsl: $(tdir)/gsl-$(gsl-version).tar.gz | $(ilidir) $(call gbuild, $<, gsl-$(gsl-version), static) \ && echo "GNU Scientific Library is built" > $@ -$(ilidir)/libjpeg: $(tdir)/jpegsrc.$(libjpeg-version).tar.gz +$(ilidir)/libjpeg: $(tdir)/jpegsrc.$(libjpeg-version).tar.gz | $(ilidir) $(call gbuild, $<, jpeg-9b, static) && echo "Libjpeg is built" > $@ $(ilidir)/libtiff: $(tdir)/tiff-$(libtiff-version).tar.gz \ - $(ilidir)/libjpeg + $(ilidir)/libjpeg | $(ilidir) $(call gbuild, $<, tiff-$(libtiff-version), static) \ && echo "Libtiff is built" > $@ $(ilidir)/wcslib: $(tdir)/wcslib-$(wcslib-version).tar.bz2 \ - $(ilidir)/cfitsio + $(ilidir)/cfitsio | $(ilidir) # Unfortunately WCSLIB forces the building of shared libraries. $(call gbuild, $<, wcslib-$(wcslib-version), , \ LIBS="-pthread -lcurl -lm" --without-pgplot \ @@ -200,12 +201,15 @@ $(ilidir)/wcslib: $(tdir)/wcslib-$(wcslib-version).tar.bz2 \ # Zlib: its `./configure' doesn't use Autoconf's configure script, it just # accepts a direct `--static' option. -$(ilidir)/zlib: $(tdir)/zlib-$(zlib-version).tar.gz +$(ilidir)/zlib: $(tdir)/zlib-$(zlib-version).tar.gz | $(ilidir) + + # IMPORTANT, the second argument to `gbuild', must not have any + # spaces before or after it: it is going to be checked. ifeq ($(static_build),yes) - $(call gbuild, $<, zlib-$(zlib-version), , --static) \ + $(call gbuild, $<,zlib-$(zlib-version), , --static) \ && echo "Zlib is built" > $@ else - $(call gbuild, $<, zlib-$(zlib-version)) && echo "Zlib is built" > $@ + $(call gbuild, $<,zlib-$(zlib-version)) && echo "Zlib is built" > $@ endif -- cgit v1.2.1