This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
/
build_tarballs.jl
98 lines (78 loc) · 3.81 KB
/
build_tarballs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Lies! Lies and Slander! Supposedly ccache doesn't make things fail, but
# WHAT DO WE HAVE?! Literal proof that this is not the case. This whole thing
# fails to do the proper symbol renaming with `ccache`, which is TERRIBLE.
ENV["BINARYBUILDER_USE_CCACHE"] = "false"
using BinaryBuilder
# Collection of sources required to build Arpack
name = "Arpack"
version = v"3.5.0-3"
sources = [
"https://github.com/opencollab/arpack-ng.git" =>
"b095052372aa95d4281a645ee1e367c28255c947",
#"f532cc06a164a5e9f5ba7e05d1b5ad415a6fdc47",
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir
mkdir arpack-build
cd arpack-build
# arpack tests require finding libgfortran when linking with C linkers,
# and gcc doesn't automatically add that search path. So we do it for it.
EXE_LINK_FLAGS="${LDFLAGS}"
if [[ ${target} != *darwin* ]]; then
EXE_LINK_FLAGS="${EXE_LINK_FLAGS} -Wl,-rpath-link,/opt/${target}/${target}/lib -Wl,-rpath-link,/opt/${target}/${target}/lib64"
fi
# Symbols that have float32, float64, complexf32, and complexf64 support
SDCZ_SYMBOLS="axpy copy gemv geqr2 lacpy lahqr lanhs larnv lartg \
lascl laset scal trevc trmm trsen gbmv gbtrf gbtrs \
gttrf gttrs pttrf pttrs"
# All symbols that have float32/float64 support (including the SDCZ_SYMBOLS above)
SD_SYMBOLS="${SDCZ_SYMBOLS} dot ger labad laev2 lamch lanst lanv2 \
lapy2 larf larfg lasr nrm2 orm2r rot steqr swap"
# All symbols that have complexf32/complexf64 support (including the SDCZ_SYMBOLS above)
CZ_SYMBOLS="${SDCZ_SYMBOLS} dotc geru unm2r"
# Add in (s|d)*_64 symbol remappings:
for sym in ${SD_SYMBOLS}; do
SYMBOL_DEFS="${SYMBOL_DEFS} -Ds${sym}=s${sym}_64 -Dd${sym}=d${sym}_64"
done
# Add in (c|z)*_64 symbol remappings:
for sym in ${CZ_SYMBOLS}; do
SYMBOL_DEFS="${SYMBOL_DEFS} -Dc${sym}=c${sym}_64 -Dz${sym}=z${sym}_64"
done
# Add one-off symbol mappings; things that don't fit into any other bucket:
for sym in scnrm2 dznrm2 csscal zdscal dgetrf dgetrs; do
SYMBOL_DEFS="${SYMBOL_DEFS} -D${sym}=${sym}_64"
done
# Set up not only lowercase symbol remappings, but uppercase as well:
SYMBOL_DEFS="${SYMBOL_DEFS} ${SYMBOL_DEFS^^}"
FFLAGS="${FFLAGS} -O2 -fPIC -ffixed-line-length-none -cpp"
LIBOPENBLAS=openblas
if [[ ${nbits} == 64 ]]; then
LIBOPENBLAS=openblas64_
FFLAGS="${FFLAGS} -fdefault-integer-8 ${SYMBOL_DEFS}"
fi
cmake ../arpack-ng -DCMAKE_INSTALL_PREFIX="$prefix" -DCMAKE_TOOLCHAIN_FILE="/opt/$target/$target.toolchain" -DBUILD_SHARED_LIBS=ON -DBLAS_LIBRARIES="-L$prefix/lib -l${LIBOPENBLAS}" -DLAPACK_LIBRARIES="-L$prefix/lib -l${LIBOPENBLAS}" -DCMAKE_Fortran_FLAGS="${FFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${EXE_LINK_FLAGS}"
make -j${nproc} VERBOSE=1
make install VERBOSE=1
# For now, we'll have to adjust the name of the OpenBLAS library on macOS.
# Eventually, this should be fixed upstream
if [[ ${target} == "x86_64-apple-darwin14" ]]; then
echo "-- Modifying library name for OpenBLAS"
install_name_tool -change libopenblas64_.0.3.0.dev.dylib libopenblas64_.dylib ${prefix}/lib/libarpack.2.0.0.dylib
fi
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line. We enable the full
# combinatorial explosion of GCC versions because this package most
# definitely links against libgfortran.
platforms = expand_gcc_versions(supported_platforms())
# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "libarpack", :libarpack)
]
# Dependencies that must be installed before this package can be built
dependencies = [
"https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases/download/v0.3.0-3/build_OpenBLAS.v0.3.0.jl"
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)