@@ -16,7 +16,7 @@ dwarf_format: ?std.dwarf.Format,
16
16
17
17
c_macros : std .ArrayListUnmanaged ([]const u8 ),
18
18
include_dirs : std .ArrayListUnmanaged (IncludeDir ),
19
- lib_paths : std .ArrayListUnmanaged (LazyPath ),
19
+ lib_paths : std .ArrayListUnmanaged (LibraryPath ),
20
20
rpaths : std .ArrayListUnmanaged (RPath ),
21
21
frameworks : std .StringArrayHashMapUnmanaged (LinkFrameworkOptions ),
22
22
link_objects : std .ArrayListUnmanaged (LinkObject ),
@@ -41,6 +41,11 @@ link_libcpp: ?bool,
41
41
/// Symbols to be exported when compiling to WebAssembly.
42
42
export_symbol_names : []const []const u8 = &.{},
43
43
44
+ pub const LibraryPath = union (enum ) {
45
+ lazy_path : LazyPath ,
46
+ special : []const u8 ,
47
+ };
48
+
44
49
pub const RPath = union (enum ) {
45
50
lazy_path : LazyPath ,
46
51
special : []const u8 ,
@@ -274,7 +279,10 @@ pub fn addImport(m: *Module, name: []const u8, module: *Module) void {
274
279
/// dependencies on `m`'s `depending_steps`.
275
280
fn addShallowDependencies (m : * Module , dependee : * Module ) void {
276
281
if (dependee .root_source_file ) | lazy_path | addLazyPathDependencies (m , dependee , lazy_path );
277
- for (dependee .lib_paths .items ) | lib_path | addLazyPathDependencies (m , dependee , lib_path );
282
+ for (dependee .lib_paths .items ) | lib_path | switch (lib_path ) {
283
+ .lazy_path = > | lp | addLazyPathDependencies (m , dependee , lp ),
284
+ .special = > {},
285
+ };
278
286
for (dependee .rpaths .items ) | rpath | switch (rpath ) {
279
287
.lazy_path = > | lp | addLazyPathDependencies (m , dependee , lp ),
280
288
.special = > {},
@@ -603,10 +611,15 @@ pub fn addFrameworkPath(m: *Module, directory_path: LazyPath) void {
603
611
604
612
pub fn addLibraryPath (m : * Module , directory_path : LazyPath ) void {
605
613
const b = m .owner ;
606
- m .lib_paths .append (b .allocator , directory_path .dupe (b )) catch @panic ("OOM" );
614
+ m .lib_paths .append (b .allocator , .{ . lazy_path = directory_path .dupe (b ) } ) catch @panic ("OOM" );
607
615
addLazyPathDependenciesOnly (m , directory_path );
608
616
}
609
617
618
+ pub fn addLibraryPathSpecial (m : * Module , bytes : []const u8 ) void {
619
+ const b = m .owner ;
620
+ m .lib_paths .append (b .allocator , .{ .special = b .dupe (bytes ) }) catch @panic ("OOM" );
621
+ }
622
+
610
623
pub fn addRPath (m : * Module , directory_path : LazyPath ) void {
611
624
const b = m .owner ;
612
625
m .rpaths .append (b .allocator , .{ .lazy_path = directory_path .dupe (b ) }) catch @panic ("OOM" );
@@ -725,10 +738,16 @@ pub fn appendZigProcessFlags(
725
738
try zig_args .appendSlice (m .c_macros .items );
726
739
727
740
try zig_args .ensureUnusedCapacity (2 * m .lib_paths .items .len );
728
- for (m .lib_paths .items ) | lib_path | {
729
- zig_args .appendAssumeCapacity ("-L" );
730
- zig_args .appendAssumeCapacity (lib_path .getPath2 (b , asking_step ));
731
- }
741
+ for (m .lib_paths .items ) | lib_path | switch (lib_path ) {
742
+ .lazy_path = > | lp | {
743
+ zig_args .appendAssumeCapacity ("-L" );
744
+ zig_args .appendAssumeCapacity (lp .getPath2 (b , asking_step ));
745
+ },
746
+ .special = > | bytes | {
747
+ zig_args .appendAssumeCapacity ("-L" );
748
+ zig_args .appendAssumeCapacity (bytes );
749
+ },
750
+ };
732
751
733
752
try zig_args .ensureUnusedCapacity (2 * m .rpaths .items .len );
734
753
for (m .rpaths .items ) | rpath | switch (rpath ) {
0 commit comments