Skip to content

static linking #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
[target.mipsel-unknown-linux-musl]
[build]
rustflags = [
"-C", "target-feature=+crt-static",
"-C", "link-args=-static",
]

[target.x86_64-unknown-linux-gnu]
rustflags = [
"-C", "target-feature=-crt-static",
]
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ jobs:
access_token: ${{ github.token }}

- name: Install dependencies
run: sudo apt-get install -y libtss2-dev
run: |
sudo sed -i 's/azure\.//g' /etc/apt/sources.list
sudo apt-get --option="APT::Acquire::Retries=3" update
sudo apt-get --option="APT::Acquire::Retries=3" install -y libtss2-dev

- name: Check formatting
run: |
Expand All @@ -41,6 +44,7 @@ jobs:
name: package
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target:
- klkgw
Expand All @@ -66,7 +70,10 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install -y libtss2-dev llvm-dev libclang-dev clang
run: |
sudo sed -i 's/azure\.//g' /etc/apt/sources.list
sudo apt-get --option="APT::Acquire::Retries=3" update
sudo apt-get --option="APT::Acquire::Retries=3" install -y libtss2-dev llvm-dev libclang-dev clang

- name: install cross
uses: jaxxstorm/[email protected]
Expand Down
15 changes: 13 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,29 @@ args = [
[tasks.pkg]
description = "Builds a package for a given packaging profile"
category = "Package"
dependencies = ["build", "info_linking", "info_size"]
condition = { env_set = ["PKG"]}
env = { "PKG_NAME" = "helium-gateway-v${CARGO_MAKE_CRATE_VERSION}-${CARGO_MAKE_PROFILE}.${PKG}"}
run_task = [
{ name = "ipk", condition = { env = { "PKG" = "ipk" } } },
{ name = "deb", condition = { env = { "PKG" = "deb" } } }
]

[tasks.info_linking]
description = "Checking static linking"
category = "Info"
command = "file"
args = ["target/${CROSS_TARGET}/release/helium_gateway"]

[tasks.info_size]
description = "Checking size"
category = "Info"
command = "ls"
args = ["-l", "target/${CROSS_TARGET}/release/helium_gateway"]

[tasks.ipk]
description = "Builds an ipk for openwrt/opk based targets"
category = "Package"
dependencies = ["build"]
condition = { env_set = ["CROSS_TARGET", "TAR", "AR", "PKG_NAME", "IPK_USE_AR"] }
env = { "PKG_BUILD_DIR" = "target/pkg/${CARGO_MAKE_PROFILE}", "PKG_SRC_DIR" = "package/${CARGO_MAKE_PROFILE}" }
script = '''
Expand Down Expand Up @@ -169,7 +181,6 @@ script = '''
[tasks.deb]
description = "Builds a deb package for debian based targets"
category = "Package"
dependencies = ["build"]
condition = { env_set = ["CROSS_TARGET", "PKG_NAME"] }
script = '''
# make base folder
Expand Down