ffplayout/scripts/build.sh

57 lines
2.0 KiB
Bash
Raw Normal View History

2022-06-21 23:10:38 +02:00
#!/usr/bin/bash
source $(dirname "$0")/man_create.sh
target=$1
if [[ -n $target ]]; then
targets=($target)
else
2024-01-03 23:04:49 +01:00
targets=("x86_64-unknown-linux-musl" "aarch64-unknown-linux-gnu" "x86_64-pc-windows-gnu" "x86_64-apple-darwin" "aarch64-apple-darwin")
fi
2022-06-21 23:10:38 +02:00
IFS="= "
while read -r name value; do
if [[ $name == "version" ]]; then
version=${value//\"/}
fi
2023-02-08 17:02:49 +01:00
done < Cargo.toml
2022-06-21 23:10:38 +02:00
2023-01-11 15:29:41 +01:00
echo "Compile ffplayout \"$version\""
2022-06-21 23:10:38 +02:00
echo ""
for target in "${targets[@]}"; do
echo "compile static for $target"
echo ""
if [[ $target == "x86_64-pc-windows-gnu" ]]; then
2022-06-23 22:39:13 +02:00
if [[ -f "ffplayout-v${version}_${target}.zip" ]]; then
rm -f "ffplayout-v${version}_${target}.zip"
2022-06-21 23:10:38 +02:00
fi
2024-04-26 11:56:01 +02:00
cross build --release --target=$target
2022-06-23 22:39:13 +02:00
2022-06-21 23:10:38 +02:00
cp ./target/${target}/release/ffplayout.exe .
2024-06-18 08:55:55 +02:00
zip -r "ffplayout-v${version}_${target}.zip" assets docker docs LICENSE README.md CHANGELOG.md ffplayout.exe -x *.db -x *.db-shm -x *.db-wal -x *.service
2024-06-12 10:16:00 +02:00
rm -f ffplayout.exe
2022-06-23 22:39:13 +02:00
else
if [[ -f "ffplayout-v${version}_${target}.tar.gz" ]]; then
rm -f "ffplayout-v${version}_${target}.tar.gz"
2022-06-21 23:10:38 +02:00
fi
2024-04-26 11:56:01 +02:00
cross build --release --target=$target
2022-06-21 23:10:38 +02:00
2024-06-28 17:09:40 +02:00
tar --transform 's/\.\/target\/.*\///g' -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' --exclude='*.db-shm' --exclude='*.db-wal' assets docker docs LICENSE README.md CHANGELOG.md ./target/${target}/release/ffplayout
2022-06-21 23:10:38 +02:00
fi
echo ""
done
2024-02-23 11:25:01 +01:00
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "x86_64-unknown-linux-musl" ]]; then
2024-09-27 12:22:42 +02:00
cargo deb --no-build --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=engine/Cargo.toml -o ffplayout_${version}-1_amd64.deb
cargo generate-rpm --payload-compress none --target=x86_64-unknown-linux-musl -p engine -o ffplayout-${version}-1.x86_64.rpm
fi
2022-06-21 23:10:38 +02:00
2024-02-23 11:25:01 +01:00
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "aarch64-unknown-linux-gnu" ]]; then
2024-09-27 12:22:42 +02:00
cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=engine/Cargo.toml -o ffplayout_${version}-1_arm64.deb
fi