From b94410096c6fb117bfc240ea9e90d08b6af16427 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sun, 30 Apr 2023 12:16:37 -0400 Subject: [PATCH] convert source_directory into a posix path because autoconf "configure" scripts get confused on windows --- lib/mini_portile2/mini_portile.rb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index 7a2593f..8110c04 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -67,7 +67,7 @@ def initialize(name, version, **kwargs) end def source_directory=(path) - @source_directory = File.expand_path(path) + @source_directory = posix_path(path) end def prepare_build_directory @@ -200,10 +200,7 @@ def activate output "Activating #{@name} #{@version} (from #{port_path})..." vars.each do |var, path| - full_path = File.expand_path(path) - - # turn into a valid Windows path (if required) - full_path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR + full_path = native_path(path) # save current variable value old_value = ENV[var] || '' @@ -237,7 +234,25 @@ def make_cmd (ENV["MAKE"] || @make_command || ENV["make"] || "make").dup end -private + private + + def native_path(path) + path = File.expand_path(path) + if File::ALT_SEPARATOR + path.tr(File::SEPARATOR, File::ALT_SEPARATOR) + else + path + end + end + + def posix_path(path) + path = File.expand_path(path) + if File::ALT_SEPARATOR + "/" + path.tr(File::ALT_SEPARATOR, File::SEPARATOR).tr(":", File::SEPARATOR) + else + path + end + end def tmp_path "tmp/#{@host}/ports/#{@name}/#{@version}"