-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·51 lines (47 loc) · 2.25 KB
/
build.sh
File metadata and controls
executable file
·51 lines (47 loc) · 2.25 KB
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
#!/bin/bash
set -e
# Function to build for a target using dockcross
build_with_dockcross() {
local docker_image="$1"
local script_name="$2"
local output_ext="$3"
local runtime_dir="$4"
echo "\n==== Building for $runtime_dir ===="
rm -f CMakeCache.txt
mkdir -p "$runtime_dir"
docker run --rm "$docker_image" > "docker/$script_name"
chmod +x "docker/$script_name"
"docker/$script_name" cmake -DCMAKE_BUILD_TYPE=Release -DAARU_BUILD_PACKAGE=1 .
"docker/$script_name" make
mv "libaaruformat.$output_ext" "$runtime_dir/"
rm -f "docker/$script_name"
}
# Linux targets
build_with_dockcross dockcross/linux-armv7a-lts dockcross-linux-arm so runtimes/linux-arm/native
build_with_dockcross dockcross/linux-arm64-lts dockcross-linux-arm64 so runtimes/linux-arm64/native
build_with_dockcross dockcross/linux-mips dockcross-linux-mips64 so runtimes/linux-mips64/native
build_with_dockcross dockcross/linux-arm64-musl dockcross-linux-musl-arm64 so runtimes/linux-musl-arm64/native
build_with_dockcross dockcross/linux-s390x dockcross-linux-s390x so runtimes/linux-s390x/native
build_with_dockcross dockcross/linux-x64 dockcross-linux-x64 so runtimes/linux-x64/native
build_with_dockcross dockcross/linux-x86 dockcross-linux-x86 so runtimes/linux-x86/native
build_with_dockcross dockcross/linux-ppc64le dockcross-linux-ppc64le so runtimes/linux-ppc64le/native
# Windows targets
build_with_dockcross dockcross/windows-armv7 dockcross-win-arm dll runtimes/win-arm/native
build_with_dockcross dockcross/windows-arm64 dockcross-win-arm64 dll runtimes/win-arm64/native
build_with_dockcross dockcross/windows-shared-x64 dockcross-win-x64 dll runtimes/win-x64/native
build_with_dockcross dockcross/windows-shared-x86 dockcross-win-x86 dll runtimes/win-x86/native
# Mac OS X targets
if [[ $(uname) == Darwin ]]; then
build_macos() {
local arch="$1"
local runtime_dir="$2"
echo "\n==== Building for $runtime_dir ===="
rm -f CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=Release -DAARU_BUILD_PACKAGE=1 -DAARU_MACOS_TARGET_ARCH="$arch" .
make
mkdir -p "$runtime_dir"
mv libaaruformat.dylib "$runtime_dir/"
}
build_macos x86_64 runtimes/osx-x64/native
build_macos arm64 runtimes/osx-arm64/native
fi