@@ -12,7 +12,7 @@ dwarf_format: ?std.dwarf.Format,
12
12
13
13
c_macros : std .ArrayListUnmanaged ([]const u8 ),
14
14
include_dirs : std .ArrayListUnmanaged (IncludeDir ),
15
- lib_paths : std .ArrayListUnmanaged (LazyPath ),
15
+ lib_paths : std .ArrayListUnmanaged (LibraryPath ),
16
16
rpaths : std .ArrayListUnmanaged (RPath ),
17
17
frameworks : std .StringArrayHashMapUnmanaged (LinkFrameworkOptions ),
18
18
link_objects : std .ArrayListUnmanaged (LinkObject ),
@@ -41,6 +41,11 @@ export_symbol_names: []const []const u8 = &.{},
41
41
/// Use `getGraph` instead of accessing this field directly.
42
42
cached_graph : Graph = .{ .modules = &.{}, .names = &.{} },
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 ,
@@ -513,7 +518,12 @@ pub fn addFrameworkPath(m: *Module, directory_path: LazyPath) void {
513
518
514
519
pub fn addLibraryPath (m : * Module , directory_path : LazyPath ) void {
515
520
const b = m .owner ;
516
- m .lib_paths .append (b .allocator , directory_path .dupe (b )) catch @panic ("OOM" );
521
+ m .lib_paths .append (b .allocator , .{ .lazy_path = directory_path .dupe (b ) }) catch @panic ("OOM" );
522
+ }
523
+
524
+ pub fn addLibraryPathSpecial (m : * Module , bytes : []const u8 ) void {
525
+ const b = m .owner ;
526
+ m .lib_paths .append (b .allocator , .{ .special = b .dupe (bytes ) }) catch @panic ("OOM" );
517
527
}
518
528
519
529
pub fn addRPath (m : * Module , directory_path : LazyPath ) void {
@@ -611,10 +621,16 @@ pub fn appendZigProcessFlags(
611
621
try zig_args .appendSlice (m .c_macros .items );
612
622
613
623
try zig_args .ensureUnusedCapacity (2 * m .lib_paths .items .len );
614
- for (m .lib_paths .items ) | lib_path | {
615
- zig_args .appendAssumeCapacity ("-L" );
616
- zig_args .appendAssumeCapacity (lib_path .getPath2 (b , asking_step ));
617
- }
624
+ for (m .lib_paths .items ) | lib_path | switch (lib_path ) {
625
+ .lazy_path = > | lp | {
626
+ zig_args .appendAssumeCapacity ("-L" );
627
+ zig_args .appendAssumeCapacity (lp .getPath2 (b , asking_step ));
628
+ },
629
+ .special = > | bytes | {
630
+ zig_args .appendAssumeCapacity ("-L" );
631
+ zig_args .appendAssumeCapacity (bytes );
632
+ },
633
+ };
618
634
619
635
try zig_args .ensureUnusedCapacity (2 * m .rpaths .items .len );
620
636
for (m .rpaths .items ) | rpath | switch (rpath ) {
0 commit comments