diff --git a/docs/developer.md b/docs/developer.md index 30d99aa2..8fa3ff4f 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -67,6 +67,54 @@ CC="aarch64-apple-darwin20.4-clang -arch arm64e" cargo build --release --target= CC="o64-clang" cargo build --release --target=x86_64-apple-darwin ``` +### Compile for armv7 Linux + +Add toolchain: + +```Bash +rustup target add armv7-unknown-linux-gnueabihf +``` + +Add cross compiler: + +```Bash +dnf copr enable lantw44/arm-linux-gnueabihf-toolchain + +dnf install arm-linux-gnueabihf-{binutils,gcc,glibc} +``` + +Add target to `~/.cargo/config`: + +```Bash +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" +rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] +``` + +### Compile for aarch64 Linux + +Add toolchain: + +```Bash +rustup target add aarch64-unknown-linux-gnu +``` + +Add cross compiler: + +```Bash +dnf copr enable lantw44/aarch64-linux-gnu-toolchain + +dnf install aarch64-linux-gnu-{binutils,gcc,glibc} +``` + +Add target to `~/.cargo/config`: + +```Bash +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" +rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] +``` + ### Create debian DEB and RHEL RPM packages install: @@ -79,6 +127,12 @@ And run with: # for debian based systems: cargo deb --target=x86_64-unknown-linux-musl +# for armhf +cargo deb --target=armv7-unknown-linux-gnueabihf --variant=armhf -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml + +# for arm64 +cargo deb --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml + # for rhel based systems: cargo generate-rpm --target=x86_64-unknown-linux-musl ``` diff --git a/ffplayout-engine/Cargo.toml b/ffplayout-engine/Cargo.toml index 98cde9ee..f1cbfd3c 100644 --- a/ffplayout-engine/Cargo.toml +++ b/ffplayout-engine/Cargo.toml @@ -58,6 +58,40 @@ assets = [ maintainer-scripts = "../debian/" systemd-units = { enable = false, unit-scripts = "../assets" } +[package.metadata.deb.variants.armhf] +assets = [ + ["../target/armv7-unknown-linux-gnueabihf/release/ffpapi", "/usr/bin/", "755"], + [ + "../target/armv7-unknown-linux-gnueabihf/release/ffplayout", + "/usr/bin/", + "755" + ], + ["../assets/ffpapi.service", "/lib/systemd/system/", "644"], + ["../assets/ffplayout@.service", "/lib/systemd/system/", "644"], + ["../assets/11-ffplayout", "/etc/sudoers.d/", "644"], + ["../assets/ffplayout.yml", "/etc/ffplayout/", "644"], + ["../assets/logo.png", "/usr/share/ffplayout/", "644"], + ["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"], + ["../README.md", "/usr/share/doc/ffplayout/README", "644"], +] + +[package.metadata.deb.variants.arm64] +assets = [ + ["../target/aarch64-unknown-linux-gnu/release/ffpapi", "/usr/bin/", "755"], + [ + "../target/aarch64-unknown-linux-gnu/release/ffplayout", + "/usr/bin/", + "755" + ], + ["../assets/ffpapi.service", "/lib/systemd/system/", "644"], + ["../assets/ffplayout@.service", "/lib/systemd/system/", "644"], + ["../assets/11-ffplayout", "/etc/sudoers.d/", "644"], + ["../assets/ffplayout.yml", "/etc/ffplayout/", "644"], + ["../assets/logo.png", "/usr/share/ffplayout/", "644"], + ["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"], + ["../README.md", "/usr/share/doc/ffplayout/README", "644"], +] + # REHL RPM PACKAGE [package.metadata.generate-rpm] name = "ffplayout" diff --git a/scripts/build_all.sh b/scripts/build_all.sh index 524e66db..c75bf920 100755 --- a/scripts/build_all.sh +++ b/scripts/build_all.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash -targets=("x86_64-unknown-linux-musl" "x86_64-pc-windows-gnu" "x86_64-apple-darwin" "aarch64-apple-darwin") +targets=("x86_64-unknown-linux-musl" "aarch64-unknown-linux-gnu" "x86_64-pc-windows-gnu" "x86_64-apple-darwin" "aarch64-apple-darwin") IFS="= " while read -r name value; do @@ -56,5 +56,9 @@ done cargo deb --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_amd64.deb +cargo deb --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_arm64.deb + +# cargo deb --target=armv7-unknown-linux-gnueabihf --variant=armhf -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_armhf.deb + cargo generate-rpm --target=x86_64-unknown-linux-musl -p ffplayout-engine -o ffplayout-${version}-1.x86_64.rpm