-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[email protected] 1.2.0 (new formula)
- Loading branch information
1 parent
8f5ddfc
commit dbbdd82
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class PhpUuidAT81 < Formula | ||
desc "UUID Extension for PHP" | ||
homepage "https://pecl.php.net/uuid" | ||
url "https://pecl.php.net/get/uuid-1.2.0.tgz" | ||
sha256 "5cb834d32fa7d270494aa47fd96e062ef819df59d247788562695fd1f4e470a4" | ||
head "https://github.com/SMillerDev/pecl-networking-uuid.git" | ||
|
||
depends_on "autoconf" => :build | ||
depends_on "util-linux" | ||
depends_on "[email protected]" | ||
|
||
patch do | ||
# let's fix the path to uuid.h (uuid/uuid.h on linux, ossp/uuid.h on OSX) | ||
# uuid_mac & uuid_time might not be available on OSX, let's add test to avoid compiling issue on these functions | ||
url "https://github.com/php/pecl-networking-uuid/commit/a393861918b75d9657cb8125a4e17cebd2432c4a.patch?full_index=1" | ||
sha256 "f72c5bd71d4c320a3bf7922104bbce959b574b79e3d504e35bccb154054f0f66" | ||
directory "uuid-1.2.0" | ||
end | ||
|
||
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 | ||
# chdir "uuid-#{version}" do | ||
system Formula["[email protected]"].bin/"phpize" | ||
configure_args = %W[ | ||
--with-php-config=#{Formula["[email protected]"].opt_bin/"php-config"} | ||
--with-uuid=#{Formula["util-linux"].opt_prefix} | ||
] | ||
system "./configure", *configure_args | ||
system "make" | ||
(lib/module_path).install "modules/uuid.so" | ||
# end | ||
end | ||
|
||
def post_install | ||
ext_config_path = etc/"php"/Formula["[email protected]"].version.major_minor/"conf.d"/"ext-uuid.ini" | ||
if ext_config_path.exist? | ||
inreplace ext_config_path, | ||
/extension=.*$/, "extension=\"#{opt_lib/module_path}/uuid.so\"" | ||
else | ||
ext_config_path.write <<~EOS | ||
[uuid] | ||
extension="#{opt_lib/module_path}/uuid.so" | ||
EOS | ||
end | ||
end | ||
|
||
test do | ||
assert_match "uuid", shell_output("#{Formula["[email protected]"].opt_bin}/php -m").downcase, | ||
"failed to find extension in php -m output" | ||
end | ||
end |