Skip to content

Commit 9e33aba

Browse files
authored
Merge branch 'Unleash:main' into resolve_all
2 parents 363035e + c5a1550 commit 9e33aba

File tree

5 files changed

+134
-30
lines changed

5 files changed

+134
-30
lines changed

.github/workflows/build-rust-binaries.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
#linux x86
1414
- os: ubuntu-latest
1515
target: x86_64-unknown-linux-gnu
16+
zigTarget: x86_64-linux-gnu.2.25
1617
output: libyggdrasilffi.so
1718
name: libyggdrasilffi_x86_64.so
1819
- os: ubuntu-latest
@@ -22,6 +23,7 @@ jobs:
2223
#linux arm64
2324
- os: ubuntu-24.04-arm
2425
target: aarch64-unknown-linux-gnu
26+
zigTarget: aarch64-linux-gnu.2.25
2527
output: libyggdrasilffi.so
2628
name: libyggdrasilffi_arm64.so
2729

@@ -43,10 +45,6 @@ jobs:
4345
target: i686-pc-windows-msvc
4446
output: yggdrasilffi.dll
4547
name: yggdrasilffi_i686.dll
46-
- os: macos-13
47-
target: x86_64-apple-darwin
48-
output: libyggdrasilffi.dylib
49-
name: libyggdrasilffi_x86_64.dylib
5048
- os: macos-latest
5149
target: aarch64-apple-darwin
5250
output: libyggdrasilffi.dylib
@@ -64,23 +62,28 @@ jobs:
6462
- name: Rust cache
6563
uses: Swatinem/rust-cache@v2
6664
- name: Install zig
67-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
65+
if: contains(matrix.target, 'linux')
6866
uses: mlugg/setup-zig@v2
6967
- name: Install zigbuild
70-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
68+
if: contains(matrix.target, 'linux')
7169
run: cargo install cargo-zigbuild
7270
# Linux MUSL toolchain (native, not cross)
7371
- name: Install musl tools (Linux)
74-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
72+
if: contains(matrix.target, 'linux')
7573
run: |
7674
sudo apt-get update
7775
sudo apt-get install -y musl-tools pkg-config build-essential
7876
7977
- name: Build Rust Library (Cargo)
80-
if: ${{ !(startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')) }}
78+
if: ${{ !contains(matrix.target, 'linux') }}
8179
run: cargo build -p yggdrasilffi --release --target ${{ matrix.target }};
8280

8381
- name: Build Rust library (zigbuild/musl)
84-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
82+
if: contains(matrix.target, 'musl')
8583
run: cargo zigbuild -p yggdrasilffi --release --target ${{ matrix.target }};
8684

85+
- name: Build Rust library (zigbuild/gnu, ${{ matrix.zigTarget }})
86+
if: contains(matrix.target, 'linux-gnu')
87+
run: cargo zigbuild -p yggdrasilffi --release --target ${{ matrix.target }}
88+
env:
89+
ZIG_TARGET: ${{ matrix.zigTarget }}

.github/workflows/release-new-ffi-version.yaml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
cargo install git-cliff
5454
5555
if [[ "${{ steps.latest_tag.outputs.latest_tag }}" != "" ]]; then
56-
CHANGELOG=$(git cliff --tag "${{ steps.tag.outputs.full_tag }}" --range "${{ steps.latest_tag.outputs.latest_tag }}..HEAD" --strip all)
56+
CHANGELOG=$(git cliff --tag "${{ steps.tag.outputs.full_tag }}" --strip all "${{ steps.latest_tag.outputs.latest_tag }}..HEAD")
5757
else
5858
CHANGELOG=$(git cliff --tag "${{ steps.tag.outputs.full_tag }}" --strip all)
5959
fi
@@ -70,51 +70,53 @@ jobs:
7070
body: ${{ steps.changelog.outputs.changelog }}
7171

7272
build:
73-
name: Build Binary for ${{ matrix.target }} - ${{ matrix.name }}
74-
needs: [create-tag-and-release]
73+
name: Build + Upload Binaries
7574
runs-on: ${{ matrix.os }}
7675
strategy:
7776
matrix:
7877
include:
78+
#linux x86
7979
- os: ubuntu-latest
8080
target: x86_64-unknown-linux-gnu
81+
zigTarget: x86_64-linux-gnu.2.25
8182
output: libyggdrasilffi.so
8283
name: libyggdrasilffi_x86_64.so
83-
- os: ubuntu-24.04-arm
84-
target: aarch64-unknown-linux-gnu
85-
output: libyggdrasilffi.so
86-
name: libyggdrasilffi_arm64.so
8784
- os: ubuntu-latest
8885
target: x86_64-unknown-linux-musl
8986
output: libyggdrasilffi.so
9087
name: libyggdrasilffi_x86_64-musl.so
88+
#linux arm64
89+
- os: ubuntu-24.04-arm
90+
target: aarch64-unknown-linux-gnu
91+
zigTarget: aarch64-linux-gnu.2.25
92+
output: libyggdrasilffi.so
93+
name: libyggdrasilffi_arm64.so
94+
9195
- os: ubuntu-24.04-arm
9296
target: aarch64-unknown-linux-musl
9397
output: libyggdrasilffi.so
9498
name: libyggdrasilffi_arm64-musl.so
99+
#win x86
95100
- os: windows-latest
96101
target: x86_64-pc-windows-gnu
97102
output: yggdrasilffi.dll
98103
name: yggdrasilffi_x86_64.dll
99-
- os: windows-latest
104+
#win arm64
105+
- os: windows-11-arm
100106
target: aarch64-pc-windows-msvc
101107
output: yggdrasilffi.dll
102108
name: yggdrasilffi_arm64.dll
103109
- os: windows-latest
104110
target: i686-pc-windows-msvc
105111
output: yggdrasilffi.dll
106112
name: yggdrasilffi_i686.dll
107-
- os: macos-13
108-
target: x86_64-apple-darwin
109-
output: libyggdrasilffi.dylib
110-
name: libyggdrasilffi_x86_64.dylib
111113
- os: macos-latest
112114
target: aarch64-apple-darwin
113115
output: libyggdrasilffi.dylib
114116
name: libyggdrasilffi_arm64.dylib
115117

116118
steps:
117-
- uses: actions/checkout@v5
119+
- uses: actions/checkout@v6
118120
- name: Install rust
119121
run: |
120122
rustup set auto-self-update disable
@@ -125,26 +127,32 @@ jobs:
125127
- name: Rust cache
126128
uses: Swatinem/rust-cache@v2
127129
- name: Install zig
128-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
130+
if: contains(matrix.target, 'linux')
129131
uses: mlugg/setup-zig@v2
130132
- name: Install zigbuild
131-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
133+
if: contains(matrix.target, 'linux')
132134
run: cargo install cargo-zigbuild
133135
# Linux MUSL toolchain (native, not cross)
134136
- name: Install musl tools (Linux)
135-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
137+
if: contains(matrix.target, 'linux')
136138
run: |
137139
sudo apt-get update
138140
sudo apt-get install -y musl-tools pkg-config build-essential
139141
140142
- name: Build Rust Library (Cargo)
141-
if: ${{ !(startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')) }}
143+
if: ${{ !contains(matrix.target, 'linux') }}
142144
run: cargo build -p yggdrasilffi --release --target ${{ matrix.target }};
143145

144146
- name: Build Rust library (zigbuild/musl)
145-
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
147+
if: contains(matrix.target, 'musl')
146148
run: cargo zigbuild -p yggdrasilffi --release --target ${{ matrix.target }};
147149

150+
- name: Build Rust library (zigbuild/gnu, ${{ matrix.zigTarget }})
151+
if: contains(matrix.target, 'linux-gnu')
152+
run: cargo zigbuild -p yggdrasilffi --release --target ${{ matrix.target }}
153+
env:
154+
ZIG_TARGET: ${{ matrix.zigTarget }}
155+
148156
- name: Rename binary
149157
shell: bash
150158
run: |
@@ -181,4 +189,3 @@ jobs:
181189
run: |
182190
TAG="${{ needs.create-tag-and-release.outputs.full_tag }}"
183191
gh release upload "$TAG" assets/* --clobber
184-

java-engine/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=io.getunleash
2-
yggdrasilCoreVersion=0.18.2
3-
version=0.4.3
2+
yggdrasilCoreVersion=0.18.3
3+
version=0.4.4
44
clientSpecificationVersion=5.2.2
55
clientSpecificationUrlTemplate=https://github.com/Unleash/client-specification/archive/refs/tags/v%s.zip

yggdrasilffi/src/compat_glibc.rs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#![allow(non_camel_case_types)]
2+
3+
/// Adds support for `gettid` and `statx` syscalls.
4+
///
5+
/// This module provides a minimal implementation of the `gettid` and `statx` syscalls for Linux.
6+
/// It uses the `syscall` function to make the system calls directly.
7+
///
8+
/// Note: This does NOT introduce GLIBC_2.28/2.30 by itself. On the contrary, it is designed so that zigbuild is able to build our binaries while only requiring GLIBC_2.25.
9+
///
10+
use core::ffi::{c_int, c_long, c_void};
11+
use std::ffi::c_char;
12+
13+
// Minimal C-ish types without the libc crate
14+
type pid_t = i32;
15+
16+
// Pull in syscall + errno location from the C runtime (glibc),
17+
// but note: this does NOT introduce GLIBC_2.28/2.30 by itself.
18+
extern "C" {
19+
fn syscall(num: c_long, ...) -> c_long;
20+
fn __errno_location() -> *mut c_int;
21+
}
22+
23+
// x86_64 syscall numbers
24+
#[cfg(target_arch = "x86_64")]
25+
const SYS_GETTID: c_long = 186;
26+
#[cfg(target_arch = "x86_64")]
27+
const SYS_STATX: c_long = 332;
28+
29+
// aarch64 syscall numbers
30+
#[cfg(target_arch = "aarch64")]
31+
const SYS_GETTID: c_long = 178;
32+
#[cfg(target_arch = "aarch64")]
33+
const SYS_STATX: c_long = 291;
34+
35+
#[no_mangle]
36+
pub unsafe extern "C" fn gettid() -> pid_t {
37+
syscall(SYS_GETTID) as pid_t
38+
}
39+
40+
#[repr(C)]
41+
pub struct statx_timestamp {
42+
pub tv_sec: i64,
43+
pub tv_nsec: u32,
44+
pub __reserved: i32,
45+
}
46+
47+
#[repr(C)]
48+
pub struct statx {
49+
pub stx_mask: u32,
50+
pub stx_blksize: u32,
51+
pub stx_attributes: u64,
52+
pub stx_nlink: u32,
53+
pub stx_uid: u32,
54+
pub stx_gid: u32,
55+
pub stx_mode: u16,
56+
pub __spare0: u16,
57+
pub stx_ino: u64,
58+
pub stx_size: u64,
59+
pub stx_blocks: u64,
60+
pub stx_attributes_mask: u64,
61+
pub stx_atime: statx_timestamp,
62+
pub stx_btime: statx_timestamp,
63+
pub stx_ctime: statx_timestamp,
64+
pub stx_mtime: statx_timestamp,
65+
pub stx_rdev_major: u32,
66+
pub stx_rdev_minor: u32,
67+
pub stx_dev_major: u32,
68+
pub stx_dev_minor: u32,
69+
pub stx_mnt_id: u64,
70+
pub stx_dio_mem_align: u32,
71+
pub stx_dio_offset_align: u32,
72+
pub __spare3: [u64; 12],
73+
}
74+
75+
#[no_mangle]
76+
pub unsafe extern "C" fn statx(
77+
dirfd: c_int,
78+
pathname: *const c_char,
79+
flags: c_int,
80+
mask: u32,
81+
buf: *mut statx,
82+
) -> c_int {
83+
let ret = syscall(SYS_STATX, dirfd, pathname, flags, mask, buf as *mut c_void);
84+
85+
if ret < 0 {
86+
// syscall returns -errno
87+
*__errno_location() = (-ret) as c_int;
88+
-1
89+
} else {
90+
ret as c_int
91+
}
92+
}

yggdrasilffi/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use unleash_yggdrasil::{
1616
state::EnrichedContext, Context, EngineState, EvalWarning, ExtendedVariantDef, ResolvedToggle,
1717
ToggleDefinition, UpdateMessage, CORE_VERSION, KNOWN_STRATEGIES,
1818
};
19+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
20+
mod compat_glibc;
1921

2022
pub mod flat;
2123

0 commit comments

Comments
 (0)