2022-06-21 17:10:38 -04:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2022-07-28 04:46:55 -04:00
|
|
|
source $(dirname "$0")/man_create.sh
|
2022-10-03 15:10:45 -04:00
|
|
|
target=$1
|
2022-07-28 04:46:55 -04:00
|
|
|
|
2024-06-12 04:16:00 -04:00
|
|
|
if [ ! -f 'frontend/package.json' ]; then
|
2023-07-06 05:42:14 -04:00
|
|
|
git submodule update --init
|
|
|
|
fi
|
|
|
|
|
2022-10-03 15:10:45 -04:00
|
|
|
if [[ -n $target ]]; then
|
|
|
|
targets=($target)
|
|
|
|
else
|
2024-01-03 17:04:49 -05:00
|
|
|
targets=("x86_64-unknown-linux-musl" "aarch64-unknown-linux-gnu" "x86_64-pc-windows-gnu" "x86_64-apple-darwin" "aarch64-apple-darwin")
|
2022-10-03 15:10:45 -04:00
|
|
|
fi
|
2022-06-21 17:10:38 -04:00
|
|
|
|
|
|
|
IFS="= "
|
|
|
|
while read -r name value; do
|
|
|
|
if [[ $name == "version" ]]; then
|
|
|
|
version=${value//\"/}
|
|
|
|
fi
|
2023-02-08 11:02:49 -05:00
|
|
|
done < Cargo.toml
|
2022-06-21 17:10:38 -04:00
|
|
|
|
2023-01-11 09:29:41 -05:00
|
|
|
echo "Compile ffplayout \"$version\""
|
2022-06-21 17:10:38 -04:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
for target in "${targets[@]}"; do
|
|
|
|
echo "compile static for $target"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
if [[ $target == "x86_64-pc-windows-gnu" ]]; then
|
2022-06-23 16:39:13 -04:00
|
|
|
if [[ -f "ffplayout-v${version}_${target}.zip" ]]; then
|
|
|
|
rm -f "ffplayout-v${version}_${target}.zip"
|
2022-06-21 17:10:38 -04:00
|
|
|
fi
|
|
|
|
|
2024-04-26 05:56:01 -04:00
|
|
|
cross build --release --target=$target
|
2022-06-23 16:39:13 -04:00
|
|
|
|
2022-06-21 17:10:38 -04:00
|
|
|
cp ./target/${target}/release/ffplayout.exe .
|
2024-06-18 02:55:55 -04: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 04:16:00 -04:00
|
|
|
rm -f ffplayout.exe
|
2022-06-23 16:39:13 -04:00
|
|
|
else
|
|
|
|
if [[ -f "ffplayout-v${version}_${target}.tar.gz" ]]; then
|
|
|
|
rm -f "ffplayout-v${version}_${target}.tar.gz"
|
2022-06-21 17:10:38 -04:00
|
|
|
fi
|
|
|
|
|
2024-04-26 05:56:01 -04:00
|
|
|
cross build --release --target=$target
|
2022-06-21 17:10:38 -04:00
|
|
|
|
2024-06-28 11:09:40 -04: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 17:10:38 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
done
|
|
|
|
|
2024-02-23 05:25:01 -05:00
|
|
|
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "x86_64-unknown-linux-musl" ]]; then
|
2024-06-12 04:16:00 -04:00
|
|
|
cargo deb --no-build --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout/Cargo.toml -o ffplayout_${version}-1_amd64.deb
|
|
|
|
cargo generate-rpm --payload-compress none --target=x86_64-unknown-linux-musl -p ffplayout -o ffplayout-${version}-1.x86_64.rpm
|
2022-10-03 15:10:45 -04:00
|
|
|
fi
|
2022-06-21 17:10:38 -04:00
|
|
|
|
2024-02-23 05:25:01 -05:00
|
|
|
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "aarch64-unknown-linux-gnu" ]]; then
|
2024-06-12 04:16:00 -04:00
|
|
|
cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout/Cargo.toml -o ffplayout_${version}-1_arm64.deb
|
2022-10-03 15:10:45 -04:00
|
|
|
fi
|