-
Notifications
You must be signed in to change notification settings - Fork 511
/
build_tarballs.jl
100 lines (82 loc) · 3.42 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
98
99
100
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, BinaryBuilderBase, Pkg, Base.BinaryPlatforms
name = "xtrx"
version = v"0.1.2"
# Collection of sources required to complete build
sources = [
GitSource("https://github.com/xtrx-sdr/libxtrxdsp", "eec28640c0ebd5639b642f07b310a0a0d02d9834"),
GitSource("https://github.com/xtrx-sdr/libxtrxll", "1b6eddfbedc700efb6f7e3c3594e43ac6ff29ea4"),
GitSource("https://github.com/xtrx-sdr/libxtrx", "acb0b1cf7ab92744034767a04c1d4b4c281b840f"),
GitSource("https://github.com/xtrx-sdr/liblms7002m", "b07761b7386181f0e6a35158456b75bce14f2aca"),
DirectorySource("bundled"),
]
# Bash recipe for building across all platforms
script = raw"""
# Apply our patches
cd ${WORKSPACE}/srcdir
for f in ${WORKSPACE}/srcdir/patches/*.patch; do
atomic_patch -p1 ${f}
done
# liblms7002m requires python3 and cheetah to perform build-time templating
apk add python3 py3-cheetah
if [[ ${bb_target} == x86_64-* ]] || [[ ${bb_target} == i686-* ]]; then
XTRX_ARCH=x86
elif [[ ${bb_target} == aarch64-* ]] || [[ ${bb_target} == arm* ]]; then
XTRX_ARCH=arm
fi
CMAKE_ARGS=(
"-DCMAKE_INSTALL_PREFIX=${prefix}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}"
"-DCMAKE_BUILD_TYPE=Release"
# CC_ARCH isn't set properly; just override
"-DFORCE_ARCH=${XTRX_ARCH}"
# Install utilities to `bin`
"-DXTRXDSP_UTILS_DIR=${bindir}"
"-DXTRXLL_UTILS_DIR=${bindir}"
)
mkdir ${WORKSPACE}/srcdir/liblms7002m_build
cd ${WORKSPACE}/srcdir/liblms7002m_build
cmake ${CMAKE_ARGS[@]} ${WORKSPACE}/srcdir/liblms7002m
make -j${nproc}
make install
mkdir ${WORKSPACE}/srcdir/libxtrxdsp_build
cd ${WORKSPACE}/srcdir/libxtrxdsp_build
cmake ${CMAKE_ARGS[@]} ${WORKSPACE}/srcdir/libxtrxdsp
make -j${nproc}
make install
mkdir ${WORKSPACE}/srcdir/libxtrxll_build
cd ${WORKSPACE}/srcdir/libxtrxll_build
cmake ${CMAKE_ARGS[@]} -DENABLE_PCIE=ON ${WORKSPACE}/srcdir/libxtrxll
make -j${nproc}
make install
mkdir ${WORKSPACE}/srcdir/libxtrx_build
cd ${WORKSPACE}/srcdir/libxtrx_build
cmake ${CMAKE_ARGS[@]} ${WORKSPACE}/srcdir/libxtrx
make -j${nproc}
make install
install_license ${WORKSPACE}/srcdir/libxtrx/LICENSE
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms(; experimental=true)
# Disable everything except glibc Linux for now, and only intel/arm processors
filter!(p -> Sys.islinux(p) && libc(p) == "glibc" && proc_family(p) ∈ ("intel", "arm"), platforms)
platforms = expand_cxxstring_abis(platforms)
# The products that we will ensure are always built
products = [
ExecutableProduct("test_xtrxll", :test_xtrxll),
ExecutableProduct("test_xtrxflash", :test_xtrxflash),
ExecutableProduct("test_xtrx", :test_xtrxflash),
LibraryProduct("libxtrx", :libxtrx),
LibraryProduct("libxtrxll", :libxtrxll),
LibraryProduct("libxtrxdsp", :libxtrxdsp),
LibraryProduct("liblms7compact", :liblms7compact),
LibraryProduct("libXTRXSupport", :libXTRXSupport, ["lib/SoapySDR/modules0.8"]),
]
# Dependencies that must be installed before this package can be built
dependencies = Dependency[
Dependency("soapysdr_jll"),
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"7")