@@ -16,9 +16,14 @@ class WebtorrentCli < Formula
1616
1717 depends_on "cmake" => :build
1818 depends_on "ninja" => :build
19- depends_on "node"
19+ # Using Node 20 due to issue with N-API 10 https://github.com/murat-dogan/node-datachannel/issues/333
20+ # and unable to use newer node-datachannel https://github.com/ThaUnknown/webrtc-polyfill/issues/9
21+ depends_on "node@20"
2022
2123 def install
24+ # Workaround for CMake 4 until node-datachannel -> libdatachannel -> plog is updated
25+ ENV [ "CMAKE_POLICY_VERSION_MINIMUM" ] = "3.5"
26+
2227 system "npm" , "install" , *std_npm_args
2328 bin . install_symlink Dir [ "#{ libexec } /bin/*" ]
2429
@@ -29,8 +34,8 @@ def install
2934 rm [
3035 sb /"CMakeFiles/CMakeConfigureLog.yaml" ,
3136 sb /"CMakeFiles/rules.ninja" ,
32- sb /"CMakeFiles/3.31.2 /CMakeCXXCompiler.cmake" ,
33- sb /"CMakeFiles/3.31.2 /CMakeCCompiler.cmake" ,
37+ sb /"CMakeFiles/#{ Formula [ "cmake" ] . version } /CMakeCXXCompiler.cmake" ,
38+ sb /"CMakeFiles/#{ Formula [ "cmake" ] . version } /CMakeCCompiler.cmake" ,
3439 sb /"_deps/libdatachannel-subbuild/CMakeLists.txt" ,
3540 sb /"_deps/libdatachannel-subbuild/libdatachannel-populate-prefix/tmp/libdatachannel-populate-gitclone.cmake" ,
3641 sb /"_deps/libdatachannel-subbuild/libdatachannel-populate-prefix/tmp/libdatachannel-populate-gitupdate.cmake" ,
@@ -40,9 +45,11 @@ def install
4045 # Remove incompatible pre-built binaries
4146 os = OS . kernel_name . downcase
4247 arch = Hardware ::CPU . intel? ? "x64" : Hardware ::CPU . arch . to_s
43- pb = nm /"{bare-fs,bare-os,bufferutil,fs-native-extensions,utp-native,utf-8-validate}"
48+ platforms = [ "#{ os } -#{ arch } " ]
49+ platforms << "#{ os } -x64+arm64" if OS . mac?
50+ pb = nm /"{bare-fs,bare-os,bare-url,bufferutil,fs-native-extensions,utp-native,utf-8-validate}"
4451 libexec . glob ( pb /"prebuilds/*" ) . each do |dir |
45- rm_r ( dir ) if dir . basename . to_s != " #{ os } - #{ arch } "
52+ rm_r ( dir ) if platforms . exclude? ( dir . basename . to_s )
4653 dir . glob ( "*.musl.node" ) . map ( &:unlink ) if OS . linux?
4754 end
4855
0 commit comments