@@ -70,6 +70,11 @@ class Savi::Compiler::Binary
7070 # Use no_pie where available, for performance reasons.
7171 link_args << " -no_pie" unless target.arm64?
7272
73+ # Set up explicitly requested library paths.
74+ each_explicit_lib_path(ctx) { |lib_path |
75+ link_args << " -L#{ lib_path } "
76+ }
77+
7378 # Set up the main library paths.
7479 each_sysroot_lib_path(ctx, target) { |lib_path |
7580 link_args << " -L#{ lib_path } "
@@ -100,10 +105,16 @@ class Savi::Compiler::Binary
100105
101106 # Link a EXE executable for a Windows target.
102107 def link_for_windows (ctx, target, obj_path, bin_path)
108+ lib_paths = [] of String
103109 link_args = %w{lld-link -nologo -defaultlib:libcmt -defaultlib:oldnames}
104110
111+ # Set up explicitly requested library paths.
112+ each_explicit_lib_path(ctx) { |lib_path |
113+ lib_paths << lib_path
114+ link_args << " -libpath:#{ lib_path } "
115+ }
116+
105117 # Set up the main library paths.
106- lib_paths = [] of String
107118 each_sysroot_lib_path(ctx, target) { |lib_path |
108119 lib_paths << lib_path
109120 link_args << " -libpath:#{ lib_path } "
@@ -161,6 +172,11 @@ class Savi::Compiler::Binary
161172 # Specify the dynamic linker library, based on the target platform.
162173 link_args << " -dynamic-linker" << dynamic_linker_for_linux_or_bsd(target)
163174
175+ # Set up explicitly requested library paths.
176+ each_explicit_lib_path(ctx) { |lib_path |
177+ link_args << " -L#{ lib_path } "
178+ }
179+
164180 # Get the list of lib search paths within the sysroot.
165181 lib_paths = [] of String
166182 each_sysroot_lib_path(ctx, target) { |path | lib_paths << path }
@@ -235,6 +251,12 @@ class Savi::Compiler::Binary
235251 raise NotImplementedError .new(target.inspect)
236252 end
237253
254+ def each_explicit_lib_path (ctx )
255+ if ENV [" LIBRARY_PATH" ]? && ! ENV [" LIBRARY_PATH" ].empty?
256+ ENV [" LIBRARY_PATH" ].split(" :" ).each { |l | yield l }
257+ end
258+ end
259+
238260 # Yield each sysroot-based path in which to search for linkable libs/objs.
239261 def each_sysroot_lib_path (ctx, target)
240262 sys_roots =
0 commit comments