Skip to content

Commit

Permalink
convert source_directory into a posix path
Browse files Browse the repository at this point in the history
because autoconf "configure" scripts get confused on windows
  • Loading branch information
flavorjones committed Apr 30, 2023
1 parent afbe3ea commit b944100
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions lib/mini_portile2/mini_portile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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] || ''
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit b944100

Please sign in to comment.