File poco.spec of Package poco-c++

# Define constants required during the package build below.
%define POCOVER     1.3.5

Summary:            C++ Portable Components for network-centric applications
Name:               poco
Version:            %{POCOVER}
Release:            1%{?dist}
Group:              Development/Libraries/C and C++
URL:                http://pocoproject.org/
License:            Boost
Source0:            http://downloads.sourceforge.net/poco/poco-%{version}-all.tar.bz2
Source1:            http://downloads.sourceforge.net/poco/poco-%{version}-doc.tar.gz
BuildRoot:          %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# PATCH-FIX-OPENSUSE name-of-file.patch daniel.s.reichenbach@mac.com -- Use system libraries instead of included copies in Poco.
Patch0:             poco-%{POCOVER}-syslibs.patch

Requires(postun):   %run_ldconfig

# Any LSB compliant system with GNU C++ compiler and C++ standard libraries should compile Poco.
BuildRequires:      gcc-c++
BuildRequires:      libstdc++-devel
BuildRequires:      lsb

# The Poco Foundation class libraries depend at least upon having SQLite3, Expat, PCRE and Zlib available.
BuildRequires:      pcre-devel
BuildRequires:      zlib-devel

Requires:           libpcre0
Requires:           zlib

# ---------------- poco ----------------
%description -n     poco

POCO, the C++ Portable Components, is a collection of open source C++ class
libraries that simplify and accelerate the development of network-centric,
portable applications in C++. The libraries integrate perfectly with the
C++ Standard Library and fill many of the functional gaps left open by it.

Their modular and efficient design and implementation makes the C++ Portable
Components extremely well suited for embedded development, an area where the
C++ programming language is becoming increasingly popular, due to its
suitability for both low-level (device I/O, interrupt handlers, etc.) and
high-level object-oriented development. Of course, POCO is also ready for
enterprise-level challenges.

# ---------------- poco-devel ----------------
%package -n         poco-devel
Summary:            Header files and development components for Poco
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
Requires:           libPocoCrypto8 = %{version}-%{release}
Requires:           libPocoData8 = %{version}-%{release}
Requires:           poco-debug = %{version}-%{release}
Requires:           libPocoFoundation8 = %{version}-%{release}
Requires:           libPocoMySQL8 = %{version}-%{release}
Requires:           libPocoNetSSL8 = %{version}-%{release}
Requires:           libPocoNet8 = %{version}-%{release}
Requires:           libPocoODBC8 = %{version}-%{release}
Requires:           libPocoSQLite8 = %{version}-%{release}
Requires:           libPocoUtil8 = %{version}-%{release}
Requires:           libPocoXML8 = %{version}-%{release}
Requires:           libPocoZip8 = %{version}-%{release}
Requires:           libexpat-devel
Requires:           pcre-devel
Requires:           sqlite3-devel
Requires:           zlib-devel
Requires:           libopenssl-devel

%description -n     poco-devel

This package contains the components needed for developing programs
using POCO, the C++ Portable Components.

# ---------------- libPocoCrypto8 ----------------
%package -n         libPocoCrypto8
Summary:            Poco Crypto Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      libopenssl-devel

%description -n libPocoCrypto8

This package contains the Crypto component of POCO. (POCO is a set of 
C++ class libraries for network-centric applications.)

# ---------------- libPocoData8 ----------------
%package -n         libPocoData8
Summary:            Poco Data Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}

%description -n libPocoData8

This package contains the Data component of POCO. (POCO is a set of 
C++ class libraries for network-centric applications.)

# ---------------- poco-debug ----------------
%package -n         poco-debug
Summary:            Poco Debug Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}

%description -n poco-debug

This package contains the debug builds of the POCO libraries for 
application testing purposes.

# ---------------- poco-doc ----------------
%package -n         poco-doc
Summary:            The POCO API reference documentation
Version:            %{POCOVER}
Group:              Documentation
Requires:           poco = %{POCOVER}

%description -n poco-doc

The POCO C++ Libraries (POCO stands for POrtable COmponents) 
are open source C++ class libraries that simplify and accelerate the 
development of network-centric, portable applications in C++. The 
POCO C++ Libraries are built strictly on standard ANSI/ISO C++, 
including the standard library.

This is the complete POCO class library reference documentation in 
HTML format.

# ---------------- libPocoFoundation8 ----------------
%package -n         libPocoFoundation8
Summary:            Poco Foundation Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}

%description -n libPocoFoundation8

