soci.spec 11 KB
Newer Older
Erwan Croze's avatar
Erwan Croze committed
1 2 3 4 5 6 7
# -*- rpm-spec -*-

## rpmbuild options
# These 2 lines are here because we can build the RPM for flexisip, in which
# case we prefix the entire installation so that we don't break compatibility
# with the user's libs.
# To compile with bc prefix, use rpmbuild -ba --with bc [SPEC]
Erwan Croze's avatar
Erwan Croze committed
8 9
%define    pkg_name        %{?_with_bc:bc-soci}%{!?_with_bc:soci}
%define    _lib_name       soci
Erwan Croze's avatar
Erwan Croze committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
%define    _prefix         /opt/belledonne-communications

# re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir
# taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros
%define _datarootdir       %{_prefix}/share
%define _datadir           %{_datarootdir}
%define _docdir            %{_datadir}/docs

%define build_number 1

Name:           %{pkg_name}
Version:        4.0.0
Release:        %{build_number}%{?dist}
Summary:        The database access library for C++ programmers

Group:          System Environment/Libraries
License:        Boost
URL:            http://soci.sourceforge.net/
Source0:        %{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot

BuildRequires:  boost-devel

%description
%{name} is a C++ database access library that provides the
illusion of embedding SQL in regular C++ code, staying entirely within
the C++ standard.


%{?_with_sqlite3:%package        sqlite3
Summary:        SQLite3 back-end for %{name}
Group:          System Environment/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  sqlite-devel

%description    sqlite3
This package contains the SQLite3 back-end for %{name}, i.e.,
dynamic library specific to the SQLite3 database. If you would like to
use %{name} in your programs with SQLite3, you will need to
install %{name}-sqlite3.}

%{?_with_mysql:%package        mysql
Summary:        MySQL back-end for %{name}
Group:          System Environment/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  mysql-devel

Erwan Croze's avatar
Erwan Croze committed
57

Erwan Croze's avatar
Erwan Croze committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
%description    mysql
This package contains the MySQL back-end for %{name}, i.e.,
dynamic library specific to the MySQL database. If you would like to
use %{name} in your programs with MySQL, you will need to
install %{name}-mysql.}

%{?_with_postgresql:%package        postgresql
Summary:        PostGreSQL back-end for %{name}
Group:          System Environment/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  postgresql-devel

%description    postgresql
This package contains the PostGreSQL back-end for %{name}, i.e.,
dynamic library specific to the PostGreSQL database. If you would like
to use %{name} in your programs with PostGreSQL, you will need to
install %{name}-postgresql.}

%{?_with_odbc:%package        odbc
Summary:        ODBC back-end for %{name}
Group:          System Environment/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  unixODBC-devel

%description    odbc
This package contains the ODBC back-end for %{name}, i.e.,
dynamic library specific to the ODBC connectors. If you would like to
use %{name} in your programs with ODBC, you will need to
install %{name}-odbc.}

%{?_with_oracle:%package        oracle
Summary:        Oracle back-end for %{name}
Group:          System Environment/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    oracle
This package contains the Oracle back-end for %{name}, i.e.,
dynamic library specific to the Oracle database. If you would like to
use %{name} 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}%{?_isa} = %{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_sqlite3:%package        sqlite3-devel
Summary:        SQLite3 back-end for %{name}
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-sqlite3 = %{version}-%{release}
Requires:       sqlite-devel

%description    sqlite3-devel
This package contains the SQLite3 back-end 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}-sqlite3.}

