forked from jellyfin/jellyfin-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·112 lines (103 loc) · 2.49 KB
/
build
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
#!/usr/bin/env bash
usage() {
echo -e "Build Jellyfin FFMPEG deb packages"
echo -e " $0 <release> <arch>"
echo -e "Releases: Arches:"
echo -e " * buster * amd64"
echo -e " * bullseye * armhf"
echo -e " * bookworm * arm64"
echo -e " * focal"
echo -e " * jammy"
echo -e " * noble"
}
if [[ -z ${1} ]]; then
usage
exit 1
fi
cli_release="${1}"
case ${cli_release} in
'buster')
release="debian:buster"
gcc_version="8"
llvm_version="13"
;;
'bullseye')
release="debian:bullseye"
gcc_version="10"
llvm_version="16"
;;
'bookworm')
release="debian:bookworm"
gcc_version="12"
llvm_version="16"
;;
'focal')
release="ubuntu:focal"
gcc_version="9"
llvm_version="12"
;;
'jammy')
release="ubuntu:jammy"
gcc_version="11"
llvm_version="15"
;;
'noble')
release="ubuntu:noble"
gcc_version="13"
llvm_version="17"
;;
*)
echo "Invalid release."
usage
exit 1
;;
esac
cli_arch="${2}"
case ${cli_arch} in
'amd64')
arch="amd64"
;;
'armhf')
arch="armhf"
;;
'arm64')
arch="arm64"
;;
*)
echo "Invalid architecture."
usage
exit 1
;;
esac
set -o xtrace
set -o errexit
# Check for dependencies
for dep in docker make mmv; do
command -v ${dep} &>/dev/null || { echo "The command '${dep}' is required."; exit 1; }
done
image_name="jellyfin-ffmpeg-build-${cli_release}"
package_temporary_dir="$( mktemp -d )"
current_user="$( whoami )"
# Trap cleanup for latter sections
cleanup() {
# Clean up the Dockerfile
make -f Dockerfile.make clean
# Remove tempdir
rm -rf "${package_temporary_dir}"
}
trap cleanup EXIT INT
# Generate Dockerfile
make -f Dockerfile.make DISTRO=${release} GCC_VER=${gcc_version} LLVM_VER=${llvm_version} ARCH=${arch}
# Set up the build environment docker image
docker build . -t "${image_name}"
# Build the APKs and copy out to ${package_temporary_dir}
docker run --rm -e "RELEASE=${release}" -v "${package_temporary_dir}:/dist" "${image_name}"
# If no 3rd parameter was specified, move APKs to parent directory
if [[ -z ${3} ]]; then
path="../bin"
else
path="${3}"
fi
mkdir ${path} &>/dev/null || true
mmv "${package_temporary_dir}/deb/*.deb" "${path}/#1.deb"
mmv "${package_temporary_dir}/deb/*_${arch}.*" "${path}/#1-${cli_release}_${arch}.#2"