Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPEC file provided cannot build scl rh-php73 #44

Closed
jre3brg opened this issue Oct 5, 2021 · 1 comment · Fixed by #56
Closed

SPEC file provided cannot build scl rh-php73 #44

jre3brg opened this issue Oct 5, 2021 · 1 comment · Fixed by #56

Comments

@jre3brg
Copy link

jre3brg commented Oct 5, 2021

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.

@godrockz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants