Skip to content

Commit

Permalink
update php8.x Formulaes
Browse files Browse the repository at this point in the history
  • Loading branch information
dittertp committed Nov 6, 2024
1 parent 667b2b2 commit a3439d3
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 66 deletions.
48 changes: 31 additions & 17 deletions Formula/vsh-php80.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class VshPhp80 < Formula
desc "General-purpose scripting language"
homepage "https://www.php.net/"
url "https://www.php.net/distributions/php-8.0.30.tar.xz"
mirror "https://fossies.org/linux/www/php-8.0.30.tar.xz"
sha256 "216ab305737a5d392107112d618a755dc5df42058226f1670e9db90e77d777d9"
url "https://github.com/shivammathur/php-src-backports/archive/b27aa4bf6d3e236bb853d2f1ef9cca338a3a5370.tar.gz"
version "8.0.30"
sha256 "ea4a8d291f031921fafddd4878d12db1329391d9e8450ccb96aebb823a230aae"
license "PHP-3.01"
revision 56
revision 500

bottle do
root_url "https://github.com/valet-sh/homebrew-core/releases/download/bottles"
Expand All @@ -14,6 +14,7 @@ class VshPhp80 < Formula

depends_on "bison" => :build
depends_on "pkg-config" => :build
depends_on "re2c" => :build
depends_on "apr"
depends_on "apr-util"
depends_on "argon2"
Expand All @@ -26,7 +27,7 @@ class VshPhp80 < Formula
depends_on "gettext"
depends_on "glib"
depends_on "gmp"
depends_on "icu4c@74"
depends_on "icu4c@75"
depends_on "jpeg"
depends_on "libpng"
depends_on "libyaml"
Expand All @@ -37,7 +38,7 @@ class VshPhp80 < Formula
depends_on "libzip"
depends_on "oniguruma"
depends_on "openldap"
depends_on "openssl@1.1"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "sqlite"
depends_on "tidy-html5"
Expand All @@ -48,6 +49,7 @@ class VshPhp80 < Formula
uses_from_macos "xz" => :build
uses_from_macos "bzip2"
uses_from_macos "libedit"
uses_from_macos "libffi", since: :catalina
uses_from_macos "libxml2"
uses_from_macos "libxslt"
uses_from_macos "zlib"
Expand All @@ -67,11 +69,14 @@ class VshPhp80 < Formula
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
# Work around for building with Xcode 15.3
if DevelopmentTools.clang_build_version >= 1500
ENV.append "CFLAGS", "-Wno-incompatible-function-pointer-types"
ENV.append "LDFLAGS", "-lresolv"
end

current_pkg_config_path = ENV["PKG_CONFIG_PATH"]
ENV["PKG_CONFIG_PATH"] = "/usr/local/opt/openssl@1.1/lib/pkgconfig:#{current_pkg_config_path}"
# Work around to support `icu4c` 75, which needs C++17.
ENV["ICU_CXXFLAGS"] = "-std=c++17"

# buildconf required due to system library linking bug patch
system "./buildconf", "--force"
Expand All @@ -83,8 +88,15 @@ def install
ENV["lt_cv_path_SED"] = "sed"

# system pkg-config missing
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"
ENV["KERBEROS_CFLAGS"] = " "
if OS.mac?
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"
else
ENV["SQLITE_CFLAGS"] = "-I#{Formula["sqlite"].opt_include}"
ENV["SQLITE_LIBS"] = "-lsqlite3"
ENV["BZIP_DIR"] = Formula["bzip2"].opt_prefix
end

# Each extension that is built on Mojave needs a direct reference to the
# sdk path or it won't find the headers
Expand Down Expand Up @@ -192,11 +204,13 @@ def install
}

# Use OpenSSL cert bundle
openssl = Formula["openssl@1.1"]
inreplace "php.ini-development", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-development", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
openssl = Formula["openssl@3"]
%w[development production].each do |mode|
inreplace "php.ini-#{mode}", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-#{mode}", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
end

