Skip to content

Commit

Permalink
Add vips --init --skip-linux --build-only-vips
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Sep 1, 2021
1 parent 9c05b31 commit 1eec9b5
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 10 deletions.
25 changes: 20 additions & 5 deletions .github/scripts/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@ unbottle() {
sed -Ei 's/\?init=true//' ./Formula/"$VERSION".rb || true
}

join() { local IFS="$1"; shift; echo "$*"; }

add_labels() {
labels=()
if [[ "$EXTENSION" =~ imap|vips ]]; then
labels+=("CI-no-linux")
fi
if [[ "$GITHUB_MESSAGE" =~ .*--init.* ]]; then
if ! [[ "$GITHUB_MESSAGE" =~ .*--skip-arm.* ]]; then
labels+=("CI-force-arm")
fi
if ! [[ "$GITHUB_MESSAGE" =~ .*--skip-linux.* ]]; then
labels+=("CI-force-linux")
fi
echo "::set-output name=labels::$(join , "${labels[@]}")"
fi
}

fetch() {
sudo cp "Formula/$VERSION.rb" "/tmp/$VERSION.rb"
[[ "$GITHUB_MESSAGE" =~ .*--init.* ]] && return
Expand All @@ -19,7 +37,7 @@ fetch() {
[[ "$VERSION" =~ (swoole|xdebug)@(7.[2-4]|8.[0-1]) ]] ||
[[ "$VERSION" =~ (mongodb|yaml)@(7.[1-4]|8.[0-1]) ]] ||
[[ "$VERSION" =~ (apcu|pecl_http|msgpack)@(7.[0-4]|8.0]) ]] ||
[[ "$VERSION" =~ (grpc|igbinary|protobuf|psr|raphf|rdkafka|redis)@(7.[0-4]|8.[0-1]) ]] ||
[[ "$VERSION" =~ (grpc|igbinary|protobuf|psr|raphf|rdkafka|redis|vips)@(7.[0-4]|8.[0-1]) ]] ||
[[ "$VERSION" =~ amqp@(5.6|7.[0-4]) ]]; then
sudo chmod a+x .github/scripts/update.sh && bash .github/scripts/update.sh "$EXTENSION" "$VERSION"
url=$(grep ' url' < ./Formula/"$VERSION".rb | cut -d\" -f 2)
Expand Down Expand Up @@ -49,7 +67,4 @@ check_changes() {

fetch
check_changes

if [[ "$EXTENSION" =~ imap ]]; then
echo "::set-output name=labels::CI-no-linux"
fi
add_labels
2 changes: 1 addition & 1 deletion .github/scripts/update.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extension=$1
version=$2
case $extension in
amqp|apcu|grpc|imagick|msgpack|protobuf|propro|psr|raphf|rdkafka|redis|memcached|mongodb|yaml)
amqp|apcu|grpc|imagick|msgpack|protobuf|propro|psr|raphf|rdkafka|redis|memcached|mongodb|vips|yaml)
tag=$(curl -sSL "https://pecl.php.net/rest/r/$extension/allreleases.xml" | grep -m 1 -Eo "([0-9]+.[0-9]+(.[0-9]+)?(.[0-9]+)?)(<)" | cut -d '<' -f 1)
sed -i "s/ url .*/ url \"https\:\/\/pecl.php.net\/get\/$extension-$tag.tgz\"/g" ./Formula/"$version".rb
;;
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/tests-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
extensions: ['amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, xdebug, yaml, zmq, pcov, propro']
extensions: ['amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, vips, xdebug, yaml, zmq, pcov, propro']
include:
- php: '5.6'
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, xdebug, yaml, zmq, propro
- php: '7.0'
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, xdebug, yaml, zmq, propro
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, vips, xdebug, yaml, zmq, propro
- php: '8.0'
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, xdebug, yaml, zmq, pcov
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, vips, xdebug, yaml, zmq, pcov
- php: '8.1'
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, xdebug, yaml, zmq, pcov
extensions: amqp, apcu, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, pecl_http, protobuf, psr, raphf, rdkafka, redis, swoole, vips, xdebug, yaml, zmq, pcov
- php: '7.2'
extensions: xdebug2
- php: '7.3'
Expand Down Expand Up @@ -54,6 +54,7 @@ jobs:
php -m
php -r "if(substr(phpversion(), 0, 3)<8.0 && ! extension_loaded('propro')) {throw new Exception('propro not found');}"
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('pcov not found');}"
php -r "if(phpversion()>=7.0 && ! extension_loaded('vips')) {throw new Exception('vips not found');}"
php -r "if(! extension_loaded('amqp')) {throw new Exception('amqp not found');}"
php -r "if(! extension_loaded('apcu')) {throw new Exception('apcu not found');}"
php -r "if(! extension_loaded('grpc')) {throw new Exception('grpc not found');}"
Expand Down
34 changes: 34 additions & 0 deletions Formula/vips@7.0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT70 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@7.1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT71 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@7.2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT72 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@7.3.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT73 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@7.4.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT74 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@8.0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT80 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end
34 changes: 34 additions & 0 deletions Formula/vips@8.1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: false
# frozen_string_literal: true

require File.expand_path("../Abstract/abstract-php-extension", __dir__)

# Class for Vips Extension
class VipsAT81 < AbstractPhpExtension
init
desc "Vips PHP extension"
homepage "https://github.com/libvips/php-vips-ext"
url "https://pecl.php.net/get/vips-1.0.12.tgz?init=true"
sha256 "c638250de6cad89d8648bff972af5224316ccb5b5b0a7c9201607709d5385282"
head "https://github.com/libvips/php-vips-ext.git"
license "MIT"

bottle do
root_url "https://ghcr.io/v2/shivammathur/extensions"
end

depends_on "vips"

def install
args = %W[
--with-vips=#{Formula["vips"].opt_prefix}
]
Dir.chdir "vips-#{version}"
safe_phpize
system "./configure", "--prefix=#{prefix}", phpconfig, *args
system "make"
prefix.install "modules/#{extension}.so"
write_config_file
add_include_files
end
end

0 comments on commit 1eec9b5

Please sign in to comment.