Advertisement
digrouz

php-pecl-oci8.spec

May 2nd, 2013
2,896
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
  2. %{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/pecl}}
  3. %{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}
  4.  
  5. # Figure out Oracle version and make a good guess at $ORACLE_HOME
  6. %global oracle_ver %(ls -1 %{_includedir}/oracle | grep 11 | tail -1 )
  7. # Show Oracle HOME
  8. #%global oracle_home %{_libdir}/oracle/%oracle_ver/client/lib
  9. %global oracle_home /usr/lib/oracle/11.2/client64/lib
  10.  
  11. %global pecl_name oci8
  12.  
  13. Name:           php-pecl-oci8
  14. Version:        1.4.9
  15. Release:        1%{?dist}
  16. Summary:        PHP Extension for Oracle Database
  17.  
  18. License:        PHP
  19. Group:          Development/Languages
  20. URL:            http://pecl.php.net/package/oci8
  21. Source0:        http://pecl.php.net/get/oci8-%{version}.tgz
  22. BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  23.  
  24. BuildRequires:  php-devel php-pear >= 1:1.4.9-1.2
  25. BuildRequires:  oracle-instantclient11.2-devel,oracle-instantclient11.2-basic
  26. Provides:       php-pecl(oci8) = %{version}
  27.  
  28. %if %{?php_zend_api}0
  29. Requires:       php(zend-abi) = %{php_zend_api}
  30. Requires:       php(api) = %{php_core_api}
  31. %else
  32. # for EL-5
  33. Requires:       php-api = %{php_apiver}
  34. %endif
  35. Requires:       oracle-instantclient11.2-devel,oracle-instantclient11.2-basic
  36.  
  37. %description
  38. This extension allows you to access Oracle databases using the Oracle
  39. Call Interface (OCI8). It can be built with PHP 4.3.9 to 5.x. It can
  40. be linked with Oracle 9.2, 10.2 or 11.2 client libraries.
  41.  
  42. %prep
  43. %setup -qcn oci8-%{version}
  44. [ -f package2.xml ] || mv package.xml package2.xml
  45. mv package2.xml %{pecl_name}-%{version}/%{pecl_name}.xml
  46. cd oci8-%{version}
  47.  
  48.  
  49. %build
  50. cd oci8-%{version}
  51. phpize
  52. %configure --with-oci8=instantclient,%oracle_home
  53. make %{?_smp_mflags}
  54.  
  55.  
  56. %install
  57. cd oci8-%{version}
  58. rm -rf $RPM_BUILD_ROOT
  59. make install INSTALL_ROOT=$RPM_BUILD_ROOT
  60.  
  61. # install config file
  62. install -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d
  63. cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/oci8.ini << 'EOF'
  64. ; Enable oci8 extension module
  65. extension=oci8.so
  66. EOF
  67.  
  68. # Install XML package description
  69. install -d $RPM_BUILD_ROOT%{pecl_xmldir}
  70. install -pm 644 %{pecl_name}.xml $RPM_BUILD_ROOT%{pecl_xmldir}/%{name}.xml
  71.  
  72.  
  73. %if 0%{?pecl_install:1}
  74. %post
  75. %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
  76. %endif
  77.  
  78.  
  79. %if 0%{?pecl_uninstall:1}
  80. %postun
  81. if [ $1 -eq 0 ] ; then
  82.     %{pecl_uninstall} %{pecl_name} >/dev/null || :
  83. fi
  84. %endif
  85.  
  86.  
  87. %clean
  88. rm -rf $RPM_BUILD_ROOT
  89.  
  90.  
  91. %files
  92. %defattr(-,root,root,-)
  93. %doc oci8-%{version}/CREDITS oci8-%{version}/README
  94. %config(noreplace) %{_sysconfdir}/php.d/oci8.ini
  95. %{php_extdir}/oci8.so
  96. %{pecl_xmldir}/%{name}.xml
  97.  
  98.  
  99. %changelog
  100. - Initial Package
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement