Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # 'bundle install' and cache

- name: Set Cargo triple
if: runner.os == 'Windows'
shell: bash
run: rustup default stable-x86_64-pc-windows-gnu

- name: Run ${{ matrix.os }} tests
shell: bash
run: script/cibuild
17 changes: 3 additions & 14 deletions ext/commonmarker/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
ENV["CC"] = RbConfig::CONFIG["CC"]

def darwin?
RbConfig::CONFIG["target_os"].include?("darwin")
end

# what follows is pretty much an abuse of miniportile2, but it works for now
# i just need something to download files and run a cargo build; one day this should
# be replaced with actual prepacked binaries.
Expand Down Expand Up @@ -51,17 +47,9 @@ def darwin?
recipe.download unless recipe.downloaded?
recipe.extract

tarball_extract_path = if darwin?
recipe.host =~ /arm64-apple-darwin(\d+)\.\d+\.0/
host = "arm64-darwin#{$1}"
File.join(GEM_ROOT_DIR, "tmp", host, "commonmarker", RUBY_VERSION, "tmp", recipe.host, "ports", recipe.name, recipe.version, "#{recipe.name}-#{recipe.version}")
else
File.join(GEM_ROOT_DIR, "tmp", recipe.host, "ports", recipe.name, recipe.version, "#{recipe.name}-#{recipe.version}")
end

# Why is this so long?
tarball_extract_path = File.join("tmp", recipe.host, "ports", recipe.name, recipe.version, "#{recipe.name}-#{recipe.version}")
Dir.chdir(tarball_extract_path) do
puts `cargo build --manifest-path=./c-api/Cargo.toml --release`
system "cargo build --manifest-path=./c-api/Cargo.toml --release"
end
lib_header_path = File.join(tarball_extract_path, "c-api", "include")
lib_build_path = File.join(tarball_extract_path, "c-api", "target", "release")
Expand All @@ -75,6 +63,7 @@ def darwin?
recipe.activate

$LIBS << ' -lcomrak_ffi'
$LIBS << ' -lbcrypt' if windows
end

unless find_header("comrak_ffi.h")
Expand Down