This package contains the Foundation component of POCO. (POCO is a set 
of C++ class libraries for network-centric applications.)

# ---------------- libPocoMySQL8 ----------------
%package -n         libPocoMySQL8
Summary:            Poco Data/MySQL Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      libmysqlclient-devel

%description -n libPocoMySQL8

This package contains the Data/MySQL component of POCO. (POCO is a set 
of C++ class libraries for network-centric applications.)

# ---------------- libPocoNet8 ----------------
%package -n         libPocoNet8
Summary:            Poco Net Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}

%description -n libPocoNet8

This package contains the Net component of POCO. (POCO is a set of C++ 
class libraries for network-centric applications.)

# ---------------- libPocoNetSSL8 ----------------
%package -n         libPocoNetSSL8
Summary:            Poco NetSSL Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      libopenssl-devel

%description -n libPocoNetSSL8

This package contains the NetSSL component of POCO. (POCO is a set of 
C++ class libraries for network-centric applications.)

# ---------------- libPocoODBC8 ----------------
%package -n         libPocoODBC8
Summary:            Poco Data/ODBC Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      unixODBC-devel

%description -n libPocoODBC8

This package contains the Data/ODBC component of POCO. (POCO is a set 
of C++ class libraries for network-centric applications.)

# ---------------- libPocoSQLite8 ----------------
%package -n         libPocoSQLite8
Summary:            Poco Data/SQLite Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      sqlite3-devel

%description -n libPocoSQLite8

This package contains the Data/SQLite component of POCO. (POCO is a set 
of C++ class libraries for network-centric applications.)

# ---------------- libPocoUtil8 ----------------
%package -n         libPocoUtil8
Summary:            Poco Util Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}

%description -n libPocoUtil8

This package contains the Util component of POCO. (POCO is a set of C++ 
class libraries for network-centric applications.)

# ---------------- libPocoXML8 ----------------
%package -n         libPocoXML8
Summary:            Poco XML Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      libexpat-devel

%description -n libPocoXML8

This package contains the XML component of POCO. (POCO is a set of C++ 
class libraries for network-centric applications.)

# ---------------- libPocoZip8 ----------------
%package -n         libPocoZip8
Summary:            Poco ZIP Runtime Support
Version:            %{POCOVER}
Group:              Development/Libraries/C and C++
Requires:           poco = %{POCOVER}
BuildRequires:      zlib-devel

%description -n libPocoZip8

This package contains the Zip component of POCO. (POCO is a set of C++ 
class libraries for network-centric applications.)

# ================================================================
# prep
# ================================================================

%prep
%setup -q -n poco-%{version}-all -a1
%__chmod -R a-x+X poco-%{version}-doc

# Replace a few variables in the build scripts with the build systems variables.
%__sed -i.orig -e 's|$(INSTALLDIR)/lib\b|$(INSTALLDIR)/%{_lib}|g' Makefile
%__sed -i.orig -e 's|ODBCLIBDIR = /usr/lib\b|ODBCLIBDIR = %{_libdir}|g' Data/ODBC/Makefile Data/ODBC/testsuite/Makefile
%__sed -i.orig -e 's|flags=""|flags="%{optflags}"|g' configure

%patch0 -p1 -b .orig
%__rm -f Foundation/include/Poco/DeflatingStream.h.orig
%__rm -f Foundation/include/Poco/InflatingStream.h.orig
%__rm -f XML/include/Poco/XML/ParserEngine.h.orig

# Remove files that should not be in the source archive.
%__rm -f Crypto/include/Poco/.*DS_Store
%__rm -f Foundation/src/MSG00001.bin

