11require "mkmf"
22require "mini_portile2"
33
4- PACKAGE_ROOT_DIR = File . expand_path ( File . join ( File . dirname ( __FILE__ ) , ".." , ".." ) )
5- EXT_DIR = File . join ( PACKAGE_ROOT_DIR , "ext" , "commonmarker" )
4+
5+ windows = RUBY_PLATFORM =~ /mingw|mswin/
6+ windows_ucrt = RUBY_PLATFORM =~ /(mingw|mswin).*ucrt/
7+ bsd = RUBY_PLATFORM =~ /bsd/
8+ darwin = RUBY_PLATFORM =~ /darwin/
9+ linux = RUBY_PLATFORM =~ /linux/
10+ cross_compiling = ENV [ 'RCD_HOST_RUBY_VERSION' ] # set by rake-compiler-dock in build containers
11+ # TruffleRuby uses the Sulong LLVM runtime, which is different from Apple's.
12+ apple_toolchain = darwin && RUBY_ENGINE != 'truffleruby'
13+
14+ GEM_ROOT_DIR = File . expand_path ( File . join ( File . dirname ( __FILE__ ) , ".." , ".." ) )
15+ EXT_DIR = File . join ( GEM_ROOT_DIR , "ext" , "commonmarker" )
616CROSS_BUILD_P = enable_config ( "cross-build" )
717
818RbConfig ::CONFIG [ "CC" ] = RbConfig ::MAKEFILE_CONFIG [ "CC" ] = ENV [ "CC" ] if ENV [ "CC" ]
@@ -22,7 +32,7 @@ def darwin?
2232TARBALL_URL = "https://github.com/#{ USER } /comrak/archive/refs/heads/#{ COMRAK_VERSION } .tar.gz"
2333
2434MiniPortile . new ( "comrak" , COMRAK_VERSION ) . tap do |recipe |
25- recipe . target = File . join ( PACKAGE_ROOT_DIR , "ports" )
35+ recipe . target = File . join ( GEM_ROOT_DIR , "ports" )
2636 recipe . files = [ {
2737 url : TARBALL_URL ,
2838 # sha256: "055fa44ef002a1a07853d3a4dd2a8c553a1dc58ff3809b4fa530ed35694d8571",
@@ -50,7 +60,8 @@ def darwin?
5060 end
5161
5262 # Why is this so long?
53- tarball_extract_path = File . join ( PACKAGE_ROOT_DIR , "tmp" , host , "commonmarker" , RUBY_VERSION , "tmp" , recipe . host , "ports" , recipe . name , recipe . version , "#{ recipe . name } -#{ recipe . version } " )
63+ tarball_extract_path = File . join ( GEM_ROOT_DIR , "tmp" , host , "commonmarker" , RUBY_VERSION , "tmp" , recipe . host , "ports" , recipe . name , recipe . version , "#{ recipe . name } -#{ recipe . version } " )
64+ puts `ls -LR`
5465 Dir . chdir ( tarball_extract_path ) do
5566 puts `cargo build --manifest-path=./c-api/Cargo.toml --release`
5667 end
0 commit comments