| ... | @@ -63,6 +63,10 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D | ... | @@ -63,6 +63,10 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 63 | \\ const module = pkg.module(exe); | 63 | \\ const module = pkg.module(exe); |
| 64 | \\ exe.root_module.addImport(pkg.import.?[0], module); | 64 | \\ exe.root_module.addImport(pkg.import.?[0], module); |
| 65 | \\ } | 65 | \\ } |
| | 66 | \\ for (package_data._root.system_libs) |libname| { |
| | 67 | \\ exe.linkSystemLibrary(libname); |
| | 68 | \\ exe.linkLibC(); |
| | 69 | \\ } |
| 66 | \\} | 70 | \\} |
| 67 | \\ | 71 | \\ |
| 68 | \\var link_lib_c = false; | 72 | \\var link_lib_c = false; |
| ... | @@ -82,11 +86,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D | ... | @@ -82,11 +86,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 82 | \\ return cached; | 86 | \\ return cached; |
| 83 | \\ } | 87 | \\ } |
| 84 | \\ const b = exe.step.owner; | 88 | \\ const b = exe.step.owner; |
| 85 | \\ const result = b.createModule(.{}); | 89 | \\ const result = b.createModule(.{ |
| 86 | \\ const dummy_library = b.addStaticLibrary(.{ | | |
| 87 | \\ .name = "dummy", | | |
| 88 | \\ .target = exe.root_module.resolved_target orelse b.host, | 90 | \\ .target = exe.root_module.resolved_target orelse b.host, |
| 89 | \\ .optimize = exe.root_module.optimize.?, | | |
| 90 | \\ }); | 91 | \\ }); |
| 91 | \\ if (self.import) |capture| { | 92 | \\ if (self.import) |capture| { |
| 92 | \\ result.root_source_file = capture[1]; | 93 | \\ result.root_source_file = capture[1]; |
| ... | @@ -105,25 +106,26 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D | ... | @@ -105,25 +106,26 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 105 | \\ } | 106 | \\ } |
| 106 | \\ for (self.c_include_dirs) |item| { | 107 | \\ for (self.c_include_dirs) |item| { |
| 107 | \\ result.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); | 108 | \\ result.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); |
| 108 | \\ dummy_library.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); | 109 | \\ exe.addIncludePath(b.path(b.fmt("{s}/{s}", .{ self.directory, item }))); |
| 109 | \\ link_lib_c = true; | 110 | \\ link_lib_c = true; |
| 110 | \\ } | 111 | \\ } |
| 111 | \\ for (self.c_source_files) |item| { | 112 | \\ for (self.c_source_files) |item| { |
| 112 | \\ dummy_library.addCSourceFile(.{ .file = b.path(b.fmt("{s}/{s}", .{ self.directory, item })), .flags = self.c_source_flags }); | 113 | \\ exe.addCSourceFile(.{ .file = b.path(b.fmt("{s}/{s}", .{ self.directory, item })), .flags = self.c_source_flags }); |
| | 114 | \\ link_lib_c = true; |
| 113 | \\ } | 115 | \\ } |
| 114 | \\ for (self.system_libs) |item| { | 116 | \\ for (self.system_libs) |item| { |
| 115 | \\ dummy_library.linkSystemLibrary(item); | 117 | \\ result.linkSystemLibrary(item, .{}); |
| | 118 | \\ exe.linkSystemLibrary(item); |
| | 119 | \\ link_lib_c = true; |
| 116 | \\ } | 120 | \\ } |
| 117 | \\ for (self.frameworks) |item| { | 121 | \\ for (self.frameworks) |item| { |
| 118 | \\ dummy_library.linkFramework(item); | 122 | \\ result.linkFramework(item, .{}); |
| 119 | \\ } | 123 | \\ exe.linkFramework(item); |
| 120 | \\ if (self.c_source_files.len > 0 or self.system_libs.len > 0 or self.frameworks.len > 0) { | | |
| 121 | \\ dummy_library.linkLibC(); | | |
| 122 | \\ exe.root_module.linkLibrary(dummy_library); | | |
| 123 | \\ link_lib_c = true; | 124 | \\ link_lib_c = true; |
| 124 | \\ } | 125 | \\ } |
| 125 | \\ if (link_lib_c) { | 126 | \\ if (link_lib_c) { |
| 126 | \\ result.link_libc = true; | 127 | \\ result.link_libc = true; |
| | 128 | \\ exe.linkLibC(); |
| 127 | \\ } | 129 | \\ } |
| 128 | \\ self.module_memo = result; | 130 | \\ self.module_memo = result; |
| 129 | \\ return result; | 131 | \\ return result; |
| ... | @@ -339,6 +341,8 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul | ... | @@ -339,6 +341,8 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul |
| 339 | try w.writeAll(" .dependencies ="); | 341 | try w.writeAll(" .dependencies ="); |
| 340 | try w.writeAll(" &.{"); | 342 | try w.writeAll(" &.{"); |
| 341 | for (mod.deps, 0..) |moddep, j| { | 343 | for (mod.deps, 0..) |moddep, j| { |
| | 344 | if (moddep.type == .system_lib) continue; |
| | 345 | if (moddep.type == .framework) continue; |
| 342 | try w.print(" &_{s}", .{moddep.id[0..12]}); | 346 | try w.print(" &_{s}", .{moddep.id[0..12]}); |
| 343 | if (j != mod.deps.len - 1) try w.writeAll(","); | 347 | if (j != mod.deps.len - 1) try w.writeAll(","); |
| 344 | } | 348 | } |