Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9 from JuliaLinearAlgebra/sf/gcc_versions
Browse files Browse the repository at this point in the history
GCC-versioned building
  • Loading branch information
staticfloat authored Sep 21, 2018
2 parents dd69e23 + 993226f commit 5a6eca3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
35 changes: 20 additions & 15 deletions build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,69 @@ version = v"0.3.0"
sources = [
"https://github.com/xianyi/OpenBLAS/archive/v0.3.0.tar.gz" =>
"cf51543709abe364d8ecfb5c09a2b533d2b725ea1a66f203509b21a8e9d8f1a1",
"./bundled",
]

# Bash recipe for building across all platforms
script = raw"""
# We always want threading
flags="USE_THREAD=1 GEMM_MULTITHREADING_THRESHOLD=50 NO_AFFINITY=1"
flags=(USE_THREAD=1 GEMM_MULTITHREADING_THRESHOLD=50 NO_AFFINITY=1)
# We are cross-compiling
flags="${flags} CROSS=1 HOSTCC=$CC_FOR_BUILD PREFIX=/ CROSS_SUFFIX=${target}-"
flags+=(CROSS=1 "HOSTCC=$CC_FOR_BUILD" PREFIX=/ "CROSS_SUFFIX=${target}-")
# We need to use our basic objconv, not a prefixed one:
flags="${flags} OBJCONV=objconv"
flags+=(OBJCONV=objconv)
if [[ ${nbits} == 64 ]]; then
# If we're building for a 64-bit platform, engage ILP64
LIBPREFIX=libopenblas64_
flags="${flags} INTERFACE64=1 SYMBOLSUFFIX=64_"
flags+=(INTERFACE64=1 SYMBOLSUFFIX=64_)
else
LIBPREFIX=libopenblas
fi
flags="${flags} LIBPREFIX=${LIBPREFIX}"
flags+=("LIBPREFIX=${LIBPREFIX}")
# Set BINARY=32 on 32-bit platforms
if [[ ${nbits} == 32 ]]; then
flags="${flags} BINARY=32"
flags+=(BINARY=32)
fi
# Set BINARY=64 on x86_64 platforms (but not AArch64 or powerpc64le)
if [[ ${target} == x86_64-* ]]; then
flags="${flags} BINARY=64"
flags+=(BINARY=64)
fi
# Use 16 threads unless we're on an i686 arch:
if [[ ${target} == i686* ]]; then
flags="${flags} NUM_THREADS=8"
flags+=(NUM_THREADS=8)
else
flags="${flags} NUM_THREADS=16"
flags+=(NUM_THREADS=16)
fi
# On Intel architectures, engage DYNAMIC_ARCH
if [[ ${proc_family} == intel ]]; then
flags="${flags} DYNAMIC_ARCH=1"
flags+=(DYNAMIC_ARCH=1)
# Otherwise, engage a specific target
elif [[ ${target} == aarch64-* ]]; then
flags="${flags} TARGET=ARMV8"
flags+=(TARGET=ARMV8)
elif [[ ${target} == arm-* ]]; then
flags="${flags} TARGET=ARMV7"
flags+=(TARGET=ARMV7)
elif [[ ${target} == powerpc64le-* ]]; then
flags="${flags} TARGET=POWER8"
flags+=(TARGET=POWER8)
fi
# Enter the fun zone
cd ${WORKSPACE}/srcdir/OpenBLAS-*/
# Patch so that our LDFLAGS make it all the way through
atomic_patch -p1 "${WORKSPACE}/srcdir/patches/osx_exports_ldflags.patch"
# Build the library
make ${flags} -j${nproc}
make "${flags[@]}" -j${nproc}
# Install the library
make ${flags} PREFIX=$prefix install
make "${flags[@]}" "PREFIX=$prefix" install
# Force the library to be named the same as in Julia-land.
# Move things around, fix symlinks, and update install names/SONAMEs.
Expand Down Expand Up @@ -96,6 +100,7 @@ done
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line.
platforms = supported_platforms()
platforms = expand_gcc_versions(platforms)

# The products that we will ensure are always built
products(prefix) = [
Expand Down
22 changes: 22 additions & 0 deletions bundled/patches/osx_exports_ldflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
commit 6f77af2eef8a6ea2c5e32c66528849c319d4fb6d
Author: Elliot Saba <staticfloat@gmail.com>
Date: Fri Sep 21 09:19:51 2018 +0000

Add `$(LDFLAGS)` to `$(CC)` and `$(FC)` invocations within `exports/Makefile`

diff --git a/exports/Makefile b/exports/Makefile
index 29075a9c..3a5f77db 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -114,9 +114,9 @@ $(LIBDYNNAME) : ../$(LIBNAME).osx.renamed osx.def
endif
ifneq (,$(filter 1 2,$(NOFORTRAN)))
#only build without Fortran
- $(CC) $(CFLAGS) -all_load -headerpad_max_install_names -install_name "$(CURDIR)/../$(LIBDYNNAME)" -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB)
+ $(CC) $(CFLAGS) $(LDFLAGS) -all_load -headerpad_max_install_names -install_name "$(CURDIR)/../$(LIBDYNNAME)" -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB)
else
- $(FC) $(FFLAGS) -all_load -headerpad_max_install_names -install_name "$(CURDIR)/../$(LIBDYNNAME)" -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB)
+ $(FC) $(FFLAGS) $(LDFLAGS) -all_load -headerpad_max_install_names -install_name "$(CURDIR)/../$(LIBDYNNAME)" -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB)
endif

dllinit.$(SUFFIX) : dllinit.c

0 comments on commit 5a6eca3

Please sign in to comment.