# Remove copies of libraries which are replaced by local systems libraries.
%__rm -f Foundation/include/Poco/zconf.h
%__rm -f Foundation/include/Poco/zlib.h
%__rm -f Foundation/src/adler32.c
%__rm -f Foundation/src/compress.c
%__rm -f Foundation/src/crc32.c
%__rm -f Foundation/src/crc32.h
%__rm -f Foundation/src/deflate.c
%__rm -f Foundation/src/deflate.h
%__rm -f Foundation/src/gzio.c
%__rm -f Foundation/src/infback.c
%__rm -f Foundation/src/inffast.c
%__rm -f Foundation/src/inffast.h
%__rm -f Foundation/src/inffixed.h
%__rm -f Foundation/src/inflate.c
%__rm -f Foundation/src/inflate.h
%__rm -f Foundation/src/inftrees.c
%__rm -f Foundation/src/inftrees.h
%__rm -f Foundation/src/trees.c
%__rm -f Foundation/src/trees.h
%__rm -f Foundation/src/zconf.h
%__rm -f Foundation/src/zlib.h
%__rm -f Foundation/src/zutil.c
%__rm -f Foundation/src/zutil.h
%__rm -f Foundation/src/pcre*
%__rm -f Foundation/src/ucp.h
%__rm -f Data/SQLite/src/sqlite3.*
%__rm -f XML/include/Poco/XML/expat.h
%__rm -f XML/include/Poco/XML/expat_external.h
%__rm -f XML/src/ascii.h
%__rm -f XML/src/asciitab.h
%__rm -f XML/src/expat_config.h
%__rm -f XML/src/iasciitab.h
%__rm -f XML/src/internal.h
%__rm -f XML/src/latin1tab.h
%__rm -f XML/src/nametab.h
%__rm -f XML/src/utf8tab.h
%__rm -f XML/src/xmlparse.cpp
%__rm -f XML/src/xmlrole.c
%__rm -f XML/src/xmlrole.h
%__rm -f XML/src/xmltok.c
%__rm -f XML/src/xmltok.h
%__rm -f XML/src/xmltok_impl.c
%__rm -f XML/src/xmltok_impl.h
%__rm -f XML/src/xmltok_ns.c

# ================================================================
# build
# ================================================================

%build

%configure --include-path=%{_includedir}/mysql --no-tests --no-samples
%__make %{?_smp_mflags}

# ================================================================
# install
# ================================================================

%install

%__rm -rf %{buildroot}

# make a new build root dir
%__mkdir %{buildroot}

%makeinstall DESTDIR=%{buildroot}

# ================================================================
# clean
# ================================================================

%clean
%__rm -rf %{buildroot}

# ================================================================
# pre install
# ================================================================

# ================================================================
# post install
# ================================================================

# ---------------- libPocoCrypto8 ----------------
%post -n libPocoCrypto8 -p %run_ldconfig

# ---------------- libPocoData8 ----------------
%post -n libPocoData8 -p %run_ldconfig

# ---------------- poco-debug ----------------
%post -n poco-debug -p %run_ldconfig

# ---------------- libPocoFoundation8 ----------------
%post -n libPocoFoundation8 -p %run_ldconfig

# ---------------- libPocoMySQL8 ----------------
%post -n libPocoMySQL8 -p %run_ldconfig

# ---------------- libPocoNet8 ----------------
%post -n libPocoNet8 -p %run_ldconfig

# ---------------- libPocoNetSSL8 ----------------
%post -n libPocoNetSSL8 -p %run_ldconfig

# ---------------- libPocoODBC8 ----------------
%post -n libPocoODBC8 -p %run_ldconfig

# ---------------- libPocoSQLite8 ----------------
%post -n libPocoSQLite8 -p %run_ldconfig

# ---------------- libPocoUtil8 ----------------
%post -n libPocoUtil8 -p %run_ldconfig

# ---------------- libPocoXML8 ----------------
%post -n libPocoXML8 -p %run_ldconfig

# ---------------- libPocoZip8 ----------------
%post -n libPocoZip8 -p %run_ldconfig

# ================================================================
# pre uninstall
# ================================================================

# ================================================================
# post uninstall
# ================================================================

# ---------------- libPocoCrypto8 ----------------
%postun -n libPocoCrypto8 -p %run_ldconfig

# ---------------- libPocoData8 ----------------
%postun -n libPocoData8 -p %run_ldconfig

# ---------------- poco-debug ----------------
%postun -n poco-debug -p %run_ldconfig

# ---------------- libPocoFoundation8 ----------------
%postun -n libPocoFoundation8 -p %run_ldconfig

# ---------------- libPocoMySQL8 ----------------
%postun -n libPocoMySQL8 -p %run_ldconfig

# ---------------- libPocoNet8 ----------------
%postun -n libPocoNet8 -p %run_ldconfig

# ---------------- libPocoNetSSL8 ----------------
%postun -n libPocoNetSSL8 -p %run_ldconfig

# ---------------- libPocoODBC8 ----------------
%postun -n libPocoODBC8 -p %run_ldconfig

# ---------------- libPocoSQLite8 ----------------
%postun -n libPocoSQLite8 -p %run_ldconfig

# ---------------- libPocoUtil8 ----------------
%postun -n libPocoUtil8 -p %run_ldconfig

# ---------------- libPocoXML8 ----------------
%postun -n libPocoXML8 -p %run_ldconfig

