Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected]: new formula #159

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class PhpHttpAT83 < Formula
desc "Pecl HTTP Extension for PHP"
homepage "https://github.com/m6w6/ext-http"
url "https://pecl.php.net/get/pecl_http-4.2.6.tgz"
sha256 "cd33230050b3f7c5ddb6f4383ce2a81f0bcdb934432029eec72ebf0f942b876d"
head "https://github.com/m6w6/ext-http.git", branch: "master"

depends_on "autoconf" => :build
depends_on "pkg-config" => :build
depends_on "brotli"
depends_on "curl"
depends_on "icu4c@76"
depends_on "openssl@3"
depends_on "[email protected]"
depends_on "[email protected]"

uses_from_macos "zlib"

def module_path
extension_dir = Utils.safe_popen_read("#{Formula["[email protected]"].opt_bin}/php-config", "--extension-dir").chomp
php_basename = File.basename(extension_dir)
"php/#{php_basename}"
end

def install
cd "pecl_http-#{version}"
system Formula["[email protected]"].bin/"phpize"

mkdir "ext"
# link in the raphf extension header
cp_r "#{Formula["[email protected]"].include}/raphf", "ext/raphf"

sdkpath = ""
sdkpath = MacOS.sdk_path_if_needed if OS.mac?

configure_args = %W[
--with-http
--without-http-libidn-dir
--without-http-libidn2-dir
--without-http-libidnkit-dir
--without-http-libidnkit2-dir
--with-libdir=#{HOMEBREW_PREFIX}/lib
--with-php-config=#{Formula["[email protected]"].opt_bin/"php-config"}
--with-http-zlib-dir=#{sdkpath}/usr
--with-http-libcurl-dir=#{Formula["curl"].opt_lib}
--with-http-libicu-dir=#{sdkpath}/usr
]
system "./configure", *configure_args
system "make"
(lib/module_path).install "modules/http.so"
end

def post_install
ext_config_path = etc/"php"/Formula["[email protected]"].version.major_minor/"conf.d"/"20-ext-http.ini"
if ext_config_path.exist?
inreplace ext_config_path,
/extension=.*$/, "extension=\"#{opt_lib/module_path}/http.so\""
else
ext_config_path.write <<~EOS
[pecl_http]
extension="#{opt_lib/module_path}/http.so"
EOS
end
end

test do
assert_match "http", shell_output("#{Formula["[email protected]"].opt_bin}/php -m").downcase,
"failed to find extension in php -m output"
end
end
49 changes: 49 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class PhpRaphfAT83 < Formula
desc "Raphf Extension for PHP"
homepage "https://pecl.php.net/raphf"
url "https://pecl.php.net/get/raphf-2.0.1.tgz"
sha256 "da3566db17422e5ef08b7ff144162952aabc14cb22407cc6b1d2a2d095812bd0"
head "https://github.com/m6w6/ext-raphf.git", branch: "master"

depends_on "autoconf" => :build
depends_on "pkg-config" => :build
depends_on "[email protected]"

def module_path
extension_dir = Utils.safe_popen_read("#{Formula["[email protected]"].opt_bin}/php-config", "--extension-dir").chomp
php_basename = File.basename(extension_dir)
"php/#{php_basename}"
end

def install
cd "raphf-#{version}"
system Formula["[email protected]"].bin/"phpize"
configure_args = %W[
--with-php-config=#{Formula["[email protected]"].opt_bin/"php-config"}
]
system "./configure", *configure_args
system "make"

mkdir_p include/"raphf"
(include/"raphf").install %w[php_raphf.h src/php_raphf_api.h]
(lib/module_path).install "modules/raphf.so"
end

def post_install
ext_config_path = etc/"php"/Formula["[email protected]"].version.major_minor/"conf.d"/"10-ext-raphf.ini"
if ext_config_path.exist?
inreplace ext_config_path,
/extension=.*$/, "extension=\"#{opt_lib/module_path}/raphf.so\""
else
ext_config_path.write <<~EOS
[raphf]
extension="#{opt_lib/module_path}/raphf.so"
EOS
end
end

test do
assert_match "raphf", shell_output("#{Formula["[email protected]"].opt_bin}/php -m").downcase,
"failed to find extension in php -m output"
end
end
53 changes: 53 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
class PhpUopzAT83 < Formula
desc "UOPZ Extension for PHP"
homepage "https://pecl.php.net/uopz"
url "https://pecl.php.net/get/uopz-7.1.1.tgz"
sha256 "50fa50a5340c76fe3495727637937eaf05cfe20bf93af19400ebf5e9d052ece3"
head "https://github.com/krakjoe/uopz.git", branch: "master"

bottle do
root_url "https://github.com/SMillerDev/homebrew-tap/releases/download/php-uopz-7.1.1"
sha256 cellar: :any_skip_relocation, big_sur: "3f5482506c3d7936256aac25e8e09e3bba922f9f1465a69753b9b5409ecaacda"
sha256 cellar: :any_skip_relocation, catalina: "d7abad1fc95b91147c63cce9b94bbb907d503b044cae0dbf77e5245bbb298a27"
sha256 cellar: :any_skip_relocation, x86_64_linux: "708f8e8fe776f1031fb1bda84bdb91fda85056d61c829a939baf7131c0f7a8f8"
end

depends_on "autoconf" => :build
depends_on "pkg-config" => :build
depends_on "[email protected]"

def module_path
extension_dir = Utils.safe_popen_read("#{Formula["[email protected]"].opt_bin}/php-config", "--extension-dir").chomp
php_basename = File.basename(extension_dir)
"php/#{php_basename}"
end

def install
cd "uopz-#{version}" unless build.head?
system Formula["[email protected]"].bin/"phpize"
configure_args = %W[
--with-php-config=#{Formula["[email protected]"].opt_bin/"php-config"}
]
system "./configure", *configure_args
system "make"
(lib/module_path).install "modules/uopz.so"
end

def post_install
ext_config_path = etc/"php"/Formula["[email protected]"].version.major_minor/"conf.d"/"ext-uopz.ini"
if ext_config_path.exist?
inreplace ext_config_path,
/extension=.*$/, "extension=\"#{opt_lib/module_path}/uopz.so\""
else
ext_config_path.write <<~EOS
[uopz]
extension="#{opt_lib/module_path}/uopz.so"
EOS
end
end

test do
assert_match "uopz", shell_output("#{Formula["[email protected]"].opt_bin}/php -m").downcase,
"failed to find extension in php -m output"
end
end