%define phpver 4.1.1 %define name tclink %define version 3.3 %define release 2mdk %define lib_name_orig libtclink %define lib_major 3 %define lib_name %{lib_name_orig}%{lib_major} %define phprelease 3mdk %define phpdir %{_libdir}/php %define phpsource /usr/src/php-devel %define tclink_php_version 3.3 %define tclink_c_version 3.3 %define tclink_version 3.3 %define apachecontent /var/www/html Summary: TrustCommerce payment Name: %{name} Version: %{version} Release: %{release} Group: System/Servers License: LGPL URL: http://www.trustcommerce.com Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root Source0: %{name}-%{tclink_php_version}-php.tar.bz2 Source1: %{name}-%{tclink_c_version}-C.tar.bz2 %description TCLink is a thin client library to allow your e-commerce servers to connect to the TrustCommerce payment gateway easily and consistently. The protocol (which is the same across all platforms and languages) is well-documented in the Web Developer's Guide, so please consult it for any questions you may have about the protocol syntax itself. The TrustCommerce web site is at http://www.trustcommerce.com %package -n %{lib_name} Summary: Main library for tclink Group: System/Libraries Provides: %{name} = %{version}-%{release} %description -n %{lib_name} This package contains the library needed to run programs dynamically linked with tclink (Trust Commerce Payment Gateway). %package -n %{lib_name}-devel Summary: Headers for developping programs with TCLink Group: Development/Other Requires: %{lib_name} = %{version} Provides: %{lib_name_orig}-devel = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} %description -n %{lib_name}-devel This package contains the header file you need to develop applications which will use TCLink (Trust Commerce Payment Gateway). %package -n php-%{name} Version: %{phpver} Summary: PHP module for tclink Group: System/Servers Requires: %{lib_name} = %{tclink_version} Requires: %{lib_name}-devel = %{tclink_version} Provides: php-%{name} = %{phpver} Prereq: php-common = %{phpver}, perl BuildRequires: php-devel = %{phpver} %description -n php-%{name} This package contains the php module you need to develop PHP scripts which will use TCLink (Trust Commerce Payment). %prep %setup -q -n tclink-%{tclink_php_version}-php %setup -q -n tclink-%{tclink_c_version}-C -b 1 #Build libtclink.so %build ./configure make mv %{lib_name_orig}.so %{lib_name_orig}.so.%{lib_major} ln -sf %{lib_name_orig}.so.%{lib_major} %{lib_name_orig}.so cp -a ../tclink-%{tclink_php_version}-php/doc . #Build PHP modules cd ../tclink-%{tclink_php_version}-php ./build.sh %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{lib_name} mkdir -p $RPM_BUILD_ROOT%{_includedir}/%{lib_name} install -m 755 -s %{lib_name_orig}.so.%{lib_major} $RPM_BUILD_ROOT%{_libdir} install -m 755 -s %{lib_name_orig}.so $RPM_BUILD_ROOT%{_libdir} install -m 755 -s %{lib_name_orig}.a $RPM_BUILD_ROOT%{_libdir}/%{lib_name} install -m 755 -s tclink.h $RPM_BUILD_ROOT%{_includedir}/%{lib_name} cd ../tclink-%{tclink_php_version}-php mkdir -p $RPM_BUILD_ROOT%{phpdir}/extensions install -m 755 -s modules/tclink.so $RPM_BUILD_ROOT%{phpdir}/extensions/ mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} echo > $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/README <<EOF The php-tclink package contains a dynamic shared object (DSO) for PHP4. To activate it, make sure the line 'extension=tclink.so' is uncommented in your /etc/php.ini file. EOF mkdir -p $RPM_BUILD_ROOT%{apachecontent}/addon-modules install -m 755 tctest.php $RPM_BUILD_ROOT%{apachecontent}/addon-modules cd $RPM_BUILD_ROOT%{apachecontent}/addon-modules ln -s tctest.php tctest.phps %clean #[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %post -n %{lib_name} -p /sbin/ldconfig %postun -n %{lib_name} -p /sbin/ldconfig %post -n php-%{name} if [ $1 = "1" ]; then if [ -f %{_sysconfdir}/php.ini ]; then LINE=`grep ^extension\s*=\s*tclink.so$ %{_sysconfdir}/php.ini` if [ x$LINE = "x" ]; then echo extension = tclink.so >> %{_sysconfdir}/php.ini fi fi fi if [ $1 -gt 1 ]; then #We're in *upgrade mode*. Since we can't be sure the configuration files #are sane, remove module from the conf files to clean them, re-add again #in a way that the older module we're replacing won't try to erase (the #post scripts were broken on some packages) #Also, there could be extra lines, so make sure we uncomment one #Finally, don't check for presence of php.ini, if it's not there, #we have a problem, so it should generate an error message. perl -pi -e 's|^extension\s*=\s*tclink.so|;extension = tclink.so|g' %{_sysconfdir}/php.ini perl -pi -e 's|^;extension\s*=\s*tclink.so|extension = tclink.so|' %{_sysconfdir}/php.ini fi if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi %preun -n php-%{name} if [ $1 = "0" ]; then if [ -f %{_sysconfdir}/php.ini ]; then perl -pi -e 's|^extension\s*=\s*tclink.so|;extension = tclink.so|g' %{_sysconfdir}/php.ini fi if [ -e %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi fi %files -n php-%{name} %defattr(-,root,root) %{phpdir}/extensions/tclink.so %attr(755,apache,apache) %{apachecontent}/addon-modules/* %doc %{_docdir}/%{name}-%{version}/README %files -n %{lib_name} %defattr(-,root,root) %{_libdir}/*.so.* %attr(755,root,root) %doc README %files -n %{lib_name}-devel %defattr(-,root,root) %{_libdir}/*.so %{_libdir}/%{lib_name}/*.a %{_includedir}/%{lib_name}/*.h %doc doc/TCDevGuide.txt doc/TCDevGuide.html %changelog * Tue Feb 05 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.1.1-2mdk - Fix spec and reput the documentation into the devel package * Tue Feb 05 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.1.1-1mdk - New 3.3 API finally compiles with PHP 4.1! * Mon Oct 29 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-2mdk - Fixed errors in changelog. - Fixed devel files location. * Thu Oct 25 2001 Christian Belisle <cbelisle@mandrakesoft.com> 4.0.6-1mdk - PHP 4.0.6. - TCLink-C 3.2.2. - TCLink-php 3.2.6. - s/Copyright/License. - TCLink-C no longer in the php package. - Respect library policy (spec cleaning). * Sat Apr 14 2001 Jean-Michel Dault <jmdault@mandrakesoft.com> 4.0.4pl1-1mdk - New package, will be used by the Mandrake Payment web sites