-
Notifications
You must be signed in to change notification settings - Fork 0
trim #10
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
trim #10
Changes from 6 commits
1904a31
39ba614
3da4fc3
95fb95e
5be4b34
edb2d15
38aa00b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) | ||
| XZ_SRC_DIR="$ROOT_DIR/liblzma-sys/xz" | ||
| BUILD_DIR="${XZ_SYS_C_TEST_BUILD_DIR:-$ROOT_DIR/target/xz-sys-c-tests}" | ||
| CARGO_BUILD_DIR="$BUILD_DIR/cargo" | ||
| CMAKE_BUILD_DIR="$BUILD_DIR/cmake" | ||
| JOBS="${JOBS:-$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)}" | ||
|
|
||
| if command -v ninja >/dev/null 2>&1; then | ||
| CMAKE_GENERATOR=( -G Ninja ) | ||
| else | ||
| CMAKE_GENERATOR=() | ||
| fi | ||
|
|
||
| case "$(uname -s)" in | ||
| Linux) | ||
| # Rust staticlibs require these native libraries when linked by CMake. | ||
| CMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS:-} -pthread -ldl -lm -lrt" | ||
| ;; | ||
| *) | ||
| CMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS:-}" | ||
| ;; | ||
| esac | ||
|
|
||
| echo "Building xz-sys staticlib..." | ||
| CARGO_TARGET_DIR="$CARGO_BUILD_DIR" cargo build -p xz-sys --release --features parallel | ||
|
|
||
| RUST_LIB="$CARGO_BUILD_DIR/release/libxz_sys.a" | ||
| CMAKE_LIB="$CMAKE_BUILD_DIR/liblzma.a" | ||
|
|
||
| replace_liblzma_with_xz_sys() { | ||
| cp "$RUST_LIB" "$CMAKE_LIB" | ||
|
|
||
| ar t "$CMAKE_LIB" > "$BUILD_DIR/liblzma-archive-members.txt" | ||
| if ! grep -q 'xz_sys' "$BUILD_DIR/liblzma-archive-members.txt"; then | ||
| echo "replacement liblzma archive does not look like xz-sys" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| echo "Configuring upstream xz C test harness..." | ||
| cmake -S "$XZ_SRC_DIR" -B "$CMAKE_BUILD_DIR" "${CMAKE_GENERATOR[@]}" \ | ||
| -DBUILD_SHARED_LIBS=OFF \ | ||
| -DBUILD_TESTING=ON \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" \ | ||
| -DXZ_NLS=OFF \ | ||
| -DXZ_DOXYGEN=OFF | ||
|
|
||
| echo "Building C liblzma target once to materialize CMake outputs..." | ||
| cmake --build "$CMAKE_BUILD_DIR" --target liblzma --parallel "$JOBS" | ||
|
|
||
| echo "Replacing C liblzma with xz-sys and building all C tests/tools..." | ||
| replace_liblzma_with_xz_sys | ||
| cmake --build "$CMAKE_BUILD_DIR" --parallel "$JOBS" | ||
|
|
||
| # Replace once more and rebuild dependents. This guarantees that CMake test | ||
| # executables and tools are linked against xz-sys even if the previous build | ||
| # regenerated liblzma.a as part of the all target. | ||
| replace_liblzma_with_xz_sys | ||
| cmake --build "$CMAKE_BUILD_DIR" --parallel "$JOBS" | ||
|
|
||
| echo "Running upstream xz C tests against xz-sys..." | ||
| ctest --test-dir "$CMAKE_BUILD_DIR" --output-on-failure "$@" | ||
|
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new CTest step is blocking CI. The pipeline log shows 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [package] | ||
| name = "xz-core" | ||
| version = "0.1.0" | ||
| version = "0.0.1" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 🧩 Analysis chain🌐 Web query:
💡 Result: For pre-1.0 crates on crates.io/Cargo: Semver bump recommendations: - In 0.y.z (y > 0): Breaking changes require bumping y (minor version, e.g., 0.1.0 -> 0.2.0, treated as major). Non-breaking changes (bugfixes, new features) use patch bumps (e.g., 0.1.0 -> 0.1.1). - In 0.0.z: Every release is considered a major/breaking change; bump z (e.g., 0.0.1 -> 0.0.2). No compatibility guarantees across any 0.0.z versions. This follows Cargo's convention where only changes in the left-most non-zero component are incompatible (e.g., 0.1.x compatible within x, 0.0.x each z incompatible). If a crate publishes 0.0.1 after 0.1.0 exists, and downstream depends on ^0.1 (i.e., >=0.1.0, <0.2.0): - 0.0.1 does NOT satisfy ^0.1.0, as 0.0.1 < 0.1.0 and outside the range (different left-most non-zero component: 0 for 0.0.1 vs 1 for 0.1.0). - Dependency resolution ignores 0.0.1; selects highest compatible >=0.1.0 (e.g., latest 0.1.z). No impact on users of ^0.1.0. - Publishing out-of-order versions is allowed but discouraged; Cargo resolves by semver precedence (0.1.0 > 0.0.1), picking highest compatible. Citations:
Out-of-order versioning is discouraged; ensure this change is intentional. Publishing 🤖 Prompt for AI Agents |
||
| edition = "2024" | ||
| license = "MIT OR Apache-2.0" | ||
| description = "Pure Rust implementation of liblzma (transpiled from C via c2rust)" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.