ffplayout/docs/developer.md

115 lines
2.7 KiB
Markdown
Raw Normal View History

2022-12-04 05:12:01 -05:00
## Build ffplayout
For compiling use always the news Rust version, the best is to install it from [rustup](https://rustup.rs/).
2022-03-15 11:16:35 -04:00
### Static Linking
Running `cargo build` ends up in a binary which depend on **libc.so**. But you can compile also the binary totally static:
- install musl compiler:
- `dnf install musl-gcc`
- add target:
- `rustup target add x86_64-unknown-linux-musl`
Compile with: `cargo build --release --target=x86_64-unknown-linux-musl`.
This release should run on any Linux distro.
2022-03-24 09:49:42 -04:00
2024-04-26 05:56:01 -04:00
**Note: You can also create a static version with Cross Toolchain. For this, follow the next steps.**
### Cross Compile
For cross compiling install docker or podman and latest [cross-rs](https://github.com/cross-rs/cross):
```
cargo install cross --git https://github.com/cross-rs/cross
```
To build for windows, run: `cross build --release --target x86_64-pc-windows-gnu`\
To build for linux aarch64: `cross build --release --target aarch64-unknown-linux-gnu`
Etc.
2022-03-24 09:49:42 -04:00
### Compile from Linux for macOS
2024-04-26 07:54:33 -04:00
Follow [cross-toolchains](https://github.com/cross-rs/cross-toolchains) instruction to add macOS support to cross.
2022-03-24 09:49:42 -04:00
2024-04-26 07:54:33 -04:00
I created my image with:
2022-03-24 09:49:42 -04:00
```
2024-04-26 07:54:33 -04:00
cargo build-docker-image x86_64-apple-darwin-cross \
--build-arg 'MACOS_SDK_URL=https://github.com/joseluisq/macosx-sdks/releases/download/12.3/MacOSX12.3.sdk.tar.xz'
```
2024-04-26 07:54:33 -04:00
Build then with:
2022-03-24 09:49:42 -04:00
2024-04-26 07:54:33 -04:00
```
cross build --release --target aarch64-apple-darwin
```
2022-03-24 09:49:42 -04:00
```
2022-04-12 15:39:53 -04:00
### Create debian DEB and RHEL RPM packages
install:
- `cargo install cargo-deb`
- `cargo install cargo-generate-rpm`
2024-04-26 05:56:01 -04:00
Compile to your target system with cargo or cross, and run:
2022-04-12 15:39:53 -04:00
```Bash
# for debian based systems:
2024-04-26 05:56:01 -04:00
cargo deb --no-build --target=x86_64-unknown-linux-musl
2022-04-12 15:39:53 -04:00
2022-07-20 06:09:52 -04:00
# for armhf
2024-04-26 05:56:01 -04:00
cargo deb --no-build --target=armv7-unknown-linux-gnueabihf --variant=armhf -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml
2022-07-20 06:09:52 -04:00
# for arm64
2024-04-26 05:56:01 -04:00
cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml
2022-07-20 06:09:52 -04:00
2022-04-12 15:39:53 -04:00
# for rhel based systems:
cargo generate-rpm --target=x86_64-unknown-linux-musl
```
## Generate types for Frontend
The frontend uses TypeScript, to generate types for the rust structs run: `cargo test`.
The generated types are then in [types folder](/frontend/types).
## Setup Frontend
Make sure to install the dependencies:
```bash
# yarn
yarn install
# npm
npm install
# pnpm
pnpm install --shamefully-hoist
```
## Development Server
Start the development server on http://localhost:3000
```bash
npm run dev
```
## Production
Build the application for production:
```bash
npm run build
```
Locally preview production build:
```bash
npm run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.