# -*- mode: rpm-spec; -*-

%define version_major  1.0
%define version_relext 0.20031201

%define version_package 1.0-20031201

## for apache2
%define _with_cgi_bin /var/www/cgi-bin
## for apache1
#define _with_cgi_bin /home/httpd/cgi-bin

%define _sysconfdir /etc/opensoap
%define _with_servicesdir /usr/lib/opensoap

%define _localstatedir /var/opensoap
# may need to be modified like /var/{log,spool,run}/opensoap

Summary: SOAP-based middleware for XML Web Services applications.
Summary(ja): XML Webサービスアプリケーション向けSOAPベースミドルウェア。
Name: opensoap
Version: 2.0.1
Release: 0vl1
Epoch: 1
Group: System Environment/Libraries
Source: http://www.opensoap.jp/download/%{name}-%{version}.tar.gz
Patch0: opensoap-2.0.1-protected.patch

License: BSD
URL: http://www.opensoap.jp/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
#Patch: %{name}-%{version_package}.patch

BuildRequires: libxml2-devel openssl-devel apache2-devel
Requires: libxml2 openssl

%description
OpenSOAP provides an environment for XML Web Services.
API libraries to use SOAP (Simple Object Access Protocol) and the
server for service applications are provided.  Also Transaction and
Security functions are implemented.
This main package includes shared libraries for executing OpenSOAP
application software, and such basic tools as Soaping client/service
and Transaction service.

%description -l ja
OpenSOAPはXML Webサービスのための環境を提供します。SOAP (Simple Object
Access Protocol)を利用するためのAPIライブラリと、サービスアプリケーショ
ン運用のためのサーバを提供し、トランザクションやセキュリティの機能を持っ
ています。
この本体パッケージには、OpenSOAPアプリケーションソフト実行時に必要な
共有ライブラリ、及び、基本ツールであるSoapingクライアント/サービス、
Transactionサービスが含まれます。

%package devel
Summary: Libraries, include files to develop OpenSOAP applications.
Summary(ja): OpenSOAPアプリケーション開発のためのライブラリとヘッダファイル。
Group: Development/Libraries
Requires: %{name} = %{epoch}:%{version}-%{release}

%description devel
Libraries, include-header files and documentation which can be used to
develop software based on SOAP for Web Services, and to compile the
source code for OpenSOAP application programs.

%description devel -l ja
このライブラリとヘッダファイル、及びドキュメント類を利用することで、
WebサービスのためのSOAP通信を利用するソフトウェアを開発したり、入手し
たOpenSOAPアプリケーションのソースコードをコンパイル及びリンクすること
が可能となります。

%package server
Summary: Server for the original OpenSOAP functions.
Summary(ja): OpenSOAP独自の機能を実現するためのサーバ。
Group: System Environment/Daemons
Requires: %{name} = %{epoch}:%{version}-%{release}
Provides: mod_opensoap = %{version}-%{release}

%description server
The OpenSOAP Server supports operations for Web Service systems and
provides practical functions, such as asynchronous client connections
for non-real time processing, message forwarding for searching valid
services and passing through firewalls, and signing messages for
security validation.

%description server -l ja
OpenSOAPサーバは、大規模なWebサービスシステムの運用をサポートします。
サービスの非リアルタイム処理に対応する非同期クライアント接続機能、サービ
スの探索やファイアウォール越えを実現するサーバ間メッセージ転送機能、メッ
セージへの署名などを行うセキュリティ機能が含まれています。

%package samples
Summary: Sample application programs of OpenSOAP.
Summary(ja): OpenSOAPのサンプルアプリケーションプログラム。
Group: Applications/Networking
Requires: %{name} = %{epoch}:%{version}-%{release}

%description samples
This is a collection of simple sample application programs using
OpenSOAP.  Please try them if you just want to use OpenSOAP.  If you
are interested in developing application programs, please also refer
to the source codes.

%description samples -l ja
OpenSOAPアプリケーションの簡単なサンプルの寄せ集めです。
OpenSOAPをとりあえず使ってみたい場合に、是非お試し下さい。アプリケーショ
ンプログラム開発に興味のある方は、ソースコードもご覧下さい。

%prep
%setup -q 
%patch0 -p1 -b .protected

%build
%configure --sysconfdir=%{_sysconfdir} --with-servicesdir=%{_with_servicesdir} --with-cgi-bin=%{_with_cgi_bin} --localstatedir=%{_localstatedir} --with-ssl-include=/usr/include

## doc files to be copied
cp -pr doc docs
find docs -name 'Makefile*' -exec rm {} \;
rm -rf docs/api/*/Doxyfile
rm -rf docs/api/*/text/
cp -pr samples docs/

make

%install
rm -rf $RPM_BUILD_ROOT
LIBRARY_PATH="$RPM_BUILD_ROOT"%{_libdir} make DESTDIR="$RPM_BUILD_ROOT" install
# samples
make DESTDIR="$RPM_BUILD_ROOT" install-samples

# install SYSV init stuff
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m755 etc/init.d/opensoap.redhat \
	$RPM_BUILD_ROOT/etc/rc.d/init.d/opensoap

%clean
rm -rf $RPM_BUILD_ROOT

%post server
# Register the opensoap service
/sbin/chkconfig --add opensoap

