%global ext_name phan_helpers %global ini_name 20-%{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: 1%{?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} %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 * Tue Jun 23 2026 Bahtiar `kalkin-` Gadimov - 1.0.0-1 - Initial package of phan/phan_helpers 1.0.0