Dave Johansen dd3cc00
Name:           odb
174d587
Version:        2.3.0
c94e3c2
Release:        6%{?dist}
Dave Johansen dd3cc00
Summary:        Object-relational mapping (ORM) system for C++
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Group:          Development/Tools
Dave Johansen dd3cc00
License:        GPLv3
Dave Johansen dd3cc00
URL:            http://www.codesynthesis.com/products/odb/
174d587
Source0:        http://www.codesynthesis.com/download/odb/2.3/%{name}-%{version}.tar.bz2
Dave Johansen dd3cc00
06afa94
Patch1:         odb-2.3.0-gcc-4.9.0.patch
06afa94
Dave Johansen dd3cc00
# Set BuildRoot for compatibility with EPEL <= 5
Dave Johansen dd3cc00
# See: http://fedoraproject.org/wiki/EPEL:Packaging#BuildRoot_tag
Dave Johansen dd3cc00
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Dave Johansen dd3cc00
c94e3c2
# Since this is a plugin, require the specific version of GCC that its being built against
c94e3c2
%global gcc_version  %(gcc -dumpversion || echo "666")
c94e3c2
Requires: gcc = %{gcc_version}
c94e3c2
Dave Johansen dd3cc00
# If building on Fedora or RHEL 7
Dave Johansen dd3cc00
%if 0%{?rhel}%{?fedora} >= 7
Dave Johansen dd3cc00
# Then it just needs to be at least gcc 4.5.0 for plugin support
Dave Johansen dd3cc00
BuildRequires: gcc-c++ >= 4.5.0
Dave Johansen dd3cc00
BuildRequires: gcc-plugin-devel
Dave Johansen dd3cc00
%else
Dave Johansen dd3cc00
# Otherwise, use devtoolset on RHEL 5/6 because it supports plugins
Dave Johansen dd3cc00
BuildRequires: devtoolset-1.1-binutils
Dave Johansen dd3cc00
BuildRequires: devtoolset-1.1-gcc-c++
Dave Johansen dd3cc00
BuildRequires: devtoolset-1.1-gcc-plugin-devel
Dave Johansen dd3cc00
# Also list gmp-devel since devtoolset-gcc-plugin-devel should list it as a requirement but doesn't
Dave Johansen dd3cc00
# See: https://bugzilla.redhat.com/show_bug.cgi?id=908577
Dave Johansen dd3cc00
BuildRequires: gmp-devel
Dave Johansen dd3cc00
%endif
Dave Johansen dd3cc00
# Uses libcutl from Code Synthesis
174d587
BuildRequires: libcutl-devel >= 1.8.0
Dave Johansen dd3cc00
# Uses pkgconfig
Dave Johansen dd3cc00
BuildRequires: pkgconfig
9d40a09
# Uses expat
9d40a09
BuildRequires: expat-devel
Dave Johansen dd3cc00
Dave Johansen dd3cc00
1a522f1
# If building on Fedora or RHEL 7
1a522f1
%if 0%{?rhel}%{?fedora} >= 7
1a522f1
  #Then odb uses the gcc plugin directory
1a522f1
  %define ODB_PLUGIN_DIR %(g++ -print-file-name=plugin)
1a522f1
%else
1a522f1
  # Otherwise, it just uses the system directory
1a522f1
  %define ODB_PLUGIN_DIR %{_libexecdir}/odb/