%preun server
if [ $1 = 0 ]; then
#	%{_sbindir}/opensoap-server-ctl stop || exit 0
	/sbin/service opensoap stop
	/sbin/chkconfig --del opensoap
fi

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_bindir}/soaping
%{_libdir}/libFileLib.so.*
%{_libdir}/libOpenSOAPClient.so.*
%{_libdir}/libOpenSOAPInterface.so.*
%{_libdir}/libOpenSOAPService.so.*
%{_libdir}/libOpenSOAPSecurity.so.*
%{_libdir}/libSharedLib.so.*
%{_libdir}/libTraceLib.so.*
%{_with_cgi_bin}/TransactionService.cgi
%{_with_cgi_bin}/SoapingService.cgi
%{_with_servicesdir}/Soaping
%{_with_servicesdir}/Transaction
%{_localstatedir}/services/Transaction
%{_mandir}/man1/*
%{_mandir}/ja/man1/*
%doc INSTALL INSTALL.ujis README README.ujis LICENSE
%doc HISTORY HISTORY.ujis TODO TODO.ujis
%doc docs/tools

%files devel
%defattr(-,root,root)
%{_includedir}/OpenSOAP
%{_libdir}/libFileLib.so
%{_libdir}/libOpenSOAPClient.so
%{_libdir}/libOpenSOAPInterface.so
%{_libdir}/libOpenSOAPService.so
%{_libdir}/libOpenSOAPSecurity.so
%{_libdir}/libSharedLib.so
%{_libdir}/libTraceLib.so
%{_libdir}/libFileLib.*a
%{_libdir}/libOpenSOAPClient.*a
%{_libdir}/libOpenSOAPInterface.*a
%{_libdir}/libOpenSOAPService.*a
%{_libdir}/libOpenSOAPSecurity.*a
%{_libdir}/libSharedLib.*a
%{_libdir}/libTraceLib.*a
%doc docs/api/en
%doc docs/api/ja

%files server
%defattr(-,root,root)
%{_sbindir}/*
%{_libdir}/libOpenSOAPServer.*
#{_libdir}/libHTTPMessage.*
%{_libdir}/libSOAPMessage.*
%{_libdir}/libconnection.*
%{_libdir}/apache2/modules/mod_opensoap.so
%config %{_sysconfdir}/server.conf
%config %{_sysconfdir}/privKey.pem
%config %{_sysconfdir}/pubKey.pem
%{_sysconfdir}/*pem.default
%{_sysconfdir}/ssml/Soaping.ssml
%{_sysconfdir}/ssml/Transaction.ssml
%{_with_cgi_bin}/soapInterface.cgi
%{_mandir}/man8/*
%{_mandir}/ja/man8/*
%doc docs/server/*
%config /etc/rc.d/init.d/opensoap

%files samples
%defattr(-,root,root)

%doc docs/samples/*
%{_with_cgi_bin}/*Calc*
%{_with_cgi_bin}/Hello*
%{_with_cgi_bin}/GetCertService.cgi
%{_with_cgi_bin}/*Shopping*
%{_with_cgi_bin}/TransactionApp.cgi
%{_with_cgi_bin}/TransactionHtml
%{_with_cgi_bin}/TransactionABankService.cgi
%{_with_cgi_bin}/Echo*
%{_with_servicesdir}/*Calc*
%{_with_servicesdir}/*Hello*
%{_with_servicesdir}/GetCert
%{_with_servicesdir}/*Shopping*
%{_with_servicesdir}/TransactionABank
%{_with_servicesdir}/Echo
%{_bindir}/*Calc*
%{_bindir}/*Hello*
%{_bindir}/GetCertClient
%{_bindir}/registCA
# %{_bindir}/genrsakey
# %{_bindir}/secEnv
%{_bindir}/*Shopping*
%{_bindir}/TransactionClient
%{_bindir}/EchoClient
%{_sysconfdir}/ssml/*Calc*
%{_sysconfdir}/ssml/GetCert.ssml
%{_sysconfdir}/ssml/*Hello*
%{_sysconfdir}/ssml/*Shopping*
%{_sysconfdir}/ssml/TransactionABank.ssml
%{_sysconfdir}/ssml/Echo.ssml
%{_localstatedir}/services/CalcAsync
%{_localstatedir}/services/GetCert
%{_localstatedir}/services/ShoppingSec

%changelog
* Wed Oct 03 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.1-0vl1
- updated to 2.0.1
- added Patch0 based on Bugzilla

* Mon Dec 01 2003 Nobuhito OKADA <okada@opensoap.jp> 1.0-0.20031201
- added /usr/kerberos/include to avoid ssl compilation errors on RedHat9

* Wed Sep 03 2003 Nobuhito OKADA <okada@opensoap.jp> 1.0-0.20030903
- specify LIBRARY_PATH for make install

* Fri May 30 2003 Nobuhito OKADA <okada@opensoap.jp> 1.0-0.20030530
- added init script
- added Epoch because versioning was confusing
- added man/ja/
- build opensoap-samples properly

* Sat Mar  1 2003 Nobuhito OKADA <okada@opensoap.jp> 1.0_20030228-2
- added %defattr
- removed Vendor
- corrected _with_cgi_bin (bug of define ?)

* Thu Feb 28 2003 Nobuhito OKADA <okada@opensoap.jp> 1.0_20030228-1
- Released as the first version.
