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
|
|
|
|
2022-08-19 07:45:35 -04:00
|
|
|
echo "build frontend"
|
|
|
|
echo
|
2022-07-26 07:08:49 -04:00
|
|
|
|
2022-08-19 07:45:35 -04:00
|
|
|
yes | rm -rf public
|
|
|
|
cd ffplayout-frontend
|
|
|
|
|
|
|
|
npm install
|
|
|
|
npm run build
|
|
|
|
mv dist ../public
|
|
|
|
|
|
|
|
cd ..
|
2022-07-26 07:08:49 -04:00
|
|
|
|
2022-10-03 15:10:45 -04:00
|
|
|
if [[ -n $target ]]; then
|
|
|
|
targets=($target)
|
|
|
|
else
|
|
|
|
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 17:10:38 -04:00
|
|
|
|
|
|
|
IFS="= "
|
|
|
|
while read -r name value; do
|
|
|
|
if [[ $name == "version" ]]; then
|
|
|
|
version=${value//\"/}
|
|
|
|
fi
|
|
|
|
done < ffplayout-engine/Cargo.toml
|
|
|
|
|
2022-06-23 16:39:13 -04:00
|
|
|
echo "Compile ffplayout version is: \"$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
|
|
|
|
|
2022-06-23 16:39:13 -04:00
|
|
|
cargo build --release --target=$target
|
|
|
|
|
|
|
|
cp ./target/${target}/release/ffpapi.exe .
|
2022-06-21 17:10:38 -04:00
|
|
|
cp ./target/${target}/release/ffplayout.exe .
|
2022-10-23 15:51:24 -04:00
|
|
|
zip -r "ffplayout-v${version}_${target}.zip" assets docs public LICENSE README.md CHANGELOG.md ffplayout.exe ffpapi.exe -x *.db
|
2022-06-23 16:39:13 -04:00
|
|
|
rm -f ffplayout.exe ffpapi.exe
|
2022-06-21 17:10:38 -04:00
|
|
|
elif [[ $target == "x86_64-apple-darwin" ]] || [[ $target == "aarch64-apple-darwin" ]]; then
|
2022-06-23 16:39:13 -04:00
|
|
|
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
|
|
|
|
|
2022-07-27 11:58:56 -04:00
|
|
|
CC="x86_64-apple-darwin20.4-cc" cargo build --release --target=$target
|
2022-06-21 17:10:38 -04:00
|
|
|
|
2022-07-27 11:58:56 -04:00
|
|
|
cp ./target/${target}/release/ffpapi .
|
2022-06-21 17:10:38 -04:00
|
|
|
cp ./target/${target}/release/ffplayout .
|
2022-10-23 15:51:24 -04:00
|
|
|
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs public LICENSE README.md CHANGELOG.md ffplayout ffpapi
|
2022-07-27 11:58:56 -04:00
|
|
|
rm -f ffplayout ffpapi
|
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
|
|
|
|
|
2022-06-23 16:39:13 -04:00
|
|
|
cargo build --release --target=$target
|
2022-06-21 17:10:38 -04:00
|
|
|
|
|
|
|
cp ./target/${target}/release/ffpapi .
|
2022-06-23 16:39:13 -04:00
|
|
|
cp ./target/${target}/release/ffplayout .
|
2022-10-23 15:51:24 -04:00
|
|
|
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs public LICENSE README.md CHANGELOG.md ffplayout ffpapi
|
2022-06-23 16:39:13 -04:00
|
|
|
rm -f ffplayout ffpapi
|
2022-06-21 17:10:38 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
done
|
|
|
|
|
2022-10-19 03:36:19 -04:00
|
|
|
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "x86_64-unknown-linux-musl" ]]; then
|
2022-10-03 15:10:45 -04:00
|
|
|
cargo deb --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_amd64.deb
|
|
|
|
cd ffplayout-engine
|
|
|
|
cargo generate-rpm --target=x86_64-unknown-linux-musl -o ../ffplayout-${version}-1.x86_64.rpm
|
2022-07-20 06:09:52 -04:00
|
|
|
|
2022-10-03 15:10:45 -04:00
|
|
|
cd ..
|
|
|
|
fi
|
2022-06-21 17:10:38 -04:00
|
|
|
|
2022-10-19 03:36:19 -04:00
|
|
|
if [[ "${#targets[@]}" == "5" ]] || [[ $targets == "aarch64-unknown-linux-gnu" ]]; then
|
2022-10-03 15:10:45 -04:00
|
|
|
cargo deb --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_arm64.deb
|
|
|
|
fi
|