Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ jobs:
run: |
# Zig does something weird with the stack - it uses more space than the
# equivalent plain C program.
ulimit -S -s 16384
ulimit -S -s 65536
srcdir=`pwd` pcre2test=`pwd`/zig-out/bin/pcre2test ./RunTest

bazel:
Expand Down
21 changes: 10 additions & 11 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ pub fn build(b: *std.Build) !void {
.PCRE2_MAX_VARLOOKBEHIND = 255,
.NEWLINE_DEFAULT = 2,
.PCRE2_PARENS_NEST_LIMIT = 250,

.PCRE2GREP_BUFSIZE = 20480,
.PCRE2GREP_MAX_BUFSIZE = 1048576,
},
);

// pcre2-8/16/32.so

const lib_mod = std.Build.Module.create(b, .{
const lib_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
Expand All @@ -61,10 +60,9 @@ pub fn build(b: *std.Build) !void {
lib_mod.addCMacro("PCRE2_STATIC", "");
}

const lib = std.Build.Step.Compile.create(b, .{
const lib = b.addLibrary(.{
.name = b.fmt("pcre2-{s}", .{@tagName(codeUnitWidth)}),
.root_module = lib_mod,
.kind = .lib,
.linkage = linkage,
});

Expand Down Expand Up @@ -115,14 +113,18 @@ pub fn build(b: *std.Build) !void {

// pcre2test

const pcre2test_mod = std.Build.Module.create(b, .{
const pcre2test_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{std.Build.Module.Import{ .name = b.fmt("pcre2-{s}", .{@tagName(codeUnitWidth)}), .module = lib_mod }},
});

pcre2test_mod.addImport(b.fmt("pcre2-{s}", .{@tagName(codeUnitWidth)}), lib_mod);

pcre2test_mod.addCMacro("HAVE_CONFIG_H", "");
if (linkage == .static) {
pcre2test_mod.addCMacro("PCRE2_STATIC", "");
}

const pcre2test = b.addExecutable(.{
.name = "pcre2test",
Expand All @@ -132,7 +134,7 @@ pub fn build(b: *std.Build) !void {
// pcre2-posix.so

if (codeUnitWidth == CodeUnitWidth.@"8") {
const posixLib_mod = std.Build.Module.create(b, .{
const posixLib_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
Expand All @@ -146,10 +148,9 @@ pub fn build(b: *std.Build) !void {
posixLib_mod.addCMacro("PCRE2_STATIC", "");
}

const posixLib = std.Build.Step.Compile.create(b, .{
const posixLib = b.addLibrary(.{
.name = "pcre2-posix",
.root_module = posixLib_mod,
.kind = .lib,
.linkage = linkage,
});

Expand Down Expand Up @@ -177,7 +178,5 @@ pub fn build(b: *std.Build) !void {
.file = b.path("src/pcre2test.c"),
});

pcre2test.linkLibC();

b.installArtifact(pcre2test);
}