inreplace "sapi/fpm/www.conf" do |s|
s.gsub!(/listen =.*/, "listen = /tmp/#{name}.sock")
Expand Down
39 changes: 22 additions & 17 deletions Formula/vsh-php81.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class VshPhp81 < Formula
mirror "https://fossies.org/linux/www/php-8.1.30.tar.xz"
sha256 "f24a6007f0b25a53cb7fbaee69c85017e0345b62089c2425a0afb7e177192ed1"
license "PHP-3.01"
revision 1
revision 10

bottle do
root_url "https://github.com/valet-sh/homebrew-core/releases/download/bottles"
Expand All @@ -14,6 +14,7 @@ class VshPhp81 < Formula

depends_on "bison" => :build
depends_on "pkg-config" => :build
depends_on "re2c" => :build
depends_on "apr"
depends_on "apr-util"
depends_on "argon2"
Expand All @@ -26,7 +27,7 @@ class VshPhp81 < Formula
depends_on "gettext"
depends_on "glib"
depends_on "gmp"
depends_on "icu4c@74"
depends_on "icu4c@75"
depends_on "krb5"
depends_on "jpeg"
depends_on "libpng"
Expand All @@ -38,15 +39,14 @@ class VshPhp81 < Formula
depends_on "libzip"
depends_on "oniguruma"
depends_on "openldap"
depends_on "openssl@1.1"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "sqlite"
depends_on "tidy-html5"
depends_on "unixodbc"
depends_on "webp"
depends_on "imagemagick"

uses_from_macos "xz" => :build
uses_from_macos "bzip2"
uses_from_macos "libedit"
uses_from_macos "libffi", since: :catalina
Expand Down Expand Up @@ -78,18 +78,14 @@ class VshPhp81 < Formula
end

def install

# Backport fix for libxml2 >= 2.13
# Ref: https://github.com/php/php-src/commit/67259e451d5d58b4842776c5696a66d74e157609
inreplace "ext/xml/compat.c",
"!= XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE)",
"== XML_PARSER_CONTENT)"

# Ensure that libxml2 will be detected correctly in older MacOS
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :el_capitan || MacOS.version == :sierra

current_pkg_config_path = ENV["PKG_CONFIG_PATH"]
ENV["PKG_CONFIG_PATH"] = "/usr/local/opt/openssl@1.1/lib/pkgconfig:#{current_pkg_config_path}"
# Work around to support `icu4c` 75, which needs C++17.
ENV["ICU_CXXFLAGS"] = "-std=c++17"

# buildconf required due to system library linking bug patch
system "./buildconf", "--force"
Expand All @@ -101,8 +97,15 @@ def install
ENV["lt_cv_path_SED"] = "sed"

# system pkg-config missing
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"
ENV["KERBEROS_CFLAGS"] = " "
if OS.mac?
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"
else
ENV["SQLITE_CFLAGS"] = "-I#{Formula["sqlite"].opt_include}"
ENV["SQLITE_LIBS"] = "-lsqlite3"
ENV["BZIP_DIR"] = Formula["bzip2"].opt_prefix
end

# Each extension that is built on Mojave needs a direct reference to the
# sdk path or it won't find the headers
Expand Down Expand Up @@ -210,11 +213,13 @@ def install
}

# Use OpenSSL cert bundle
openssl = Formula["openssl@1.1"]
inreplace "php.ini-development", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-development", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
openssl = Formula["openssl@3"]
%w[development production].each do |mode|
inreplace "php.ini-#{mode}", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-#{mode}", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
end

inreplace "sapi/fpm/www.conf" do |s|
s.gsub!(/listen =.*/, "listen = /tmp/#{name}.sock")
Expand Down
28 changes: 12 additions & 16 deletions Formula/vsh-php82.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ class VshPhp82 < Formula
mirror "https://fossies.org/linux/www/php-8.2.25.tar.xz"
sha256 "330b54876ea1d05ade12ee9726167332058bccd58dffa1d4e12117f6b4f616b9"
license "PHP-3.01"
revision 1
revision 10

bottle do
root_url "https://github.com/valet-sh/homebrew-core/releases/download/bottles"
sha256 ventura: "33c77f5257551c44f388a20ed193b43273b860e073d673dc6de087da91d82ec5"
end

