Skip to content

Commit

Permalink
Significant cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-noland committed Oct 11, 2024
1 parent 6f18310 commit 8f25f54
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 60 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,3 @@ jobs:
run: just install-rust
- name: just build
run: just build --release
build-on-gh:
runs-on: ubuntu-latest
container:
image: ghcr.io/githedgehog/dpdk-sys/dev-env:main-llvm18-8e2b295283f9a3b63603395541ee173c1c00c91d
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: compile-env is self
run: just _ci-compile-env-hack
- name: install rust
run: just install-rust
- name: just build
run: just build --release
12 changes: 5 additions & 7 deletions dpdk-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ fn bind(path: &Path, sysroot: &str) {
.expect("Unable to generate bindings")
.write_to_file(path.join("generated.rs"))
.expect("Couldn't write bindings!");

}

fn main() {
Expand Down Expand Up @@ -100,18 +99,17 @@ fn main() {
"rte_kvargs",
"rte_telemetry",
"rte_log",
"ibverbs",
"mlx5",
"nl-route-3",
"nl-3",
"numa",
];

let depends_no_whole_archive = ["ibverbs", "mlx5", "nl-route-3", "nl-3", "numa"];

depends.iter().for_each(|dep| {
println!("cargo:rustc-link-lib=static:+whole-archive,+bundle={dep}");
});

depends_no_whole_archive.iter().for_each(|dep| {
println!("cargo:rustc-link-lib=static:-whole-archive,+bundle={dep}");
});

let rerun_if_changed = ["build.rs"];

rerun_if_changed.iter().for_each(|file| {
Expand Down
44 changes: 7 additions & 37 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ toolchain := "1.81.0"
default_profile := "debug"

_container_source := "ghcr.io/githedgehog/dpdk-sys"
llvm_version := "18"
llvm_version := "19"
dev_env_container := _container_source + "/dev-env:main-llvm" + llvm_version
compile_env_container := _container_source + "/compile-env:main-llvm" + llvm_version

Expand All @@ -30,18 +30,16 @@ install-rust toolchain=toolchain:
rustup target add x86_64-unknown-linux-musl

[script]
build *args:
_cargo-with-rust-flags *args:
{{ _just_debuggable_ }}
source ./just.env
declare -a args=({{args}})
echo args: "${args[@]}"
PROFILE="{{default_profile}}"
TOOLCHAIN="+{{toolchain}}"
declare -a extra_args=()
for arg in "${args[@]}"; do
case "$arg" in
+*)
declare -r TOOLCHAIN="${arg}"
declare -rx RUST_TOOLCHAIN="${arg}"
;;
--debug|--profile=debug)
[ -z "${RUSTFLAGS:-}" ] && declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}"
Expand All @@ -55,34 +53,11 @@ build *args:
;;
esac
done
echo "Building with RUSTFLAGS: ${RUSTFLAGS:-}"
cargo "${TOOLCHAIN}" build "${extra_args[@]}"


# for arg in "${args[@]}"; do
# if [[ "$arg" == "--release" ]]; then
# [ -z "${RUSTFLAGS:-}" ] && declare -rx RUSTFLAGS="${RUSTFLAGS_RELASE}"
# fi
# if [[ "$arg" == "--debug" ]]; then
# [ -z "${RUSTFLAGS:-}" ] && declare -rx RUSTFLAGS="${RUSTFLAGS_DEBUG}"
# fi
# done
# case "{{profile}}" in
# release)
# echo "Building with release RUSTFLAGS"
# export RUSTFLAGS="${RUSTFLAGS_RELASE}"
# ;;
# debug)
# echo "Building with release RUSTFLAGS"
# export RUSTFLAGS="${RUSTFLAGS_DEBUG}"
# ;;
# *)
# echo "Building with default (debug) RUSTFLAGSs"
# export RUSTFLAGS="${RUSTFLAGS_DEBUG}"
# ;;
# esac
# cargo +{{toolchain}} build {{args}}
>&2 echo "With RUSTFLAGS=\"${RUSTFLAGS:-}\""
cargo "${RUST_TOOLCHAIN:-+{{toolchain}}}" "${extra_args[@]}"

[script]
cargo *args: (_cargo-with-rust-flags args)

[script]
dev-env: \
Expand Down Expand Up @@ -119,11 +94,6 @@ dev-env: \
"{{dev_env_container}}" \
/bin/bash

[script]
test *args="": build
{{ _just_debuggable_ }}
cargo test {{args}}

[script]
pull-compile-env:
{{ _just_debuggable_ }}
Expand Down

0 comments on commit 8f25f54

Please sign in to comment.