diff --git a/Formula/subversion.rb b/Formula/subversion.rb index ada6a099f5e..07cbba457cc 100644 --- a/Formula/subversion.rb +++ b/Formula/subversion.rb @@ -5,7 +5,7 @@ class Subversion < Formula mirror "https://archive.apache.org/dist/subversion/subversion-1.14.1.tar.bz2" sha256 "2c5da93c255d2e5569fa91d92457fdb65396b0666fad4fd59b22e154d986e1a9" license "Apache-2.0" - revision 3 + revision 4 bottle do sha256 arm64_big_sur: "8b21c6fa258c0b6222653e06d7a4e701bfb04845b494039a81058205201bc81a" @@ -124,11 +124,9 @@ class Subversion < Formula Formula["zlib"].opt_prefix end - ruby = if OS.mac? - "/usr/bin/ruby" - else - "#{Formula["ruby"].opt_bin}/ruby" - end + perl = DevelopmentTools.locate("perl") + + ruby = DevelopmentTools.locate("ruby") sqlite = if OS.mac? "#{MacOS.sdk_path_if_needed}/usr" @@ -157,6 +155,7 @@ class Subversion < Formula --without-gpg-agent --enable-javahl --without-jikes + PERL=#{perl} PYTHON=#{Formula["python@3.9"].opt_bin}/python3 RUBY=#{ruby} ] @@ -185,36 +184,34 @@ class Subversion < Formula system "make", "javahl" system "make", "install-javahl" - if Hardware::CPU.intel? - perl_archlib = Utils.safe_popen_read("perl", "-MConfig", "-e", "print $Config{archlib}") - perl_core = Pathname.new(perl_archlib)/"CORE" + perl_archlib = Utils.safe_popen_read(perl.to_s, "-MConfig", "-e", "print $Config{archlib}") + perl_core = Pathname.new(perl_archlib)/"CORE" + perl_extern_h = perl_core/"EXTERN.h" + + unless perl_extern_h.exist? + # No EXTERN.h, maybe it's system perl + perl_version = Utils.safe_popen_read(perl.to_s, "--version")[/v(\d+\.\d+)(?:\.\d+)?/, 1] + perl_core = MacOS.sdk_path/"System/Library/Perl"/perl_version/"darwin-thread-multi-2level/CORE" perl_extern_h = perl_core/"EXTERN.h" - - unless perl_extern_h.exist? - # No EXTERN.h, maybe it's system perl - perl_version = Utils.safe_popen_read("perl", "--version")[/v(\d+\.\d+)(?:\.\d+)?/, 1] - perl_core = MacOS.sdk_path/"System/Library/Perl"/perl_version/"darwin-thread-multi-2level/CORE" - perl_extern_h = perl_core/"EXTERN.h" - end - - onoe "'#{perl_extern_h}' does not exist" unless perl_extern_h.exist? - - if OS.mac? - inreplace "Makefile" do |s| - s.change_make_var! "SWIG_PL_INCLUDES", - "$(SWIG_INCLUDES) -arch x86_64 -g -pipe -fno-common " \ - "-DPERL_DARWIN -fno-strict-aliasing -I#{HOMEBREW_PREFIX}/include -I#{perl_core}" - end - end - system "make", "swig-pl" - system "make", "install-swig-pl" - - # This is only created when building against system Perl, but it isn't - # purged by Homebrew's post-install cleaner because that doesn't check - # "Library" directories. It is however pointless to keep around as it - # only contains the perllocal.pod installation file. - rm_rf prefix/"Library/Perl" end + + onoe "'#{perl_extern_h}' does not exist" unless perl_extern_h.exist? + + if OS.mac? + inreplace "Makefile" do |s| + s.change_make_var! "SWIG_PL_INCLUDES", + "$(SWIG_INCLUDES) -arch #{Hardware::CPU.arch} -g -pipe -fno-common " \ + "-DPERL_DARWIN -fno-strict-aliasing -I#{HOMEBREW_PREFIX}/include -I#{perl_core}" + end + end + system "make", "swig-pl" + system "make", "install-swig-pl" + + # This is only created when building against system Perl, but it isn't + # purged by Homebrew's post-install cleaner because that doesn't check + # "Library" directories. It is however pointless to keep around as it + # only contains the perllocal.pod installation file. + rm_rf prefix/"Library/Perl" end def caveats @@ -235,21 +232,17 @@ class Subversion < Formula system "#{bin}/svnadmin", "create", "test" system "#{bin}/svnadmin", "verify", "test" - if Hardware::CPU.intel? - platform = "darwin-thread-multi-2level" - on_linux do - platform = "x86_64-linux-thread-multi" - end - - perl = "/usr/bin/perl" - on_linux do - perl = "#{Formula["perl"].opt_bin}/perl" - end - - perl_version = Utils.safe_popen_read(perl.to_s, "--version")[/v(\d+\.\d+(?:\.\d+)?)/, 1] - ENV["PERL5LIB"] = "#{lib}/perl5/site_perl/#{perl_version}/#{platform}" - system perl, "-e", "use SVN::Client; new SVN::Client()" + platform = if OS.mac? + "darwin-thread-multi-2level" + else + "#{Hardware::CPU.arch}-#{OS.kernel_name.downcase}-thread-multi" end + + perl = DevelopmentTools.locate("perl") + + perl_version = Utils.safe_popen_read(perl.to_s, "--version")[/v(\d+\.\d+(?:\.\d+)?)/, 1] + ENV["PERL5LIB"] = "#{lib}/perl5/site_perl/#{perl_version}/#{platform}" + system perl, "-e", "use SVN::Client; new SVN::Client()" end end