From a729ebfa6fdb3e56a29cb18ff234db24f078260b Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Wed, 3 Mar 2021 12:11:30 +0100 Subject: [PATCH] php@7.3: add on_macos|on_linux blocks --- Formula/php@7.3.rb | 56 +++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/Formula/php@7.3.rb b/Formula/php@7.3.rb index 89794a0ff34..d8b63b60daa 100644 --- a/Formula/php@7.3.rb +++ b/Formula/php@7.3.rb @@ -51,13 +51,17 @@ class PhpAT73 < Formula uses_from_macos "libxslt" uses_from_macos "zlib" - # PHP build system incorrectly links system libraries - # see https://github.com/php/php-src/pull/3472 - patch :DATA + on_macos do + # PHP build system incorrectly links system libraries + # see https://github.com/php/php-src/pull/3472 + patch :DATA + end def install - # Ensure that libxml2 will be detected correctly in older MacOS - ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :el_capitan || MacOS.version == :sierra + on_macos do + # Ensure that libxml2 will be detected correctly in older MacOS + ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :el_capitan || MacOS.version == :sierra + end # buildconf required due to system library linking bug patch system "./buildconf", "--force" @@ -100,7 +104,10 @@ class PhpAT73 < Formula # Each extension that is built on Mojave needs a direct reference to the # sdk path or it won't find the headers - headers_path = "=#{MacOS.sdk_path_if_needed}/usr" + headers_path = "" + on_macos do + headers_path = "=#{MacOS.sdk_path_if_needed}/usr" + end args = %W[ --prefix=#{prefix} @@ -112,7 +119,6 @@ class PhpAT73 < Formula --enable-bcmath --enable-calendar --enable-dba - --enable-dtrace --enable-exif --enable-ftp --enable-fpm @@ -134,7 +140,6 @@ class PhpAT73 < Formula --enable-wddx --enable-zip --with-apxs2=#{Formula["httpd"].opt_bin}/apxs - --with-bz2#{headers_path} --with-curl=#{Formula["curl"].opt_prefix} --with-fpm-user=_www --with-fpm-group=_www @@ -148,14 +153,10 @@ class PhpAT73 < Formula --with-kerberos#{headers_path} --with-layout=GNU --with-ldap=#{Formula["openldap"].opt_prefix} - --with-ldap-sasl#{headers_path} - --with-libxml-dir#{headers_path} - --with-libedit#{headers_path} --with-libzip --with-mhash#{headers_path} --with-mysql-sock=/tmp/mysql.sock --with-mysqli=mysqlnd - --with-ndbm#{headers_path} --with-openssl=#{Formula["openssl@1.1"].opt_prefix} --with-password-argon2=#{Formula["argon2"].opt_prefix} --with-pdo-dblib=#{Formula["freetds"].opt_prefix} @@ -173,10 +174,30 @@ class PhpAT73 < Formula --with-unixODBC=#{Formula["unixodbc"].opt_prefix} --with-webp-dir=#{Formula["webp"].opt_prefix} --with-xmlrpc - --with-xsl#{headers_path} - --with-zlib#{headers_path} ] + on_macos do + args << "--enable-dtrace" + args << "--with-ldap-sasl#{headers_path}" + args << "--with-zlib#{headers_path}" + args << "--with-bz2#{headers_path}" + args << "--with-ndbm#{headers_path}" + args << "--with-libedit#{headers_path}" + args << "--with-libxml-dir#{headers_path}" + args << "--with-xsl#{headers_path}" + end + on_linux do + args << "--disable-dtrace" + args << "--with-zlib=#{Formula["zlib"].opt_prefix}" + args << "--with-bz2=#{Formula["bzip2"].opt_prefix}" + args << "--with-libedit=#{Formula["libedit"].opt_prefix}" + args << "--with-libxml-dir=#{Formula["libxml2"].opt_prefix}" + args << "--with-xsl=#{Formula["libxslt"].opt_prefix}" + args << "--without-ldap-sasl" + args << "--without-ndbm" + args << "--without-gdbm" + end + system "./configure", *args system "make" system "make", "install" @@ -332,8 +353,11 @@ class PhpAT73 < Formula "Zend OPCache extension not loaded") # Test related to libxml2 and # https://github.com/Homebrew/homebrew-core/issues/28398 - assert_includes MachO::Tools.dylibs("#{bin}/php"), - "#{Formula["libpq"].opt_lib}/libpq.5.dylib" + on_macos do + assert_includes MachO::Tools.dylibs("#{bin}/php"), + "#{Formula["libpq"].opt_lib}/libpq.5.dylib" + end + system "#{sbin}/php-fpm", "-t" system "#{bin}/phpdbg", "-V" system "#{bin}/php-cgi", "-m"