%{?_with_mysql:%package        mysql-devel
Summary:        MySQL back-end for %{name}
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-mysql = %{version}-%{release}
Requires:       mysql-devel

%description    mysql-devel
This package contains the MySQL back-end 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 back-end for %{name}
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-postgresql = %{version}-%{release}
Requires:       postgresql-devel

%description    postgresql-devel
This package contains the PostGreSQL back-end 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_odbc:%package        odbc-devel
Summary:        ODBC back-end for %{name}
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-odbc = %{version}-%{release}
Requires:       unixODBC-devel

%description    odbc-devel
This package contains the Odbc back-end 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_oracle:%package        oracle-devel
Summary:        Oracle back-end for %{name}
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Requires:       %{name}-oracle = %{version}-%{release}

%description    oracle-devel
This package contains the Oracle back-end 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 %{name} library
Group:          Documentation
%if 0%{?fedora} || 0%{?rhel} > 5
BuildArch:      noarch
%endif
#BuildRequires:  tex(latex)
#BuildRequires:  doxygen, ghostscript

%description    doc
This package contains the documentation in the HTML format of the %{name}
library. The documentation is the same as at the %{name} web page.

Erwan Croze's avatar
Erwan Croze committed
187 188 189 190 191 192
%if 0%{?rhel} && 0%{?rhel} <= 7
%global cmake_name cmake3
%else
%global cmake_name cmake
%endif

Erwan Croze's avatar
Erwan Croze committed
193 194 195 196 197 198 199 200 201 202 203 204 205
%prep
%setup -n %{name}-%{version}

mv README.md README
mv CHANGES ChangeLog
mv LICENSE_1_0.txt COPYING
echo "2017-12-06:" > NEWS
echo "- Version 4.0.0" >> NEWS
echo "- See the ChangeLog file for more details." >> NEWS

%build

# -DCMAKE_INSTALL_PREFIX:PATH=$RPM_BUILD_ROOT
Erwan Croze's avatar
Erwan Croze committed
206
%{expand:%%%cmake_name} . \
Erwan Croze's avatar
Erwan Croze committed
207 208 209
 -DSOCI_TESTS=OFF \
 -DSOCI_EMPTY=OFF \
 -DSOCI_CXX_C11=ON \
Erwan Croze's avatar
Erwan Croze committed
210 211 212 213 214 215 216 217
 -DWITH_EMPTY=%{?_with_empty:ON}%{!?_with_empty:OFF} \
 -DWITH_DB2=%{?_with_db2:ON}%{!?with_db2:OFF} \
 -DWITH_SQLITE3=%{?_with_sqlite3:ON}%{!?with_sqlite3:OFF} \
 -DWITH_POSTGRESQL=%{?_with_postgresql:ON}%{!?with_postgresql:OFF} \
 -DWITH_MYSQL=%{?_with_mysql:ON}%{!?with_mysql:OFF} \
 -DWITH_ODBC=%{?_with_odbc:ON}%{!?with_odbc:OFF} \
 -DWITH_ORACLE=%{?_with_oracle:ON %{?_with_oracle_incdir} %{?_with_oracle_libdir}}%{!?with_oracle:OFF} \
 -DWITH_FIREBIRD=%{?_with_firebird:ON}%{!?with_firebird:OFF}
Erwan Croze's avatar
Erwan Croze committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
make VERBOSE=1 %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
##
#  Remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_includedir}/soci/soci-config.h.in
%{!?_with_empty:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/empty}
%{!?_with_db2:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/db2}
%{!?_with_sqlite3:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/sqlite3}
%{!?_with_postgresql:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/postgresql}
%{!?_with_mysql:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/mysql}
%{!?_with_odbc:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/odbc}
%{!?_with_oracle:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/oracle}
%{!?_with_firebird:rm -rf $RPM_BUILD_ROOT%{_includedir}/soci/firebird}

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
239 240
%{_libdir}/lib%{_lib_name}_core.so.*
%{?_with_empty:%{_libdir}/lib%{_lib_name}_empty.so.*}
Erwan Croze's avatar
Erwan Croze committed
241 242 243 244

%{?_with_sqlite3:%files sqlite3
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
245
%{_libdir}/lib%{_lib_name}_sqlite3.so.*}
Erwan Croze's avatar
Erwan Croze committed
246 247 248 249

%{?_with_mysql:%files mysql
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
250
%{_libdir}/lib%{_lib_name}_mysql.so.*}
Erwan Croze's avatar
Erwan Croze committed
251 252 253 254

%{?_with_postgresql:%files postgresql
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
255
%{_libdir}/lib%{_lib_name}_postgresql.so.*}
Erwan Croze's avatar
Erwan Croze committed
256 257 258 259

%{?_with_odbc:%files odbc
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
260
%{_libdir}/lib%{_lib_name}_odbc.so.*}
Erwan Croze's avatar
Erwan Croze committed
261 262 263 264

%{?_with_oracle:%files oracle
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
265
%{_libdir}/lib%{_lib_name}_oracle.so.*}
Erwan Croze's avatar
Erwan Croze committed
266 267 268 269 270 271


%files devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_prefix}/cmake/*
Erwan Croze's avatar
Erwan Croze committed
272 273 274 275 276
%dir %{_includedir}/%{_lib_name}/
%{_includedir}/%{_lib_name}/*.h
%{?_with_empty:%{_includedir}/%{_lib_name}/empty/}
%{_libdir}/lib%{_lib_name}_core.so
%{?_with_empty:%{_libdir}/lib%{_lib_name}_empty.so}
Erwan Croze's avatar
Erwan Croze committed
277 278 279 280

%{?_with_sqlite3:%files sqlite3-devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
281 282 283
%dir %{_includedir}/%{_lib_name}
%{_includedir}/%{_lib_name}/sqlite3/
%{_libdir}/lib%{_lib_name}_sqlite3.so}
Erwan Croze's avatar
Erwan Croze committed
284 285 286 287

%{?_with_mysql:%files mysql-devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
288 289 290
%dir %{_includedir}/%{_lib_name}
%{_includedir}/%{_lib_name}/mysql
%{_libdir}/lib%{_lib_name}_mysql.so}
Erwan Croze's avatar
Erwan Croze committed
291 292 293 294

%{?_with_postgresql:%files postgresql-devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
295 296 297
%dir %{_includedir}/%{_lib_name}
%{_includedir}/%{_lib_name}/postgresql
%{_libdir}/lib%{_lib_name}_postgresql.so}
Erwan Croze's avatar
Erwan Croze committed
298 299 300 301

%{?_with_odbc:%files odbc-devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
302 303 304
%dir %{_includedir}/%{_lib_name}
%{_includedir}/%{_lib_name}/odbc/
%{_libdir}/lib%{_lib_name}_odbc.so}
Erwan Croze's avatar
Erwan Croze committed
305 306 307 308

%{?_with_oracle:%files oracle-devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
Erwan Croze's avatar
Erwan Croze committed
309 310 311
%dir %{_includedir}/%{_lib_name}
%{_includedir}/%{_lib_name}/oracle
%{_libdir}/lib%{_lib_name}_oracle.so}
Erwan Croze's avatar
Erwan Croze committed
312 313 314 315 316 317 318 319

%files doc
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README docs

%changelog
* Wed Dec 6 2017 erwan.croze <erwan.croze@belledonne.communications.com>
- Initial RPM release.