# ---------------- libPocoZip8 ----------------
%postun -n libPocoZip8 -p %run_ldconfig

# ================================================================
# files
# ================================================================

# ---------------- poco ----------------
%files -n poco
%defattr(-,root,root,-)
%doc README NEWS LICENSE

# ---------------- poco-devel ----------------
%files -n poco-devel
%defattr(-,root,root,-)
%doc CONTRIBUTORS CHANGELOG doc/*
%{_includedir}/Poco
%{_libdir}/libPocoFoundation.so
%{_libdir}/libPocoFoundationd.so
%{_libdir}/libPocoXML.so
%{_libdir}/libPocoXMLd.so
%{_libdir}/libPocoUtil.so
%{_libdir}/libPocoUtild.so
%{_libdir}/libPocoNet.so
%{_libdir}/libPocoNetd.so
%{_libdir}/libPocoCrypto.so
%{_libdir}/libPocoCryptod.so
%{_libdir}/libPocoNetSSL.so
%{_libdir}/libPocoNetSSLd.so
%{_libdir}/libPocoData.so
%{_libdir}/libPocoDatad.so
%{_libdir}/libPocoSQLite.so
%{_libdir}/libPocoSQLited.so
%{_libdir}/libPocoODBC.so
%{_libdir}/libPocoODBCd.so
%{_libdir}/libPocoMySQL.so
%{_libdir}/libPocoMySQLd.so
%{_libdir}/libPocoZip.so
%{_libdir}/libPocoZipd.so

# ---------------- libPocoCrypto8 ----------------
%files -n libPocoCrypto8
%defattr(-,root,root,-)
%{_libdir}/libPocoCrypto.so.*

# ---------------- libPocoData8 ----------------
%files -n libPocoData8
%defattr(-,root,root,-)
%{_libdir}/libPocoData.so.*

# ---------------- poco-debug ----------------
%files -n poco-debug
%defattr(-,root,root,-)
%{_libdir}/libPocoFoundationd.so.*
%{_libdir}/libPocoXMLd.so.*
%{_libdir}/libPocoUtild.so.*
%{_libdir}/libPocoNetd.so.*
%{_libdir}/libPocoCryptod.so.*
%{_libdir}/libPocoNetSSLd.so.*
%{_libdir}/libPocoDatad.so.*
%{_libdir}/libPocoSQLited.so.*
%{_libdir}/libPocoODBCd.so.*
%{_libdir}/libPocoMySQLd.so.*
%{_libdir}/libPocoZipd.so.*

# ---------------- poco-doc ----------------
%files -n poco-doc
%defattr(-,root,root,-)
%doc poco-%{version}-doc/*

# ---------------- libPocoFoundation8 ----------------
%files -n libPocoFoundation8
%defattr(-,root,root,-)
%{_libdir}/libPocoFoundation.so.*

# ---------------- libPocoMySQL8 ----------------
%files -n libPocoMySQL8
%defattr(-,root,root,-)
%{_libdir}/libPocoMySQL.so.*

# ---------------- libPocoNet8 ----------------
%files -n libPocoNet8
%defattr(-,root,root,-)
%{_libdir}/libPocoNet.so.*

# ---------------- libPocoNetSSL8 ----------------
%files -n libPocoNetSSL8
%defattr(-,root,root,-)
%{_libdir}/libPocoNetSSL.so.*

# ---------------- libPocoODBC8 ----------------
%files -n libPocoODBC8
%defattr(-,root,root,-)
%{_libdir}/libPocoODBC.so.*

# ---------------- libPocoSQLite8 ----------------
%files -n libPocoSQLite8
%defattr(-,root,root,-)
%{_libdir}/libPocoSQLite.so.*

# ---------------- libPocoUtil8 ----------------
%files -n libPocoUtil8
%defattr(-,root,root,-)
%{_libdir}/libPocoUtil.so.*

# ---------------- libPocoXML8 ----------------
%files -n libPocoXML8
%defattr(-,root,root,-)
%{_libdir}/libPocoXML.so.*

# ---------------- libPocoZip8 ----------------
%files -n libPocoZip8
%defattr(-,root,root,-)
%{_libdir}/libPocoZip.so.*

# ================================================================
# changelog
# ================================================================

%changelog
* Sun Dec 20 2009 Daniel S. Reichenbach <daniel.s.reichenbach@mac.com> - 1.3.5-1
- The first version.

openSUSE Build Service is sponsored by