-
Notifications
You must be signed in to change notification settings - Fork 575
/
Copy pathcommon.jl
122 lines (103 loc) · 4.2 KB
/
common.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg
function configure(version_offset, min_julia_version)
# The version of this JLL is decoupled from the upstream version.
# Whenever we package a new upstream release, we initially map its
# version X.Y.Z to X00.Y00.Z00 (i.e., multiply each component by 100).
# So for example version 2.6.3 would become 200.600.300.
name = "NetCDF"
upstream_version = v"4.9.0"
version = VersionNumber(upstream_version.major * 100 + version_offset.major,
upstream_version.minor * 100 + version_offset.minor,
upstream_version.patch * 100 + version_offset.patch)
# Collection of sources required to build NetCDF
sources = [
ArchiveSource("https://github.com/Unidata/netcdf-c/archive/v$(upstream_version).zip",
"76fbe29d8baa37073a3e465f3a71bb063849906067f9867b24f6a6d67281281c"),
DirectorySource("../bundled"),
]
# HDF5.h in /workspace/artifacts/805ccba77cd286c1afc127d1e45aae324b507973/include
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/netcdf-c-*
export CPPFLAGS="-I${includedir}"
export CFLAGS="-std=c99"
export LDFLAGS="-L${libdir}"
export LDFLAGS_MAKE="${LDFLAGS}"
CONFIGURE_OPTIONS=""
for p in ../patches/*.patch; do
atomic_patch -p1 "${p}"
done
if [[ ${target} == *-mingw* ]]; then
export LIBS="-lhdf5-0 -lhdf5_hl-0 -lcurl-4 -lz"
# linking fails with: "libtool: error: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified"
# unless -no-undefined is added to LDFLAGS
LDFLAGS_MAKE="${LDFLAGS} ${LIBS} -no-undefined -Wl,--export-all-symbols"
# additional configure options from
# https://github.com/Unidata/netcdf-c/blob/5df5539576c5b2aa8f31d4b50c4f8258925589dd/.github/workflows/run_tests_win_mingw.yml#L38
CONFIGURE_OPTIONS="--disable-plugins --disable-byterange"
elif [[ "${target}" == *-apple-* ]]; then
# this file is referenced by hdf.h by not installed
touch ${includedir}/features.h
fi
if [[ ${target} -ne x86_64-linux-gnu ]]; then
# utilities are necessary to run the tests
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --disable-utilities"
fi
./configure --prefix=${prefix} \
--build=${MACHTYPE} \
--host=${target} \
--enable-shared \
--disable-static \
--disable-dap-remote-tests \
$CONFIGURE_OPTIONS
make LDFLAGS="${LDFLAGS_MAKE}" -j${nproc}
if [[ ${target} == x86_64-linux-gnu ]]; then
make check
fi
make install
nc-config --all
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
# Set equal to the supported platforms in HDF5
platforms = [
Platform("x86_64", "linux"),
# HDF5_jll on armv7l should use the same glibc as the root filesystem
# before it can be used
# https://github.com/JuliaPackaging/Yggdrasil/pull/1090#discussion_r432683488
# Platform("armv7l", "linux"; libc="glibc"),
Platform("aarch64", "linux"; libc="glibc"),
Platform("x86_64", "macos"),
Platform("x86_64", "windows"),
Platform("i686", "windows"),
]
if min_julia_version ≥ v"1.6"
push!(platforms, Platform("aarch64","macos"))
end
# The products that we will ensure are always built
products = [
LibraryProduct("libnetcdf", :libnetcdf),
]
# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="HDF5_jll"), compat="1.12.2"),
Dependency("Zlib_jll"),
Dependency("XML2_jll"),
]
jll_stdlibs = Dict(
v"1.3" => [
Dependency("LibCURL_jll"; compat = "~7.71.1"),
],
v"1.6" => [
Dependency("LibCURL_jll"; compat = "~7.73.0"),
],
v"1.8" => [
Dependency("LibCURL_jll"; compat = "~7.84.0"),
]
)
append!(dependencies, jll_stdlibs[min_julia_version])
# Build the tarballs, and possibly a `build.jl` as well.
return name, version, sources, script, platforms, products, dependencies
end