depends_on "bison" => :build
depends_on "pkg-config" => :build
depends_on "re2c" => :build
depends_on "apr"
depends_on "apr-util"
depends_on "argon2"
Expand All @@ -23,14 +25,14 @@ class VshPhp82 < Formula
depends_on "gd"
depends_on "gettext"
depends_on "gmp"
depends_on "icu4c@74"
depends_on "icu4c@75"
depends_on "krb5"
depends_on "libpq"
depends_on "libsodium"
depends_on "libzip"
depends_on "oniguruma"
depends_on "openldap"
depends_on "openssl@1.1"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "sqlite"
depends_on "tidy-html5"
Expand Down Expand Up @@ -59,10 +61,6 @@ class VshPhp82 < Formula
end

def install

current_pkg_config_path = ENV["PKG_CONFIG_PATH"]
ENV["PKG_CONFIG_PATH"] = "/usr/local/opt/openssl@1.1/lib/pkgconfig:#{current_pkg_config_path}"

# buildconf required due to system library linking bug patch
system "./buildconf", "--force"

Expand All @@ -83,10 +81,6 @@ def install
ENV["BZIP_DIR"] = Formula["bzip2"].opt_prefix
end

# system pkg-config missing
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"

# 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"
Expand Down Expand Up @@ -187,11 +181,13 @@ def install
}

# Use OpenSSL cert bundle
openssl = Formula["openssl@1.1"]
inreplace "php.ini-development", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-development", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
openssl = Formula["openssl@3"]
%w[development production].each do |mode|
inreplace "php.ini-#{mode}", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-#{mode}", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
end

inreplace "sapi/fpm/www.conf" do |s|
s.gsub!(/listen =.*/, "listen = /tmp/#{name}.sock")
Expand Down
26 changes: 10 additions & 16 deletions Formula/vsh-php83.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class VshPhp83 < Formula
mirror "https://fossies.org/linux/www/php-8.3.13.tar.xz"
sha256 "89adb978cca209124fe53fd6327bc4966ca21213a7fa2e9504f854e340873018"
license "PHP-3.01"
revision 1
revision 10

bottle do
root_url "https://github.com/valet-sh/homebrew-core/releases/download/bottles"
Expand All @@ -24,14 +24,14 @@ class VshPhp83 < Formula
depends_on "gd"
depends_on "gettext"
depends_on "gmp"
depends_on "icu4c@74"
depends_on "icu4c@75"
depends_on "krb5"
depends_on "libpq"
depends_on "libsodium"
depends_on "libzip"
depends_on "oniguruma"
depends_on "openldap"
depends_on "openssl@1.1"
depends_on "openssl@3"
depends_on "pcre2"
depends_on "sqlite"
depends_on "tidy-html5"
Expand Down Expand Up @@ -60,10 +60,6 @@ class VshPhp83 < Formula
end

def install

current_pkg_config_path = ENV["PKG_CONFIG_PATH"]
ENV["PKG_CONFIG_PATH"] = "/usr/local/opt/openssl@1.1/lib/pkgconfig:#{current_pkg_config_path}"

# buildconf required due to system library linking bug patch
system "./buildconf", "--force"

Expand All @@ -84,10 +80,6 @@ def install
ENV["BZIP_DIR"] = Formula["bzip2"].opt_prefix
end

# system pkg-config missing
ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl"
ENV["SASL_LIBS"] = "-lsasl2"

# 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"
Expand Down Expand Up @@ -188,11 +180,13 @@ def install
}

# Use OpenSSL cert bundle
openssl = Formula["openssl@1.1"]
inreplace "php.ini-development", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-development", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
openssl = Formula["openssl@3"]
%w[development production].each do |mode|
inreplace "php.ini-#{mode}", /; ?openssl\.cafile=/,
"openssl.cafile = \"#{openssl.pkgetc}/cert.pem\""
inreplace "php.ini-#{mode}", /; ?openssl\.capath=/,
"openssl.capath = \"#{openssl.pkgetc}/certs\""
end

inreplace "sapi/fpm/www.conf" do |s|
s.gsub!(/listen =.*/, "listen = /tmp/#{name}.sock")
Expand Down

0 comments on commit a3439d3

Please sign in to comment.