Skip to content

Commit cd09d7a

Browse files
committed
Merge branch 'develop' into msl/64
2 parents d5a48df + fdcf515 commit cd09d7a

File tree

37 files changed

+248
-254
lines changed

37 files changed

+248
-254
lines changed

.github/workflows/docker-shared.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v3
1818

19-
- uses: mlugg/setup-zig@v1
19+
- uses: mlugg/setup-zig@v2
2020
with:
21-
version: 0.14.0
21+
version: 0.15.2
2222

2323
#
2424
# BUILD

.github/workflows/shared.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
8383
- uses: mlugg/setup-zig@v2
8484
with:
85-
version: 0.14.1
85+
version: 0.15.2
8686

8787
- name: Build binaries
8888
run: |
@@ -198,7 +198,11 @@ jobs:
198198
for t in "${targets[@]}"
199199
do
200200
IFS=' ' read zig_target target <<< "${t}"
201-
urbit_static=$GITHUB_WORKSPACE/zig-out/${zig_target}/urbit
201+
if [[ "$zig_target" == *"windows"* ]]; then
202+
urbit_static=$GITHUB_WORKSPACE/zig-out/${zig_target}/urbit.exe
203+
else
204+
urbit_static=$GITHUB_WORKSPACE/zig-out/${zig_target}/urbit
205+
fi
202206
203207
# Determine binary prefix (vere32 or vere64)
204208
if [[ "${{ matrix.bits }}" == "32" ]]; then
@@ -248,7 +252,11 @@ jobs:
248252
- name: Upload latest deployed version string to GCP
249253
run: |
250254
echo "${{ inputs.pace }}" > ./PACE
251-
printf $(sed -nr 's/const VERSION = "(.*)"\;/\1/p' build.zig)-%.10s $(git rev-parse HEAD) > ./VERSION
255+
if [ "${{ inputs.pace }}" == "live" ]; then
256+
sed -nr 's/const VERSION = "(.*)"\;/\1/p' build.zig > ./VERSION
257+
else
258+
printf "$(sed -nr 's/const VERSION = "(.*)"\;/\1/p' build.zig)-%.7s" "$(git rev-parse HEAD)" > ./VERSION
259+
fi
252260
253261
if ${{ inputs.next != null }}; then
254262
next=$(echo "${{ inputs.next }}" | sed 's/[^0-9]//g')

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Additional targets:
1717

1818
## Prerequisites
1919

20-
Install version 0.14.0 of `zig` with the package manager of your choosing, e.g., `brew install zig`, or download the binary from [here][zig-download].
20+
Install version 0.15.2 of `zig` with the package manager of your choosing, e.g., `brew install zig`, or download the binary from [here][zig-download].
2121

2222
### macOS debugger
2323

build.zig

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,18 @@ const CdbGenStep = struct {
2828
var cwd = std.fs.cwd();
2929

3030
// Open fragments directory (created by zig via -gen-cdb-fragment-path).
31-
var dir = cwd.openDir(self.frags_dir, .{ .iterate = true }) catch |e| {
32-
std.log.err(
33-
\\compile db fragments dir '{s}' not found ({s}).
34-
\\clear caches and build with -Dgenerate-commands
35-
, .{
36-
self.frags_dir,
37-
@errorName(e),
38-
});
39-
return e;
31+
var dir = cwd.openDir(self.frags_dir, .{ .iterate = true }) catch {
32+
return;
4033
};
4134
defer dir.close();
4235

4336
// Write compile_commands.json as a JSON array of fragment objects.
4437
var out_file = try cwd.createFile(self.out_path, .{ .truncate = true });
4538
defer out_file.close();
46-
var w = out_file.writer();
39+
var write_buffer: [4096]u8 = undefined;
40+
41+
var ww = out_file.writer(&write_buffer);
42+
const w = &ww.interface;
4743

4844
try w.writeByte('[');
4945

@@ -69,11 +65,13 @@ const CdbGenStep = struct {
6965
}
7066

7167
try w.writeAll("]\n");
68+
try w.flush();
69+
7270
cwd.deleteTree(self.frags_dir) catch {};
7371
}
7472
};
7573

