From 62edfda9ba929ca6ed56dfc7e446df297ecbb084 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 1 Sep 2023 15:07:45 +0200 Subject: build out of sources tree --- php-pecl-sdl-image.spec | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/php-pecl-sdl-image.spec b/php-pecl-sdl-image.spec index 81c149a..8c38c60 100644 --- a/php-pecl-sdl-image.spec +++ b/php-pecl-sdl-image.spec @@ -1,35 +1,33 @@ # remirepo spec file for php-pecl-sdl-image # -# Copyright (c) 2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2022-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -# we don't want -z defs linker flag -%undefine _strict_symbol_defs_build - -%if 0%{?scl:1} -%scl_package php-pecl-sdl-image -%endif +%{?scl:%scl_package php-pecl-sdl-image} %bcond_with tests + %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name sdl_image # no ini file (loaded by phpsdl helper) %global upstream_version 0.4.0 #global upstream_prever RC1 +%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} +%global _configure ../%{sources}/configure Summary: SDL_image bindings for PHP Name: %{?scl_prefix}php-pecl-sdl-image Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: zlib URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -44,7 +42,6 @@ Requires: %{?scl_prefix}php-sdl%{?_isa} >= 2.5.0 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 Supplements: %{?scl_prefix}php-sdl%{?_isa} %endif -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -64,14 +61,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -qc -mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -cd NTS +cd %{sources} # Check version as upstream often forget to update this extver=$(sed -n '/define PHP_SDL_IMAGE_VERSION/{s/.* "//;s/".*$//;p}' php_sdl_image.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev}"; then @@ -80,10 +76,9 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev} fi cd .. - +mkdir NTS %if %{with_zts} -# duplicate for ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif @@ -96,15 +91,16 @@ peclconf() { --with-php-config=$1 } -cd NTS -%{_bindir}/phpize -peclconf %{_bindir}/php-config +cd %{sources} +%{__phpize} + +cd ../NTS +peclconf %{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize -peclconf %{_bindir}/zts-php-config +peclconf %{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -125,13 +121,13 @@ make -C ZTS install INSTALL_ROOT=%{buildroot} # Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do [ -f %{sources}/$i ] && install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check : Minimal load test for NTS extension -%{_bindir}/php --no-php-ini \ +%{__php} --no-php-ini \ --define extension=sdl \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep -i '^%{pecl_name}$' @@ -146,7 +142,7 @@ done %endif %if %{with tests} -cd NTS +cd %{sources} : Run upstream test suite # ignore deprecated (in SDL 2.5.0) TEST_PHP_ARGS="-n -d error_reporting=24575 -d extension=sdl -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ @@ -175,7 +171,7 @@ fi %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -187,5 +183,8 @@ fi %changelog +* Fri Sep 1 2023 Remi Collet - 0.4.0-2 +- build out of sources tree + * Mon Jul 25 2022 Remi Collet - 0.4.0-1 - initial package -- cgit