Skip to content

Commit

Permalink
Handle both ubuntu and alpine linux
Browse files Browse the repository at this point in the history
  • Loading branch information
froch committed Jul 25, 2024
1 parent 2f7161b commit 8d3049a
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions lib/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def setup_go_environment
end

def fetch_and_verify_libwasmvm
wasm_version = `go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2`.strip
wasm_version = `go list -m -f '{{.Version}}' github.com/CosmWasm/wasmvm`.strip
libwasmvm_suffix = determine_libwasmvm_suffix
libwasmvm_url = "https://github.com/CosmWasm/wasmvm/releases/download/#{wasm_version}/libwasmvm.#{libwasmvm_suffix}"
libwasmvm_file = "#{buildpath}/libwasmvm.#{libwasmvm_suffix}"
Expand Down Expand Up @@ -105,18 +105,32 @@ def determine_libwasmvm_suffix
if OS.mac?
"dylib"
elsif OS.linux?
if Hardware::CPU.intel?
"muslc.x86_64.a"
elsif Hardware::CPU.arm?
"muslc.aarch64.a"
if alpine_linux?
if Hardware::CPU.intel?
"muslc.x86_64.a"
elsif Hardware::CPU.arm?
"muslc.aarch64.a"
else
raise "Unsupported architecture: #{Hardware::CPU.arch}"
end
else
raise "Unsupported architecture: #{Hardware::CPU.arch}"
if Hardware::CPU.intel?
"x86_64.so"
elsif Hardware::CPU.arm?
"aarch64.so"
else
raise "Unsupported architecture: #{Hardware::CPU.arch}"
end
end
else
raise "Unsupported OS: #{OS::NAME}"
end
end

def alpine_linux?
File.exist?('/etc/alpine-release')
end

test do
system "#{bin}/xiond", "version"
end
Expand Down

0 comments on commit 8d3049a

Please sign in to comment.