76-
const VERSION = "4.0";
74+
const VERSION = "4.3";
7775

7876
const main_targets: []const std.Target.Query = &[_]std.Target.Query{
7977
.{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = null },
@@ -209,24 +207,22 @@ pub fn build(b: *std.Build) !void {
209207
// Parse short git rev
210208
var file = try std.fs.cwd().openFile(".git/logs/HEAD", .{});
211209
defer file.close();
212-
var buf_reader = std.io.bufferedReader(file.reader());
213-
var in_stream = buf_reader.reader();
214-
var buf: [1024]u8 = undefined;
215-
var last_line: [1024]u8 = undefined;
216-
while (try in_stream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
210+
var buf: [4096]u8 = undefined;
211+
var reader = file.reader(&buf);
212+
var last_line: [4096]u8 = undefined;
213+
while (reader.interface.takeDelimiterInclusive('\n')) |line| {
217214
if (line.len > 0)
218215
last_line = buf;
219-
}
220-
const git_rev = buf[41..51];
216+
} else |err| if (err != error.EndOfStream) return err;
217+
const git_rev = buf[41..48];
221218

222219
// Binary version
223220
const version = if (!release)
224221
VERSION ++ "-" ++ git_rev
225222
else
226223
VERSION;
227-
228-
const gen_cdb = b.option(bool, "generate-commands",
229-
"generate compile_commands.json fragments") orelse false;
224+
225+
const gen_cdb = b.option(bool, "generate-commands", "generate compile_commands.json fragments") orelse false;
230226

231227
//
232228
// Build
@@ -285,7 +281,7 @@ fn buildBinary(
285281
// TODO: Propagate these to all 3rd party dependencies
286282
//
287283

288-
var global_flags = std.ArrayList([]const u8).init(b.allocator);
284+
var global_flags = std.array_list.Managed([]const u8).init(b.allocator);
289285
defer global_flags.deinit();
290286

291287
try global_flags.appendSlice(cfg.flags);
@@ -338,7 +334,7 @@ fn buildBinary(
338334
// C Opts for Urbit PKGs And Binary
339335
//
340336

341-
var urbit_flags = std.ArrayList([]const u8).init(b.allocator);
337+
var urbit_flags = std.array_list.Managed([]const u8).init(b.allocator);
342338
defer urbit_flags.deinit();
343339

344340
try urbit_flags.appendSlice(global_flags.items);
@@ -535,11 +531,10 @@ fn buildBinary(
535531
// Build Artifact
536532
//
537533

538-
const urbit = b.addExecutable(.{
539-
.name = cfg.binary_name,
534+
const urbit = b.addExecutable(.{ .name = cfg.binary_name, .root_module = b.createModule(.{
540535
.target = target,
541536
.optimize = optimize,
542-
});
537+
}) });
543538

544539
if (t.os.tag == .windows) {
545540
urbit.stack_size = 67108864;
@@ -780,11 +775,10 @@ fn buildBinary(
780775
for (tests) |tst| {
781776
const test_step =
782777
b.step(tst.name, b.fmt("Build & run: {s}", .{tst.file}));
783-
const test_exe = b.addExecutable(.{
784-
.name = tst.name,
778+
const test_exe = b.addExecutable(.{ .name = tst.name, .root_module = b.createModule(.{
785779
.target = target,
786780
.optimize = optimize,
787-
});
781+
}) });
788782

789783
if (t.os.tag.isDarwin() and !target.query.isNative()) {
790784
const macos_sdk = b.lazyDependency("macos_sdk", .{
@@ -808,7 +802,7 @@ fn buildBinary(
808802
test_exe.addLibraryPath(.{
809803
.cwd_relative = "/opt/homebrew/opt/llvm@18/lib/clang/18/lib/darwin",
810804
});
811-
if (cfg.asan) test_exe.linkSystemLibrary("clang_rt.asan_osx_dynamic");
805+
if (cfg.asan) test_exe.linkSystemLibrary("clang_rt.asan_osx_dynamic");
812806
if (cfg.ubsan) test_exe.linkSystemLibrary("clang_rt.ubsan_osx_dynamic");
813807
}
814808

ext/avahi/build.zig

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ pub fn build(b: *std.Build) void {
99
.target = target,
1010
.optimize = optimize,
1111
});
12-
const expat = b.addStaticLibrary(.{
12+
const expat = b.addLibrary(.{
1313
.name = "expat",
14-
.target = target,
15-
.optimize = optimize,
14+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
1615
.version = .{
1716
.major = 1,
1817
.minor = 9,
@@ -68,10 +67,9 @@ pub fn build(b: *std.Build) void {
6867
.target = target,
6968
.optimize = optimize,
7069
});
71-
const dbus = b.addStaticLibrary(.{
70+
const dbus = b.addLibrary(.{
7271
.name = "dbus-1",
73-
.target = target,
74-
.optimize = optimize,
72+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
7573
.version = .{
7674
.major = 3,
7775
.minor = 38,
@@ -522,10 +520,9 @@ pub fn build(b: *std.Build) void {
522520
.optimize = optimize,
523521
});
524522

525-
const avahi = b.addStaticLibrary(.{
523+
const avahi = b.addLibrary(.{
526524
.name = "dns-sd",
527-
.target = target,
528-
.optimize = optimize,
525+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
529526
});
530527

531528
avahi.linkLibC();

ext/avahi/build.zig.zon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.{
2-
.name = "avahi",
2+
.name = .avahi,
33
.version = "0.0.1",
4+
.fingerprint = 0xfc7bcfe41113f7c8,
45
.dependencies = .{
56
.avahi = .{
67
.url = "https://github.com/lathiat/avahi/releases/download/v0.8/avahi-0.8.tar.gz",

ext/backtrace/build.zig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ pub fn build(b: *std.Build) void {
1010
.optimize = optimize,
1111
});
1212

13-
const lib = b.addStaticLibrary(.{
13+
const lib = b.addLibrary(.{
1414
.name = "backtrace",
15-
.target = target,
16-
.optimize = optimize,
15+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
1716
});
1817

1918
lib.linkLibC();
@@ -23,7 +22,7 @@ pub fn build(b: *std.Build) void {
2322
if (t.os.tag != .windows) {
2423
config_h = b.addConfigHeader(.{
2524
.style = .{
26-
.autoconf = dep_c.path("config.h.in"),
25+
.autoconf_undef = dep_c.path("config.h.in"),
2726
},
2827
.include_path = "config.h",
2928
}, .{
@@ -92,7 +91,7 @@ pub fn build(b: *std.Build) void {
9291
} else {
9392
config_h = b.addConfigHeader(.{
9493
.style = .{
95-
.autoconf = dep_c.path("config.h.in"),
94+
.autoconf_undef = dep_c.path("config.h.in"),
9695
},
9796
.include_path = "config.h",
9897
}, .{

ext/curl/build.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ pub fn build(b: *std.Build) void {
1414
.optimize = optimize,
1515
});
1616

17-
const curl = b.addStaticLibrary(.{
17+
const curl = b.addLibrary(.{
1818
.name = "curl",
19-
.target = target,
20-
.optimize = optimize,
19+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
2120
});
2221

2322
curl.linkLibC();

ext/gmp/build.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ pub fn build(b: *std.Build) void {
1010
.optimize = optimize,
1111
});
1212

13-
const lib = b.addStaticLibrary(.{
13+
const lib = b.addLibrary(.{
1414
.name = "gmp",
15-
.target = target,
16-
.optimize = optimize,
15+
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
1716
});
1817

1918
lib.linkLibC();

0 commit comments

Comments
 (0)