Merge pull request #9 from mycognosist/deb_cross_compilation

Update instructions for cross-compiling and building deb packages
This commit is contained in:
glyph 2020-11-10 09:09:00 +00:00 committed by GitHub
commit 1d1d42762f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -24,13 +24,17 @@ These instructions cover cross-compilation for Debian Buster running on a Raspbe
`export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc`
Alternatively, create a file named `cargo-config` in the root directory of the crate and add the following:
Alternatively, create a file named `config` in the `~/.cargo` directory of the home user and add the following:
```bash
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
objcopy = { path ="aarch64-linux-gnu-objcopy" }
strip = { path ="aarch64-linux-gnu-strip" }
```
The `objcopy` and `strip` parameters are needed by `cargo deb` when cross-compiling Debian packages.
**Compile release build:**
`cargo build --release --target=aarch64-unknown-linux-gnu`

View File

@ -4,16 +4,26 @@ The microservices comprising the PeachCloud software suite are packaged for easy
Each microservice repository includes a `debian` directory which includes a `systemd` service file and Debian maintainer scripts, including `postinst`, `postrm` and `prerm` scripts. These scripts define behavior for installing and uninstalling the respective services. `deb` packages are created using the `cargo-deb` tool ([crate](https://crates.io/crates/cargo-deb)).
Microservices can be installed with `dpkg` as follows:
**Install cargo-deb:**
`cargo install cargo-deb`
**Create the package:**
`cargo deb --target aarch64-unknown-linux-gnu`
Note: the correct linker, objcopy and strip parameters must be defined in `~/.cargo/config` for the above command to execute successfully. Visit the [Compilation](/software/compilation.md) page and look under 'Configure the linker' for more details.
**Install the package:**
`sudo dpkg -i peach-network_0.1.0_arm64.deb`
The service will be automatically enabled and started.
Uninstall the service:
**Uninstall the package:**
`sudo apt-get remove peach-network`
Remove configuration files (not removed with `apt-get remove`):
**Remove configuration files** (not removed with `apt-get remove`):
`sudo apt-get purge peach-network`