%global ext_name phan_helpers # 40-99 is the third-party ini range; 20-39 is reserved for php-src extensions. %global ini_name 40-%{ext_name}.ini Name: php-phan-helpers # Upstream's C header still says 0.1.0; we track the released tag v1.0.0, so # `php --ri` reports 0.1.0 at runtime. Version: 1.0.0 Release: 3%{?dist} Summary: PHP extension accelerating the Phan static analyzer License: PHP-3.01 URL: https://github.com/phan/phan_helpers Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{ext_name}-%{version}.tar.gz # Upstream ships no license file though its sources reference one; vendor the # canonical PHP-3.01 text so the package can carry it. Source1: LICENSE BuildRequires: gcc BuildRequires: make BuildRequires: php-devel # php-devel emits no ABI deps for a hand-built (non-pecl) extension; pin them to # the build-time PHP ABI like the Fedora php-pecl specs do. Requires: php(api) = %{php_core_api} Requires: php(zend-abi) = %{php_zend_api} # php-devel does not auto-emit the module Provides for a hand-built extension; # emit both the bare and arch-qualified provide, versioned per Fedora's PHP # guidelines (Requires and Provides -> C extensions). The brace-expansion # php-%%{ext_name}{,%%{?_isa}} form breaks on rpm 6.x, so use two lines. Provides: php-%{ext_name} = %{version} Provides: php-%{ext_name}%{?_isa} = %{version} %description phan_helpers provides native C implementations of the type-system operations that dominate Phan's analysis time (type deduplication, union id generation, array-shape cache keys, AST hashing). Phan v6+ uses them automatically when the extension is loaded, falling back to its PHP implementations otherwise. %prep %autosetup -n %{ext_name}-%{version} cp -p %{SOURCE1} LICENSE %build %{__phpize} %configure --enable-%{ext_name} %make_build cat > %{ini_name} <<'EOF' ; Enable phan_helpers extension module extension=phan_helpers.so EOF %install %make_install INSTALL_ROOT=%{buildroot} install -Dpm 0644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} %check %{__php} --no-php-ini --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so -r 'exit((int) !(extension_loaded("phan_helpers") && function_exists("phan_unique_types") && phan_unique_types([]) === []));' %files %license LICENSE %doc README.md %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{ext_name}.so %changelog * Thu Jun 25 2026 Bahtiar `kalkin-` Gadimov - 1.0.0-3 - Version the module Provides (= %%{version}) per Fedora PHP guidelines; the unversioned form tripped rpmlint unversioned-explicit-provides * Thu Jun 25 2026 Bahtiar `kalkin-` Gadimov - 1.0.0-2 - Add module Provides: php-phan_helpers (bare + arch-qualified) - Move ini to 40- priority (20-39 is the php-src reserved range) * Tue Jun 23 2026 Bahtiar `kalkin-` Gadimov - 1.0.0-1 - Initial package of phan/phan_helpers 1.0.0