diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 50559e7e131596044c387934d83d51a2d233b6ef..74070158c390ff257efccf6ca5fc9f7c44ace85e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,3 +41,4 @@ jobs: - run: ./test_repo.sh https://github.com/nektro/zigmod-test-git-dep - run: ./test_repo.sh https://github.com/nektro/zigmod-test-hg-dep - run: ./test_repo.sh https://github.com/nektro/zigmod-test-http-dep + - run: ./test_repo.sh https://github.com/nektro/zigmod-test-systemlib-dep diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5b934126e6d0a57224984d49d5c5e8a084a3fc2f..77994fd665338136400b0c5551333aff6fcc55c0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -46,6 +46,7 @@ jobs: - run: ./test_repo.sh https://github.com/nektro/zigmod-test-git-dep - run: ./test_repo.sh https://github.com/nektro/zigmod-test-hg-dep - run: ./test_repo.sh https://github.com/nektro/zigmod-test-http-dep + - run: ./test_repo.sh https://github.com/nektro/zigmod-test-systemlib-dep # Github Release - run: ./changelog.sh diff --git a/src/cmd/fetch.zig b/src/cmd/fetch.zig index 4d99099af660c3dcd0ccfd157b81f263e21d2127..88474a0389d1fa7ba48dbcd49c87a64d53053b90 100644 --- a/src/cmd/fetch.zig +++ b/src/cmd/fetch.zig @@ -63,6 +63,10 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ const module = pkg.module(exe); \\ exe.root_module.addImport(pkg.import.?[0], module); \\ } + \\ for (package_data._root.system_libs) |libname| { + \\ exe.linkSystemLibrary(libname); + \\ exe.linkLibC(); + \\ } \\} \\ \\var link_lib_c = false; @@ -82,11 +86,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ return cached; \\ } \\ const b = exe.step.owner; - \\ const result = b.createModule(.{}); - \\ const dummy_library = b.addStaticLibrary(.{ - \\ .name = "dummy", + \\ const result = b.createModule(.{ \\ .target = exe.root_module.resolved_target orelse b.host, - \\ .optimize = exe.root_module.optimize.?, \\ }); \\ if (self.import) |capture| { \\ result.root_source_file = capture[1]; @@ -105,25 +106,26 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ } \\ for (self.c_include_dirs) |item| { \\ result.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); - \\ dummy_library.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); + \\ exe.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); \\ link_lib_c = true; \\ } \\ for (self.c_source_files) |item| { - \\ dummy_library.addCSourceFile(.{ .file = b.path(b.fmt("{s}/{s}", .{ self.directory, item })), .flags = self.c_source_flags }); + \\ exe.addCSourceFile(.{ .file = b.path(b.fmt("{s}/{s}", .{ self.directory, item })), .flags = self.c_source_flags }); + \\ link_lib_c = true; \\ } \\ for (self.system_libs) |item| { - \\ dummy_library.linkSystemLibrary(item); + \\ result.linkSystemLibrary(item, .{}); + \\ exe.linkSystemLibrary(item); + \\ link_lib_c = true; \\ } \\ for (self.frameworks) |item| { - \\ dummy_library.linkFramework(item); - \\ } - \\ if (self.c_source_files.len > 0 or self.system_libs.len > 0 or self.frameworks.len > 0) { - \\ dummy_library.linkLibC(); - \\ exe.root_module.linkLibrary(dummy_library); + \\ result.linkFramework(item, .{}); + \\ exe.linkFramework(item); \\ link_lib_c = true; \\ } \\ if (link_lib_c) { \\ result.link_libc = true; + \\ exe.linkLibC(); \\ } \\ self.module_memo = result; \\ return result; @@ -339,6 +341,8 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul try w.writeAll(" .dependencies ="); try w.writeAll(" &.{"); for (mod.deps, 0..) |moddep, j| { + if (moddep.type == .system_lib) continue; + if (moddep.type == .framework) continue; try w.print(" &_{s}", .{moddep.id[0..12]}); if (j != mod.deps.len - 1) try w.writeAll(","); } diff --git a/test_repo_all.sh b/test_repo_all.sh index b05acb90fe2c2a6c3988c00c19321d8fa91ba375..9eecc00ae14f007d4ae8bd31b2b395aeb1b185cf 100755 --- a/test_repo_all.sh +++ b/test_repo_all.sh @@ -6,3 +6,4 @@ set -ex ./test_repo.sh https://github.com/nektro/zigmod-test-git-dep ./test_repo.sh https://github.com/nektro/zigmod-test-hg-dep ./test_repo.sh https://github.com/nektro/zigmod-test-http-dep +./test_repo.sh https://github.com/nektro/zigmod-test-systemlib-dep