+#
+# $Id$
+#
+
+%define url $URL$
+
+%define name PLCAPI
+%define version 4.1
+%define subversion 2
+
+%define release %{subversion}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+
Summary: PlanetLab Central API
-Name: PLCAPI
-Version: 4.0
-Release: 1
+Name: %{name}
+Version: %{version}
+Release: %{release}
License: PlanetLab
Group: System Environment/Daemons
-URL: http://cvs.planet-lab.org/cvs/new_plc_api
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+URL: %(echo %{url} | cut -d ' ' -f 2)
Obsoletes: plcapilib
+# We use set everywhere
+Requires: python >= 2.4
+
+# We use psycopg2
+BuildRequires: postgresql-devel
+
+# Standard xmlrpc.so that ships with PHP does not marshal NULL
+BuildRequires: php-devel
+Obsoletes: php-xmlrpc
+Provides: php-xmlrpc
+
# OpenJade does not honor XML catalog files and tries to access
# www.oasis-open.org even if DTDs are locally installed. Disable
# documentation generation for now.
# BuildRequires: docbook-dtds, docbook-utils-pdf
-Requires: postgresql-server, SOAPpy
+# PostgreSQL and SOAPpy are necessary to run the API server, but not
+# plcsh. Since the only supported method of running the server is via
+# MyPLC anyway, don't be so stringent about binary requirements, in
+# case people want to install this package just for plcsh.
+# Requires: postgresql-server, SOAPpy
+AutoReqProv: no
%description
The PLCAPI package provides an XML-RPC and SOAP API for accessing the
%setup -q
%build
-# Build __init__.py metafiles and PHP API. Do not build documentation
-# for now.
-%{__make} %{?_smp_mflags} SUBDIRS=php
-
-# Byte compile
-%{__python} setup.py build
+# Build __init__.py metafiles and PHP API.
+%{__make} %{?_smp_mflags} subdirs="php php/xmlrpc"
+# Build documentation
+# beware that making the pdf file somehow overwrites the html
+%{__make} -C doc PLCAPI.pdf
+rm -f doc/PLCAPI.html
+%{__make} -C doc PLCAPI.html
%install
rm -rf $RPM_BUILD_ROOT
-
-# Install in /usr/share/plc_api
-%{__python} setup.py install \
- --install-purelib=$RPM_BUILD_ROOT/%{_datadir}/plc_api \
- --install-scripts=$RPM_BUILD_ROOT/%{_datadir}/plc_api \
- --install-data=$RPM_BUILD_ROOT/%{_datadir}/plc_api
+%{__make} %{?_smp_mflags} install DESTDIR="$RPM_BUILD_ROOT" datadir="%{_datadir}" bindir="%{_bindir}"
+#someone out there skips doc installation - we DO want this installed
+for doc in PLCAPI.html PLCAPI.pdf ; do
+ install -D -m 644 doc/$doc $RPM_BUILD_ROOT/"%{_datadir}"/plc_api/doc/$doc
+done
# Install shell symlink
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
-ln -s %{_datadir}/plc_api/Shell.py $RPM_BUILD_ROOT/%{_bindir}/plcsh
+ln -s %{_datadir}/plc_api/plcsh $RPM_BUILD_ROOT/%{_bindir}/plcsh
+
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/php.d
+cat > $RPM_BUILD_ROOT/%{_sysconfdir}/php.d/xmlrpc.ini <<EOF
+; Enable xmlrpc extension module
+extension=xmlrpc.so
+EOF
%clean
rm -rf $RPM_BUILD_ROOT
+%define php_extension_dir %(php-config --extension-dir)
+
%files
%defattr(-,root,root,-)
-%doc doc/PLCAPI.xml doc/PLCAPI.pdf doc/PLCAPI.html
+#someone out there skips doc installation - we DO want this installed
+#%doc doc/PLCAPI.xml doc/PLCAPI.pdf doc/PLCAPI.html
%dir %{_datadir}/plc_api
%{_datadir}/plc_api/*
%{_bindir}/plcsh
+%{php_extension_dir}/xmlrpc.so
+%{_sysconfdir}/php.d/xmlrpc.ini
+%{_bindir}/refresh-peer.py*
%changelog
* Fri Oct 27 2006 Mark Huang <mlhuang@CS.Princeton.EDU> -
- Initial build.
-