1a522f1
%endif
1a522f1
1a522f1
Dave Johansen dd3cc00
%description
Dave Johansen dd3cc00
ODB is an object-relational mapping (ORM) system for C++. It provides
Dave Johansen dd3cc00
tools, APIs, and library support that allow you to persist C++ objects
Dave Johansen dd3cc00
to a relational database (RDBMS) without having to deal with tables,
Dave Johansen dd3cc00
columns, or SQL and without manually writing any of the mapping code.
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%prep
Dave Johansen dd3cc00
%setup -q
06afa94
%patch1 -p1
Dave Johansen dd3cc00
# Set the path to the default.options file
Dave Johansen dd3cc00
#define
Dave Johansen dd3cc00
%define odb_default_options_dir %{_sysconfdir}/%{name}
Dave Johansen dd3cc00
%define odb_default_options_file %{odb_default_options_dir}/default.options
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%build
b9ca412
confopts="--disable-static --with-options-file=%{odb_default_options_file}"
b9ca412
# If building on Fedora 21
b9ca412
%if 0%{?rhel}%{?fedora} >= 21
b9ca412
# gcc 4.9.0 has a de-virtualization bug
b9ca412
# See: http://codesynthesis.com/pipermail/odb-users/2014-May/001865.html
f046ee3
export CXXFLAGS="$RPM_OPT_FLAGS -fno-devirtualize"
b9ca412
%endif
b9ca412
# If building on RHEL 5/6
b9ca412
%if 0%{?rhel}%{?fedora} <= 6
Dave Johansen dd3cc00
# Otherwise, use devtoolset on RHEL 5/6 to get a version of gcc that supports plugins
Dave Johansen dd3cc00
source /opt/rh/devtoolset-1.1/enable
Dave Johansen dd3cc00
# Add the explicit linking of pthread library because of a toolchain issue
Dave Johansen dd3cc00
# See: http://www.codesynthesis.com/pipermail/odb-users/2013-February/001103.html
b9ca412
confopts="$confopts LIBS=\"-lpthread\""
Dave Johansen dd3cc00
%endif
b9ca412
%configure $confopts
Dave Johansen dd3cc00
make %{?_smp_mflags}
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%install
Dave Johansen dd3cc00
rm -rf $RPM_BUILD_ROOT
Dave Johansen dd3cc00
make install DESTDIR=$RPM_BUILD_ROOT
Dave Johansen dd3cc00
Dave Johansen dd3cc00
# Add the .conf file
Dave Johansen dd3cc00
mkdir -p $RPM_BUILD_ROOT/%{odb_default_options_dir}
Dave Johansen dd3cc00
echo "# Default ODB options file. This file is automatically loaded by the ODB
Dave Johansen dd3cc00
# compiler and can be used for installation-wide customizations, such as
Dave Johansen dd3cc00
# adding an include search path for a commonly used library. For example:
Dave Johansen dd3cc00
# -I %{_includedir}/boost141
Dave Johansen dd3cc00
#" > $RPM_BUILD_ROOT/%{odb_default_options_file}
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%clean
Dave Johansen dd3cc00
rm -rf $RPM_BUILD_ROOT
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%files
Dave Johansen dd3cc00
%config(noreplace) %{odb_default_options_file}
Dave Johansen dd3cc00
%doc GPLv3
Dave Johansen dd3cc00
%doc LICENSE
Dave Johansen dd3cc00
%doc NEWS
Dave Johansen dd3cc00
%doc doc/default.css
Dave Johansen dd3cc00
%doc doc/manual.xhtml
Dave Johansen dd3cc00
%doc doc/odb-arch.png
Dave Johansen dd3cc00
%doc doc/odb-flow.png
Dave Johansen dd3cc00
%doc doc/odb-manual.pdf
Dave Johansen dd3cc00
%doc doc/odb-manual.ps
Dave Johansen dd3cc00
%doc doc/odb.xhtml
Dave Johansen dd3cc00
%{_bindir}/odb
1a522f1
%{ODB_PLUGIN_DIR}
Dave Johansen dd3cc00
%{_mandir}/man1/odb.1.gz
Dave Johansen dd3cc00
# Exclude the documentation that doesn't need to be packaged
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/GPLv3
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/LICENSE
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/NEWS
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/README
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/default.css
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/manual.xhtml
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/odb-arch.png
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/odb-flow.png
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/odb-manual.pdf
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/odb-manual.ps
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/odb.xhtml
Dave Johansen dd3cc00
%exclude %{_datadir}/doc/odb/version
Dave Johansen dd3cc00
Dave Johansen dd3cc00
Dave Johansen dd3cc00
%changelog
c94e3c2
* Fri Jul 18 2014 Dave Johansen <davejohansen@gmail.com> 2.3.0-6
c94e3c2
- Require the version of GCC that its being built against
c94e3c2
f046ee3
* Sun Jul  6 2014 Ville Skyttä <ville.skytta@iki.fi> - 2.3.0-5
f046ee3
- Build with $RPM_OPT_FLAGS
f046ee3
06afa94
* Wed Jun 11 2014 Dave Johansen <davejohansen@gmail.com> 2.3.0-4
06afa94
- Patch to build with gcc 4.9
06afa94
7a48fa3
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.0-3
7a48fa3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
7a48fa3
5850117
* Wed May 28 2014 Dave Johansen <davejohansen@gmail.com> 2.3.0-2
9d40a09
- Adding expat-devel as BuildRequires
9d40a09
174d587
* Mon Nov 4 2013 Dave Johansen <davejohansen@gmail.com> 2.3.0-1
174d587
- Updated to 2.3.0
174d587
Dave Johansen dd3cc00
* Tue Jul 23 2013 Dave Johansen <davejohansen@gmail.com> 2.2.2-1
Dave Johansen dd3cc00
- Initial build