Link binary statically with musl
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -609,6 +609,15 @@ version = "0.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-src"
|
||||||
|
version = "111.20.0+1.1.1o"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92892c4f87d56e376e469ace79f1128fdaded07646ddf73aa0be4706ff712dec"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.73"
|
version = "0.9.73"
|
||||||
@@ -618,6 +627,7 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
"openssl-src",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|||||||
12
Cargo.toml
12
Cargo.toml
@@ -2,6 +2,7 @@
|
|||||||
name = "git-repo-manager"
|
name = "git-repo-manager"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
authors = [
|
authors = [
|
||||||
"Hannes Körber <hannes@hkoerber.de>",
|
"Hannes Körber <hannes@hkoerber.de>",
|
||||||
]
|
]
|
||||||
@@ -73,7 +74,8 @@ version = "=1.0.81"
|
|||||||
|
|
||||||
[dependencies.isahc]
|
[dependencies.isahc]
|
||||||
version = "=1.7.2"
|
version = "=1.7.2"
|
||||||
features = ["json"]
|
default-features = false
|
||||||
|
features = ["json", "http2", "text-decoding"]
|
||||||
|
|
||||||
[dependencies.parse_link_header]
|
[dependencies.parse_link_header]
|
||||||
version = "=0.3.2"
|
version = "=0.3.2"
|
||||||
@@ -83,3 +85,11 @@ version = "=0.1.1"
|
|||||||
|
|
||||||
[dev-dependencies.tempdir]
|
[dev-dependencies.tempdir]
|
||||||
version = "=0.3.7"
|
version = "=0.3.7"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
static-build = [
|
||||||
|
"git2/vendored-openssl",
|
||||||
|
"git2/vendored-libgit2",
|
||||||
|
"isahc/static-curl",
|
||||||
|
"isahc/static-ssl",
|
||||||
|
]
|
||||||
|
|||||||
15
Justfile
15
Justfile
@@ -1,5 +1,7 @@
|
|||||||
set positional-arguments
|
set positional-arguments
|
||||||
|
|
||||||
|
target := "x86_64-unknown-linux-musl"
|
||||||
|
|
||||||
check: test
|
check: test
|
||||||
cargo check
|
cargo check
|
||||||
cargo fmt --check
|
cargo fmt --check
|
||||||
@@ -16,23 +18,26 @@ lint-fix:
|
|||||||
cargo clippy --no-deps --fix
|
cargo clippy --no-deps --fix
|
||||||
|
|
||||||
release:
|
release:
|
||||||
cargo build --release
|
cargo build --release --target {{target}}
|
||||||
|
|
||||||
test-binary-docker:
|
test-binary-docker:
|
||||||
env \
|
env \
|
||||||
GITHUB_API_BASEURL=http://rest:5000/github \
|
GITHUB_API_BASEURL=http://rest:5000/github \
|
||||||
GITLAB_API_BASEURL=http://rest:5000/gitlab \
|
GITLAB_API_BASEURL=http://rest:5000/gitlab \
|
||||||
cargo build --profile e2e-tests
|
cargo build --target {{target}} --profile e2e-tests --features=static-build
|
||||||
|
|
||||||
test-binary:
|
test-binary:
|
||||||
env \
|
env \
|
||||||
GITHUB_API_BASEURL=http://localhost:5000/github \
|
GITHUB_API_BASEURL=http://localhost:5000/github \
|
||||||
GITLAB_API_BASEURL=http://localhost:5000/gitlab \
|
GITLAB_API_BASEURL=http://localhost:5000/gitlab \
|
||||||
cargo build --profile e2e-tests
|
cargo build --target {{target}} --profile e2e-tests
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cargo install --path .
|
cargo install --path .
|
||||||
|
|
||||||
|
install-static:
|
||||||
|
cargo install --target {{target}} --features=static-build --path .
|
||||||
|
|
||||||
test: test-unit test-integration test-e2e
|
test: test-unit test-integration test-e2e
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
@@ -47,7 +52,7 @@ test-e2e-docker +tests=".": test-binary-docker
|
|||||||
&& docker-compose build \
|
&& docker-compose build \
|
||||||
&& docker-compose run \
|
&& docker-compose run \
|
||||||
--rm \
|
--rm \
|
||||||
-v $PWD/../target/e2e-tests/grm:/grm \
|
-v $PWD/../target/{{target}}/e2e-tests/grm:/grm \
|
||||||
pytest \
|
pytest \
|
||||||
"GRM_BINARY=/grm python3 ALTERNATE_DOMAIN=alternate-rest -m pytest -p no:cacheprovider --color=yes "$@"" \
|
"GRM_BINARY=/grm python3 ALTERNATE_DOMAIN=alternate-rest -m pytest -p no:cacheprovider --color=yes "$@"" \
|
||||||
&& docker-compose rm --stop -f
|
&& docker-compose rm --stop -f
|
||||||
@@ -57,7 +62,7 @@ test-e2e +tests=".": test-binary
|
|||||||
&& docker-compose rm --stop -f \
|
&& docker-compose rm --stop -f \
|
||||||
&& docker-compose build \
|
&& docker-compose build \
|
||||||
&& docker-compose up -d rest \
|
&& docker-compose up -d rest \
|
||||||
&& GRM_BINARY={{justfile_directory()}}/target/e2e-tests/grm ALTERNATE_DOMAIN=127.0.0.1 python3 -m pytest -p no:cacheprovider --color=yes {{tests}} \
|
&& GRM_BINARY={{justfile_directory()}}/target/{{target}}/e2e-tests/grm ALTERNATE_DOMAIN=127.0.0.1 python3 -m pytest -p no:cacheprovider --color=yes {{tests}} \
|
||||||
&& docker-compose rm --stop -f
|
&& docker-compose rm --stop -f
|
||||||
|
|
||||||
update-dependencies: update-cargo-dependencies
|
update-dependencies: update-cargo-dependencies
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Summary
|
# Summary
|
||||||
|
|
||||||
- [Overview](./overview.md)
|
- [Overview](./overview.md)
|
||||||
- [Getting started](./getting_started.md)
|
- [Installation](./installation.md)
|
||||||
- [Repository trees](./repos.md)
|
- [Repository trees](./repos.md)
|
||||||
- [Git Worktrees](./worktrees.md)
|
- [Git Worktrees](./worktrees.md)
|
||||||
- [Forge Integrations](./forge_integration.md)
|
- [Forge Integrations](./forge_integration.md)
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
# Quickstart
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Building GRM currently requires the nightly Rust toolchain. The easiest way
|
|
||||||
is using [`rustup`](https://rustup.rs/). Make sure that rustup is properly installed.
|
|
||||||
|
|
||||||
Make sure that the nightly toolchain is installed:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ rustup toolchain install nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ cargo +nightly install --git https://github.com/hakoerber/git-repo-manager.git --branch master
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're brave, you can also run the development build:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ cargo +nightly install --git https://github.com/hakoerber/git-repo-manager.git --branch develop
|
|
||||||
```
|
|
||||||
56
docs/src/installation.md
Normal file
56
docs/src/installation.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Installation
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Building GRM currently requires the nightly Rust toolchain. The easiest way
|
||||||
|
is using [`rustup`](https://rustup.rs/). Make sure that rustup is properly installed.
|
||||||
|
|
||||||
|
Make sure that the nightly toolchain is installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ rustup toolchain install nightly
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, install the build dependencies:
|
||||||
|
|
||||||
|
| Distribution | Command |
|
||||||
|
| ------------- | ------------------------------------------------------------------------------ |
|
||||||
|
| Archlinux | `pacman -S --needed gcc openssl pkg-config` |
|
||||||
|
| Ubuntu/Debian | `apt-get install --no-install-recommends pkg-config gcc libssl-dev zlib1g-dev` |
|
||||||
|
|
||||||
|
Then, it's a simple command to install the latest stable version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cargo +nightly install git-repo-manager
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're brave, you can also run the development build:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cargo +nightly install --git https://github.com/hakoerber/git-repo-manager.git --branch develop
|
||||||
|
```
|
||||||
|
|
||||||
|
## Static build
|
||||||
|
|
||||||
|
Note that by default, you will get a dynamically linked executable.
|
||||||
|
Alternatively, you can also build a statically linked binary. For this, you
|
||||||
|
will need `musl` and a few other build dependencies installed installed:
|
||||||
|
|
||||||
|
| Distribution | Command |
|
||||||
|
| ------------- | --------------------------------------------------------------------------- |
|
||||||
|
| Archlinux | `pacman -S --needed gcc musl perl make` |
|
||||||
|
| Ubuntu/Debian | `apt-get install --no-install-recommends gcc musl-tools libc-dev perl make` |
|
||||||
|
|
||||||
|
(`perl` and `make` are required for the OpenSSL build script)
|
||||||
|
|
||||||
|
The, add the musl target via `rustup`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ rustup +nightly target add x86_64-unknown-linux-musl
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, use a modified build command to get a statically linked binary:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cargo +nightly install git-repo-manager --target x86_64-unknown-linux-musl --features=static-build
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user