%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) %{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}} %if "%{php_version}" < "5.6" %global ini_name %{name}.ini %else %global ini_name 40-%{name}.ini %endif Name: libpuzzle Version: 0.11 Release: 30%{?dist} Summary: Library to quickly find visually similar images (gif, png, jpg) Group: System Environment/Libraries License: BSD URL: http://libpuzzle.pureftpd.org/project/libpuzzle Source0: http://download.pureftpd.org/pub/pure-ftpd/misc/libpuzzle/releases/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gd-devel # Compatibility with PHP 5 and 7 and use pkg-config Patch0: libpuzzle-0.11-php7.patch # Use pkg-config instead of gdlib-config when available Patch1: libpuzzle-0.11-pkgconfig.patch %description The Puzzle library is designed to quickly find visually similar images (gif, png, jpg), even if they have been resized, recompressed, recolored or slightly modified. The library is free, lightweight yet very fast, configurable, easy to use and it has been designed with security in mind. %package -n php-%{name} Summary: PHP extension for %{name} Group: Development/Libraries BuildRequires: php-devel Requires: %{name}%{?_isa} = %{version}-%{release} Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} # Fix private-shared-object-provides # RPM 4.8 %{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$} %{?filter_setup} # RPM 4.9 %global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$ %description -n php-%{name} The %{name} native PHP extension for developing PHP applications that use %{name}. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %setup -q %patch0 -p1 -b .php7 %patch1 -p1 -b .pkgconfig %build %{__cat} <<'EOF' >%{ini_name} extension=libpuzzle.so EOF %configure --disable-static %{__sed} -i.rpath -e 's|^\(hardcode_libdir_flag_spec=\).*|\1""|' libtool %{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %{__make} %{?_smp_mflags} %{__make} DESTDIR=%{_builddir}/%{name}-%{version} install INSTALL="install -p" %{__cp} -ra php php-plain iconv -f iso8859-1 -t utf-8 php-plain/examples/similar/similar.php > similar.php && mv -f similar.php php-plain/examples/similar/similar.php cd php/libpuzzle phpize %if 0%{?__isa_bits} == 64 LDFLAGS="$LDFLAGS -L%{_builddir}/%{name}-%{version}/usr/lib64"; export LDFLAGS %endif %{__sed} -i.rpath -e 's|\$ld_runpath_switch\$ai_p||g' configure %configure --with-libpuzzle=%{_builddir}/%{name}-%{version}/usr %{__sed} -i.rpath -e 's|^\(hardcode_libdir_flag_spec=\).*|\1""|' libtool %{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %{__make} %{?_smp_mflags} cd - %{__cp} php/libpuzzle/modules/%{name}.so php_%name.so %{__rm} -rf php %{__mv} php-plain php %install %{__rm} -rf %{buildroot} %{__install} -p -D -m0755 php_%{name}.so %{buildroot}/%{php_extdir}/%{name}.so %{__make} install DESTDIR=%{buildroot} INSTALL="install -p" find %{buildroot} -name '*.la' -exec rm -f {} ';' %{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d %{__install} -p -m0644 %{ini_name} %{buildroot}%{_sysconfdir}/php.d/%{ini_name} %check # Minimal load test of php extension LD_LIBRARY_PATH=%{buildroot}%{_libdir} \ php --no-php-ini \ --define extension_dir=${RPM_BUILD_ROOT}%{php_extdir} \ --define extension=%{name}.so \ --modules | grep %{name} %clean %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,-) %doc AUTHORS COPYING README THANKS %{_libdir}/*.so.* %{_mandir}/man8/* %{_bindir}/* %files -n php-%{name} %defattr(-,root,root,-) %doc README-PHP php/libpuzzle/{README,CREDITS,LICENSE} php/examples/similar/*.{sql,php} %config(noreplace) %{_sysconfdir}/php.d/%{ini_name} %{php_extdir}/%{name}.so %files devel %defattr(-,root,root,-) %{_libdir}/*.so %{_includedir}/* %{_mandir}/man3/* %changelog * Wed Nov 16 2016 Remi Collet - 0.11-30 - add patch to use pkg-config instead of gdlib-config - improve patch for PHP 7+ - arched inter package dependency * Tue Nov 15 2016 Remi Collet - 0.11-29 - rebuild for https://fedoraproject.org/wiki/Changes/php71 * Fri Jul 22 2016 Tom Callaway - 0.11-28 - rebuild to drop libvpx dep - fix build against rawhide php * Thu Feb 04 2016 Fedora Release Engineering - 0.11-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Tue Dec 1 2015 Tom Callaway - 0.11-26 - rebuild for libvpx 1.5.0 * Wed Jun 17 2015 Fedora Release Engineering - 0.11-25 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Mon Apr 6 2015 Tom Callaway - 0.11-24 - rebuild for libvpx 1.4.0 * Sun Aug 17 2014 Fedora Release Engineering - 0.11-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild * Tue Jul 01 2014 Yaakov Selkowitz - 0.11-22 - Fix FTBFS on aarch64 (#925867) * Fri Jun 20 2014 Remi Collet - 0.11-21 - rebuild for https://fedoraproject.org/wiki/Changes/Php56 - add numerical prefix to extension configuration file * Sat Jun 07 2014 Fedora Release Engineering - 0.11-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Sat Aug 03 2013 Fedora Release Engineering - 0.11-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Tue Jun 11 2013 Remi Collet - 0.11-18 - rebuild for new GD 2.1.0 * Fri Mar 22 2013 Remi Collet - 0.11-17 - rebuild for http://fedoraproject.org/wiki/Features/Php55 * Thu Feb 14 2013 Fedora Release Engineering - 0.11-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Mon Jan 21 2013 Adam Tkac - 0.11-15 - rebuild due to "jpeg8-ABI" feature drop * Fri Dec 21 2012 Adam Tkac - 0.11-14 - rebuild against new libjpeg * Thu Jul 19 2012 Fedora Release Engineering - 0.11-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Thu Jan 19 2012 Remi Collet - 0.11-12 - build against php 5.4.0 - add %%check for php extension - add filter to fix private-shared-object-provides * Fri Jan 13 2012 Fedora Release Engineering - 0.11-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Tue Dec 06 2011 Adam Jackson - 0.11-10 - Rebuild for new libpng * Fri Jul 15 2011 Andrew Colin Kissa - 0.11-9 - Fix bugzilla #716003 * Tue Feb 08 2011 Fedora Release Engineering - 0.11-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Fri Aug 07 2009 Dennis Gilmore - 0.11-7 - add sparc64 and s390x to the list of arches that use lib64 * Sat Jul 25 2009 Fedora Release Engineering - 0.11-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Mon Jul 13 2009 Remi Collet - 0.11-5 - rebuild for new PHP 5.3.0 ABI (20090626) - add PHP ABI check * Sun Jun 21 2009 Andrew Colin Kissa - 0.11-4 - Consistent use of macros * Sun Jun 21 2009 Andrew Colin Kissa - 0.11-3 - Fixes to issues raised by reviewer * Thu Jun 18 2009 Andrew Colin Kissa - 0.11-2 - Fix rpmlint issues * Sun May 14 2009 Andrew Colin Kissa - 0.11-1 - Initial release