icingaweb2-module-toplevelview icon indicating copy to clipboard operation
icingaweb2-module-toplevelview copied to clipboard

SPEC file provided cannot build scl rh-php73

Open jre3brg opened this issue 3 years ago • 1 comments

Hello,

the SPEC file use yaml version 2.0.2 and dot not compile with rh-php73. I updated SPEC file to last version available (2.2.1) from PECL and manual download sources to get package for php73.

jre3brg avatar Oct 05 '21 07:10 jre3brg

try this:

php73-pecl-yaml.spec

# we don't want -z defs linker flag
%undefine _strict_symbol_defs_build

%global pecl_name yaml
%global ini_name  40-%{pecl_name}.ini
%global php       sclo-php73-php-pecl

Name:           %{php}-yaml
Version:        2.1.0
Release:        1%{?dist}
Summary:        Support for YAML 1.1 serialization using the LibYAML library

License:        MIT
URL:            https://pecl.php.net/package/yaml
Source0:        https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz

# BuildRequires:  %{php}-devel
# build require pear1's dependencies to avoid mismatched php stacks
# BuildRequires:  pear1 %{php}-cli %{php}-common %{php}-xml
BuildRequires:  libyaml-devel

Requires:       php(zend-abi) = %{php_zend_api}
Requires:       php(api) = %{php_core_api}

Provides:       php-%{pecl_name} = %{version}
Provides:       php-%{pecl_name}%{?_isa} = %{version}
Provides:       php-pecl(%{pecl_name}) = %{version}
Provides:       php-pecl(%{pecl_name})%{?_isa} = %{version}

# safe replacement
Provides:       php-pecl-%{pecl_name} = %{version}-%{release}
Provides:       php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
Conflicts:      php-pecl-%{pecl_name} < %{version}-%{release}


%description
The YAML PHP Extension provides a wrapper to the LibYAML library. It gives the
user the ability to parse YAML document streams into PHP constructs and emit PHP
constructs as valid YAML 1.1 documents.

%prep
%setup -q -c

# Remove test file to avoid regsitration (pecl list-files yaml)
sed -e 's/role="test"/role="src"/' \
    -e '/LICENSE/s/role="doc"/role="src"/' \
    package.xml >%{pecl_name}-%{version}%{?prever}/package.xml


%build
cd %{pecl_name}-%{version}%{?prever}
/opt/rh/rh-php73/root/usr/bin/phpize
%configure
make %{?_smp_mflags}


%check
cd %{pecl_name}-%{version}%{?prever}
make test NO_INTERACTION=1 REPORT_EXIT_STATUS=1


%install
cd %{pecl_name}-%{version}%{?prever}
make install INSTALL_ROOT=%{buildroot}

# Basic configuration
mkdir -p %{buildroot}%{php_inidir}
cat > %{buildroot}%{php_inidir}/%{ini_name} << 'EOF'
; Enable %{pecl_name} extension module
extension=%{pecl_name}.so

; %{pecl_name} extension configuration
; see http://www.php.net/manual/en/yaml.configuration.php

; Decode entities which have the explicit tag "tag:yaml.org,2002:binary"
yaml.decode_binary = 0
; Controls the decoding of "tag:yaml.org,2002:timestamp"
; 0 will not apply any decoding.
; 1 will use strtotime().
; 2 will use date_create().
yaml.decode_timestamp = 0
; Cause canonical form output.
yaml.output_canonical = 0
; Number of spaces to indent sections. Value should be between 1 and 10.
yaml.output_indent = 2
; Set the preferred line width. -1 means unlimited.
yaml.output_width = 80
; Enable/disable serialized php object processing.
yaml.decode_php = 0
EOF

# Package info
mkdir -p %{buildroot}%{pecl_xmldir}
install -p -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{pecl_name}.xml

# Documentation
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done


%triggerin -- pear1
if [ -x %{__pecl} ]; then
    %{pecl_install} %{pecl_xmldir}/%{pecl_name}.xml >/dev/null || :
fi


%posttrans
if [ -x %{__pecl} ]; then
    %{pecl_install} %{pecl_xmldir}/%{pecl_name}.xml >/dev/null || :
fi


%postun
if [ $1 -eq 0 -a -x %{__pecl} ]; then
    %{pecl_uninstall} %{pecl_name} >/dev/null || :
fi


%files
%license %{pecl_name}-%{version}%{?prever}/LICENSE
%doc %{pecl_docdir}/%{pecl_name}
%config(noreplace) %{php_inidir}/%{ini_name}
%{php_extdir}/%{pecl_name}.so
%{pecl_xmldir}/%{pecl_name}.xml

create a symlink: /usr/bin/php-config -> /opt/rh/rh-php73/root/usr/bin/php-config

place the yaml source files (yaml-2.1.0.tgz) under: ~/rpmbuild/SOURCES/

run: rpmbuild -bc php73-pecl-yaml.spec

godrockz avatar Feb 28 '23 14:02 godrockz