##
# HTML documentation
%define mydocs __tmp_docdir
%define pristine_name soci
#
##
# Default values are --without empty --with mysql --with postgresql
# --without sqlite3 --without odbc
# --without firebird --without oracle
# --with nls
# Note that, for Oracle, when enabled, the following options should
# also be given:
# --with-oracle-include=/opt/oracle/app/oracle/product/11.1.0/db_1/rdbms/public
# --with-oracle-lib=/opt/oracle/app/oracle/product/11.1.0/db_1/lib
# If the macros are defined, redefine them with the correct compilation flags.
%bcond_with empty
%bcond_without mysql
%bcond_without postgresql
%bcond_with sqlite3
%bcond_with odbc
%bcond_with firebird
%bcond_with oracle
%bcond_without nls
%define _default_oracle_dir /opt/oracle/app/oracle/product/11.1.0/db_1
%{!?_with_oracle_incdir: %define _with_oracle_incdir --with-oracle-include=%{_default_oracle_dir}/rdbms/public}
%{!?_with_oracle_libdir: %define _with_oracle_libdir --with-oracle-lib=%{_default_oracle_dir}/lib}
#
##
#
Name: extras-soci
Version: 3.1.0
Release: 2%{?dist}
Summary: The database access library for C++ programmers
Group: System Environment/Libraries
License: Boost
URL: http://sourceforge.net/projects/%{name}
Source0: http://downloads.sourceforge.net/extras-soci/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: boost-devel >= 1.34
BuildRequires: cppunit-devel >= 1.10
BuildRequires: libtool
#Requires:
%description
SOCI is a C++ database access library that provides the
illusion of embedding SQL in regular C++ code, staying entirely within
the C++ standard.
That (RPM) package is based on a fork, from the source code base
corresponding to version 3.0.0 of the pristine SOCI code. That fork,
hosted by the Extras-SOCI project
(http://sourceforge.net/projects/extras-soci), which itself relies on
the SOCI library, brings only changes in the building process: it does
not alter the code (except for compatibility with g++ from version 4.3
onwards), and keeps a full compatibility with the genuine SOCI
tar-ball delivered on the SOCI web site
(http://%{pristine_name}.sourceforge.net).
That RPM package will keep synchronised with future releases of the
SOCI library, if any.
%{?with_empty:%package empty
Summary: Empty backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
%description empty
This package contains the Empty backend for SOCI, i.e.,
dynamic library specific to the Empty database. If you would like to
use SOCI in your programs with Empty, you will need to
install %{name}-empty.}
%{?with_mysql:%package mysql
Summary: MySQL backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: mysql-devel >= 5.0
%description mysql
This package contains the MySQL backend for SOCI, i.e.,
dynamic library specific to the MySQL database. If you would like to
use SOCI in your programs with MySQL, you will need to
install %{name}-mysql.}
%{?with_postgresql:%package postgresql
Summary: PostGreSQL backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: postgresql-devel >= 7.1
%description postgresql
This package contains the PostGreSQL backend for SOCI, i.e.,
dynamic library specific to the PostGreSQL database. If you would like
to use SOCI in your programs with PostGreSQL, you will need to
install %{name}-postgresql.}
%{?with_sqlite:%package sqlite
Summary: SQLite3 backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: sqlite-devel >= 3.0
%description sqlite
This package contains the SQLite3 backend for SOCI, i.e.,
dynamic library specific to the SQLite3 database. If you would like to
use SOCI in your programs with SQLite3, you will need to
install %{name}-sqlite.}
%{?with_odbc:%package odbc
Summary: ODBC backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: unixODBC-devel >= 2.2
%description odbc
This package contains the ODBC backend for SOCI, i.e.,
dynamic library specific to the ODBC database. If you would like to
use SOCI in your programs with ODBC, you will need to
install %{name}-odbc.}
%{?with_firebird:%package firebird
Summary: Firebird backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: FirebirdSS >= 2.0
%description firebird
This package contains the Firebird backend for SOCI, i.e.,
dynamic library specific to the Firebird database. If you would like to
use SOCI in your programs with Firebird, you will need to
install %{name}-firebird.}
%{?with_oracle:%package oracle
Summary: Oracle backend for %{name}
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
%description oracle
This package contains the Oracle backend for SOCI, i.e.,
dynamic library specific to the Oracle database. If you would like to
use SOCI in your programs with Oracle, you will need to install
%{name}-oracle.}
%package devel
Summary: Header files, libraries and development documentation for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
%description devel
This package contains the header files, dynamic libraries and
development documentation for %{name}. If you would like to develop
programs using %{name}, you will need to install %{name}-devel.
%{?with_empty:%package empty-devel
Summary: Empty backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-empty = %{version}-%{release}
%description empty-devel
This package contains the Empty backend for %{name}, i.e., header
files and dynamic libraries specific to the Empty database. If you
would like to develop programs using %{name} and Empty, you will need
to install %{name}-empty.}
%{?with_mysql:%package mysql-devel
Summary: MySQL backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-mysql = %{version}-%{release}
Requires: mysql-devel >= 5.0
%description mysql-devel
This package contains the MySQL backend for %{name}, i.e., header
files and dynamic libraries specific to the MySQL database. If you
would like to develop programs using %{name} and MySQL, you will need
to install %{name}-mysql.}
%{?with_postgresql:%package postgresql-devel
Summary: PostGreSQL backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-postgresql = %{version}-%{release}
Requires: postgresql-devel >= 7.1
%description postgresql-devel
This package contains the PostGreSQL backend for %{name}, i.e., header
files and dynamic libraries specific to the PostGreSQL database. If
you would like to develop programs using %{name} and PostGreSQL, you
will need to install %{name}-postgresql.}
%{?with_sqlite:%package sqlite-devel
Summary: SQLite3 backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-sqlite = %{version}-%{release}
Requires: sqlite-devel >= 3.0
%description sqlite-devel
This package contains the SQLite3 backend for %{name}, i.e., header
files and dynamic libraries specific to the SQLite3 database. If you
would like to develop programs using %{name} and SQLite3, you will need
to install %{name}-sqlite.}
%{?with_odbc:%package odbc-devel
Summary: Odbc backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-odbc = %{version}-%{release}
Requires: unixODBC-devel >= 2.2
%description odbc-devel
This package contains the Odbc backend for %{name}, i.e., header
files and dynamic libraries specific to the Odbc database. If you
would like to develop programs using %{name} and Odbc, you will need
to install %{name}-odbc.}
%{?with_firebird:%package firebird-devel
Summary: Firebird backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-firebird = %{version}-%{release}
Requires: FirebirdSS >= 2.0
%description firebird-devel
This package contains the Firebird backend for %{name}, i.e., header
files and dynamic libraries specific to the Firebird database. If you
would like to develop programs using %{name} and Firebird, you will need
to install %{name}-firebird.}
%{?with_oracle:%package oracle-devel
Summary: Oracle backend for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-oracle = %{version}-%{release}
%description oracle-devel
This package contains the Oracle backend for %{name}, i.e., header
files and dynamic libraries specific to the Oracle database. If you
would like to develop programs using %{name} and Oracle, you will need
to install %{name}-oracle.}
%package doc
Summary: HTML documentation for the SOCI library
Group: Documentation
BuildArch: noarch
BuildRequires: doxygen, texlive-latex, texlive-dvips, ghostscript
%description doc
This package contains the documentation in the HTML format of the SOCI
library. The documentation is the same as at the SOCI web page.
%prep
%setup -q
rm -f INSTALL
# find ./doc -type f -perm 755 -exec chmod 644 {} \;
# Fix some permissions and formats
chmod -x AUTHORS ChangeLog COPYING NEWS README
# find . -type f -name '*.[hc]pp' -exec chmod 644 {} \;
%build
%configure --disable-static \
%{?with_empty:--enable-backend-empty} \
%{!?with_empty:--disable-backend-empty} \
%{?with_mysql:--enable-backend-mysql} \
%{!?with_mysql:--disable-backend-mysql} \
%{?with_postgresql:--enable-backend-postgresql} \
%{!?with_postgresql:--disable-backend-postgresql} \
%{?with_sqlite3:--enable-backend-sqlite3} \
%{!?with_sqlite3:--disable-backend-sqlite3} \
%{?with_odbc:--enable-backend-odbc} \
%{!?with_odbc:--disable-backend-odbc} \
%{?with_firebird:--enable-backend-firebird} \
%{!?with_firebird:--disable-backend-firebird} \
%{?with_oracle:--enable-backend-oracle %{?_with_oracle_incdir} %{?_with_oracle_libdir}} \
%{!?with_oracle:--disable-backend-oracle} \
%{?with_nls:--enable-nls} \
%{!?with_nls:--disable-nls}
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%{?with_nls:%find_lang %{name}}
##
# Remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/config.h
rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{pristine_name}_*.la
##
# Move the HTML documentation out of the way
# chmod 644 doc/html/installdox doc/html/*.png doc/html/*.ico
rm -rf %{mydocs} && mkdir -p %{mydocs}
mv $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html %{mydocs}
##
# Duplicate the header files, so as to keep the compatibility, for
# developers using the SOCI library, with the non-packaged version of
# that library.
for header_file in $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/core/*.h; do
cp ${header_file} $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}
done
%{?with_empty:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/empty/%{pristine_name}-empty.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_mysql:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/mysql/%{pristine_name}-mysql.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_postgresql:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/postgresql/%{pristine_name}-postgresql.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_sqlite:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/sqlite3/%{pristine_name}-sqlite3.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_odbc:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/odbc/%{pristine_name}-odbc.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_firebird:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/firebird/%{pristine_name}-firebird.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%{?with_oracle:cp $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}/backends/oracle/%{pristine_name}-oracle.h $RPM_BUILD_ROOT%{_includedir}/%{pristine_name}}
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%{?with_empty:%post empty -p /sbin/ldconfig
%postun empty -p /sbin/ldconfig}
%{?with_mysql:%post mysql -p /sbin/ldconfig
%postun mysql -p /sbin/ldconfig}
%{?with_postgresql:%post postgresql -p /sbin/ldconfig
%postun postgresql -p /sbin/ldconfig}
%{?with_sqlite:%post sqlite -p /sbin/ldconfig
%postun sqlite -p /sbin/ldconfig}
%{?with_odbc:%post odbc -p /sbin/ldconfig
%postun odbc -p /sbin/ldconfig}
%{?with_firebird:%post firebird -p /sbin/ldconfig
%postun firebird -p /sbin/ldconfig}
%{?with_oracle:%post oracle -p /sbin/ldconfig
%postun oracle -p /sbin/ldconfig}
%{?with_nls:%files -f %{name}.lang}
%{?without_nls:%files}
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_core.so.*
%{?with_empty:%files empty
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_empty.so.*}
%{?with_mysql:%files mysql
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_mysql.so.*}
%{?with_postgresql:%files postgresql
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_postgresql.so.*}
%{?with_sqlite:%files sqlite
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_sqlite3.so.*}
%{?with_odbc:%files odbc
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_odbc.so.*}
%{?with_firebird:%files firebird
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_firebird.so.*}
%{?with_oracle:%files oracle
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%{_libdir}/lib%{pristine_name}_oracle.so.*}
%files devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/*.h
%{_includedir}/%{pristine_name}/core
%{_bindir}/%{name}-config
%{_libdir}/lib%{pristine_name}_core.so
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/aclocal/%{name}.m4
%{_mandir}/man1/%{name}-config.1.*
%{?with_empty:%files empty-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/empty
%{_libdir}/lib%{pristine_name}_empty.so}
%{?with_mysql:%files mysql-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/mysql
%{_libdir}/lib%{pristine_name}_mysql.so}
%{?with_postgresql:%files postgresql-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/postgresql
%{_libdir}/lib%{pristine_name}_postgresql.so}
%{?with_sqlite:%files sqlite-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/sqlite3
%{_libdir}/lib%{pristine_name}_sqlite3.so}
%{?with_odbc:%files odbc-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/odbc
%{_libdir}/lib%{pristine_name}_odbc.so}
%{?with_firebird:%files firebird-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/firebird
%{_libdir}/lib%{pristine_name}_firebird.so}
%{?with_oracle:%files oracle-devel
%defattr(-,root,root,-)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{_includedir}/%{pristine_name}
%{_includedir}/%{pristine_name}/backends/oracle
%{_libdir}/lib%{pristine_name}_oracle.so}
%files doc
%defattr(-,root,root,-)
%doc %{mydocs}/html
%doc AUTHORS ChangeLog COPYING NEWS README
%changelog
* Sun Apr 26 2009 Denis Arnaud 3.1.0-2
- RPM packaging of the new Extras-SOCI project
* Sat Apr 25 2009 Denis Arnaud 3.1.0-1
- RPM packaging of the new Extras-SOCI project
* Sat Apr 18 2009 Denis Arnaud 3.0.0-4
- Fixed an issue about OPTFLAGS compilation
* Tue Apr 14 2009 Denis Arnaud 3.0.0-3
- Restarted from pristine version 3.0.0 of upstream (SOCI) project
* Sat Apr 4 2009 Denis Arnaud 3.0.0-2
- Specific RPM for each backend
* Fri Mar 27 2009 Denis Arnaud 3.0.0-1
- First RPM release