/
build_tarballs.jl
88 lines (72 loc) · 3.03 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
using BinaryBuilder
name = "p7zip"
version_string = "17.04"
version = VersionNumber(version_string)
# Collection of sources required to build p7zip
sources = [
GitSource("https://github.com/p7zip-project/p7zip",
"0b5b1b1a866d0e41cb7945e60a32262874e724aa"),
FileSource("https://downloads.sourceforge.net/project/sevenzip/7-Zip/21.07/7z2107.exe",
"71e94e6038f4d42ed8f0f38c0e6c3846f21d13527139efa9ef8b8f6312ab6c90"),
FileSource("https://downloads.sourceforge.net/project/sevenzip/7-Zip/21.07/7z2107-x64.exe",
"0b461f0a0eccfc4f39733a80d70fd1210fdd69f600fb6b657e03940a734e5fc1"),
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/p7zip*/
if [[ ${bb_full_target} == *-sanitize+memory* ]]; then
# Install msan runtime (for clang)
cp -rL ${libdir}/linux/* /opt/x86_64-linux-musl/lib/clang/*/lib/linux/
fi
if [[ ${target} == *mingw* ]]; then
# It's incredibly frustrating to build p7zip on mingw, so instead we just redistribute 7z
apk add p7zip
if [[ ${target} == i686* ]]; then
7z x -y ${WORKSPACE}/srcdir/7z2107.exe 7z.exe 7z.dll License.txt
else
7z x -y ${WORKSPACE}/srcdir/7z2107-x64.exe 7z.exe 7z.dll License.txt
fi
install_license License.txt
chmod +x 7z.exe 7z.dll
mkdir ${prefix}/bin
cp -a 7z.exe 7z.dll ${prefix}/bin
else
# Build requirements
apk add nasm yasm
# Convert from target to makefile
target_makefile()
{
case "${target}" in
x86_64-linux*) echo makefile.linux_amd64_asm;;
i686-linux*) echo makefile.linux_x86_asm_gcc_4.X;;
powerpc64le*linux*) echo makefile.linux_cross_ppc64le;;
aarch64*linux*) echo makefile.linux_cross_aarch64;;
arm-*linux*) echo makefile.linux_cross_arm;;
x86_64-*freebsd*) echo makefile.freebsd6+;;
x86_64-*darwin*) echo makefile.macosx_llvm_64bits;;
aarch64-*darwin*) echo makefile.macosx_llvm_64bits;;
esac
}
cp $(target_makefile) makefile.machine
# clang doesn't like this c++11 narrowing, so we disable the error
if [[ "${target}" == *darwin* ]] || [[ "${target}" == *freebsd* ]]; then
CXXFLAGS="${CXXFLAGS} -Wno-c++11-narrowing"
fi
install_license DOC/License.txt
make -j${nproc} 7za CC="${CC} ${CFLAGS}" CXX="${CXX} ${CXXFLAGS}"
mkdir -p ${prefix}/bin
cp -a bin/7za ${prefix}/bin/7z
fi
"""
# We enable experimental platforms as this is a core Julia dependency
platforms = supported_platforms(;experimental=true)
push!(platforms, Platform("x86_64", "linux"; sanitize="memory"))
# The products that we will ensure are always built
products = [
ExecutableProduct("7z", :p7zip),
]
# Dependencies that must be installed before this package can be built
dependencies = [
BuildDependency("LLVMCompilerRT_jll"; platforms=[Platform("x86_64", "linux"; sanitize="memory")]),
]
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")