aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/make/basic.mk
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/software/make/basic.mk')
-rw-r--r--reproduce/software/make/basic.mk138
1 files changed, 91 insertions, 47 deletions
diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk
index 453eddb..0b672d8 100644
--- a/reproduce/software/make/basic.mk
+++ b/reproduce/software/make/basic.mk
@@ -130,9 +130,17 @@ backupservers = $(filter-out $(topbackupserver),$(backupservers_all))
# Low-level (not built) programs
# ------------------------------
#
-# For the time being, some components of the project on some systems, so we
-# are simply making a symbolic link to the system's files here. We'll do
-# this after building GNU Coreutils to have trustable elements.
+# For the time being, some components of the project aren't being built on
+# some systems (primarily on proprietary operating systems). So we are
+# simply making a symbolic link to the system's programs/libraries in the
+# build directory.
+#
+# The logical position of this rule is irrelevant in this Makefile (because
+# programs being built here have full access to the system's PATH
+# already). This is done for the high-level programs installed in
+# 'high-level.mk', 'xorg.mk' or 'python.mk'. So this step is done after
+# building our own GNU Grep (which is the highest-level program used in
+# 'makelink') to have trustable elements.
#
# About ccache: ccache acts like a wrapper over the C compiler and is made
# to avoid/speed-up compiling of identical files in a system (it is
@@ -142,19 +150,25 @@ backupservers = $(filter-out $(topbackupserver),$(backupservers_all))
# thus remove any part of PATH of that has `ccache' in it before making
# symbolic links to the programs we are not building ourselves.
#
-# We'll need the system's PATH for making links to low-level programs we
-# won't be building ourselves.
+# The double quotations after the starting 'export PATH' are necessary in
+# case the user's PATH has space-characters in it.
+#
+# We use 'realpath' here (part of GNU Coreutils which is already installed
+# by the time we use 'makelink') to avoid linking to a link (on the
+# host). 'realpath' will follow a link (and possibly other links in the
+# middle) to an actual file and return its address. When the location isn't
+# a link, it will just return it.
syspath := $(PATH)
makelink = origpath="$$PATH"; \
- export PATH=$$(echo $(syspath) \
- | tr : '\n' \
- | grep -v ccache \
- | tr '\n' :); \
+ export PATH="$$(echo $(syspath) \
+ | tr : '\n' \
+ | grep -v ccache \
+ | tr '\n' :)"; \
if type $(1) > /dev/null 2> /dev/null; then \
if [ x$(3) = x ]; then \
- ln -sf $$(which $(1)) $(ibdir)/$(1); \
+ ln -sf "$$(realpath $$(which $(1)))" $(ibdir)/$(1); \
else \
- ln -sf $$(which $(1)) $(ibdir)/$(3); \
+ ln -sf "$$(realpath $$(which $(1)))" $(ibdir)/$(3); \
fi; \
else \
if [ "x$(strip $(2))" = xmandatory ]; then \
@@ -166,13 +180,12 @@ makelink = origpath="$$PATH"; \
export PATH="$$origpath"
$(ibdir) $(ildir):; mkdir $@
-$(ibidir)/low-level-links: $(ibidir)/coreutils-$(coreutils-version) \
+$(ibidir)/low-level-links: $(ibidir)/grep-$(grep-version) \
| $(ibdir) $(ildir)
- # Not-installed (but necessary in some cases) compilers.
- # Clang is necessary for CMake.
- $(call makelink,clang)
- $(call makelink,clang++)
+ # Hardware specific
+ $(call makelink,lp) # For printing, necessary for R.
+ $(call makelink,lpr) # For printing, necessary for R.
# Mac OS specific
$(call makelink,mig)
@@ -913,7 +926,7 @@ $(ibidir)/gettext-$(gettext-version): \
$(ibidir)/ncurses-$(ncurses-version) \
$(ibidir)/libiconv-$(libiconv-version) \
$(ibidir)/libunistring-$(libunistring-version)
- tarball=gettext-$(gettext-version).tar.xz
+ tarball=gettext-$(gettext-version).tar.lz
$(call import-source, $(gettext-url), $(gettext-checksum))
$(call gbuild, gettext-$(gettext-version), static,, \
V=1 -j$(numthreads))
@@ -950,7 +963,7 @@ $(ibidir)/libtool-$(libtool-version): $(ibidir)/m4-$(m4-version)
$(call import-source, $(libtool-url), $(libtool-checksum))
$(call gbuild, libtool-$(libtool-version), static, \
--program-prefix=g, V=1 -j$(numthreads))
- ln -s $(ibdir)/glibtoolize $(ibdir)/libtoolize
+ ln -sf $(ibdir)/glibtoolize $(ibdir)/libtoolize
echo "GNU Libtool $(libtool-version)" > $@
$(ibidir)/grep-$(grep-version): $(ibidir)/coreutils-$(coreutils-version)
@@ -1202,6 +1215,7 @@ $(ibidir)/binutils-$(binutils-version): \
$(call makelink,ld)
$(call makelink,nm)
$(call makelink,ps)
+ $(call makelink,strip)
$(call makelink,ranlib)
echo "" > $@
else
@@ -1211,14 +1225,15 @@ $(ibidir)/binutils-$(binutils-version): \
--with-lib-path=$(sys_library_path), \
-j$(numthreads) )
- # The `ld' linker of Binutils needs several `*crt*.o' file to
- # run. On some systems these object files aren't installed in
- # standard places. We defined `LIBRARY_PATH' and that fixed the
- # problem for many systems. However, some software (for example
- # ImageMagick) over-write `LIBRARY_PATH', therefore there is no
- # other way than to put a link to these necessary files in our
- # local build directory. IMPORTANT NOTE: later, when we build the
- # GNU C Library in the project, we should remove this step.
+ # The `ld' linker of Binutils needs several `*crt*.o' files from
+ # the host's GNU C Library to run. On some systems these object
+ # files aren't installed in standard places. We defined
+ # `LIBRARY_PATH' and that fixed the problem for many
+ # systems. However, some software (for example ImageMagick)
+ # over-write `LIBRARY_PATH', therefore there is no other way than
+ # to put a link to these necessary files in our local build
+ # directory. IMPORTANT NOTE: later, when we build the GNU C
+ # Library in the project, we should remove this step.
if ! [ x"$(sys_library_path)" = x ]; then
for f in $(sys_library_path)/*crt*.o; do
b=$$($(ibdir)/basename $$f)
@@ -1270,6 +1285,16 @@ $(ibidir)/gcc-$(gcc-version): $(ibidir)/binutils-$(binutils-version)
tarball=gcc-$(gcc-version).tar.xz
$(call import-source, $(gcc-url), $(gcc-checksum))
+ # To avoid any previous build in '.local/bin' causing problems in
+ # this build/links of this GCC, we'll first delete all the possibly
+ # built/existing compilers in this project. Note that GCC also
+ # installs several executables like this 'x86_64-pc-linux-gnu-gcc',
+ # 'x86_64-pc-linux-gnu-gcc-ar' or 'x86_64-pc-linux-gnu-g++'.
+ rm -f $(ibdir)/*g++ $(ibdir)/cpp $(ibdir)/gfortran
+ rm -rf $(ildir)/gcc $(ildir)/libcc* $(ildir)/libgcc*
+ rm -f $(ibdir)/*gcc* $(ibdir)/gcov* $(ibdir)/cc $(ibdir)/c++
+ rm -rf $(ildir)/libgfortran* $(ildir)/libstdc* rm $(idir)/x86_64*
+
# GCC builds is own libraries in '$(idir)/lib64'. But all other
# libraries are in '$(idir)/lib'. Since this project is only for a
# single architecture, we can trick GCC into building its libraries
@@ -1277,34 +1302,52 @@ $(ibidir)/gcc-$(gcc-version): $(ibidir)/binutils-$(binutils-version)
# link to '$(idir)/lib'.
if [ $(host_cc) = 1 ]; then
- # Make sure we don't have any of the program we want to link to
- # in the '.local/bin' directory.
- rm -f $(ibdir)/cc
- rm -f $(ibdir)/c++
- rm -f $(ibdir)/gcc
- rm -f $(ibdir)/cpp
- rm -f $(ibdir)/strip;
- rm -f $(ibdir)/gfortran;
-
- # Put links to the host's tools in '.local/bin'.
- $(call makelink,cc)
- $(call makelink,cpp)
- $(call makelink,cc,,gcc)
+ # Put links to the host's tools in '.local/bin'. Note that some
+ # macOS systems have both a native clang *and* a GNU C Compiler
+ # (note that this is different from the "normal" macOS situation
+ # where 'gcc' actually points to clang, here we mean when 'gcc'
+ # is actually the GNU C Compiler).
+ #
+ # In such cases, the GCC isn't complete and using it will cause
+ # problems when building high-level tools (for example openBLAS,
+ # rpcsvc-proto, CMake, xlsxio, Python or Matplotlib among
+ # others). To avoid such situations macOSs are configured like
+ # this: we'll simply set 'gcc' to point to 'clang' and won't set
+ # 'gcc' to point to the system's 'gcc'.
+ #
+ # Also, note that LLVM's clang doesn't have a C Pre-Processor. So
+ # we will only put a link to the host's 'cpp' if the system is
+ # not macOS. On macOS systems that have a real GCC installed,
+ # having GNU CPP in the project build directory is known to cause
+ # problems with 'libX11'.
$(call makelink,gfortran)
- $(call makelink,c++,,g++)
- $(call makelink,strip,mandatory)
+ if [ x$(on_mac_os) = xyes ]; then
+ $(call makelink,clang)
+ $(call makelink,clang++)
+ $(call makelink,clang,,gcc)
+ $(call makelink,clang++,,g++)
+ else
+ $(call makelink,cpp)
+ $(call makelink,gcc)
+ $(call makelink,g++)
+ fi
+
+ # We also want to have the two 'cc' and 'c++' in the build
+ # directory that point to the selected compiler. With the checks
+ # above, 'gcc' and 'g++' will point to the proper compiler, so
+ # we'll use them to define 'cc' and 'c++'.
+ $(call makelink,gcc,,cc)
+ $(call makelink,g++,,c++)
+
+ # Get the first line of the compiler's '--version' output and put
+ # that into the target (so we know want compiler was used).
ccinfo=$$(gcc --version | awk 'NR==1')
echo "C compiler (""$$ccinfo"")" > $@
else
- # We are building GCC, so to avoid any previous build in
- # '.local/bin', we'll delete all the files that GCC builds from
- # there.
+ # Mark the current directory.
current_dir=$$(pwd)
- rm -f $(ibdir)/gcc* $(ibdir)/g++ $(ibdir)/gfortran $(ibdir)/gcov*
- rm -rf $(ildir)/gcc $(ildir)/libcc* $(ildir)/libgcc*
- rm -rf $(ildir)/libgfortran* $(ildir)/libstdc* rm $(idir)/x86_64*
# We don't want '.local/lib' and '.local/lib64' to be separate.
ln -fs $(ildir) $(idir)/lib64
@@ -1398,6 +1441,7 @@ $(ibidir)/gcc-$(gcc-version): $(ibidir)/binutils-$(binutils-version)
# Set 'cc' to point to 'gcc'.
ln -sf $(ibdir)/gcc $(ibdir)/cc
+ ln -sf $(ibdir)/g++ $(ibdir)/c++
# Write the final target.
echo "GNU Compiler Collection (GCC) $(gcc-version)" > $@