ffplayout/cross_compile_all.sh

55 lines
1.5 KiB
Bash
Raw Normal View History

2022-03-28 10:36:07 -04:00
#!/usr/bin/bash
targets=("x86_64-unknown-linux-musl" "x86_64-pc-windows-gnu" "x86_64-apple-darwin" "aarch64-apple-darwin")
IFS="= "
while read -r name value; do
if [[ $name == "version" ]]; then
version=${value//\"/}
fi
done < Cargo.toml
2022-04-14 11:18:32 -04:00
echo "Compile ffplayout-engine version is: \"$version\""
2022-03-28 10:36:07 -04:00
echo ""
for target in "${targets[@]}"; do
echo "compile static for $target"
echo ""
cargo build --release --target=$target
if [[ $target == "x86_64-pc-windows-gnu" ]]; then
2022-04-14 11:18:32 -04:00
if [[ -f "ffplayout-engine-v${version}_${target}.zip" ]]; then
rm -f "ffplayout-engine-v${version}_${target}.zip"
2022-03-31 15:37:02 -04:00
fi
2022-03-28 10:36:07 -04:00
cp ./target/${target}/release/ffplayout.exe .
2022-04-14 11:18:32 -04:00
zip -r "ffplayout-engine-v${version}_${target}.zip" assets docs LICENSE README.md ffplayout.exe
2022-03-28 10:36:07 -04:00
rm -f ffplayout.exe
else
2022-04-14 11:18:32 -04:00
if [[ -f "ffplayout-engine-v${version}_${target}.tar.gz" ]]; then
rm -f "ffplayout-engine-v${version}_${target}.tar.gz"
2022-03-31 15:37:02 -04:00
fi
2022-03-28 10:36:07 -04:00
cp ./target/${target}/release/ffplayout .
2022-04-14 11:18:32 -04:00
tar -czvf "ffplayout-engine-v${version}_${target}.tar.gz" assets docs LICENSE README.md ffplayout
2022-03-28 10:36:07 -04:00
rm -f ffplayout
fi
echo ""
done
2022-04-12 15:39:53 -04:00
echo "Create debian package"
echo ""
cargo deb --target=x86_64-unknown-linux-musl
mv ./target/x86_64-unknown-linux-musl/debian/ffplayout-engine_${version}_amd64.deb .
2022-04-14 10:13:38 -04:00
echo ""
2022-04-12 15:39:53 -04:00
echo "Create rhel package"
echo ""
cargo generate-rpm --target=x86_64-unknown-linux-musl
mv ./target/x86_64-unknown-linux-musl/generate-rpm/ffplayout-engine-${version}-1.x86_64.rpm .