File firebird.spec of Package firebird

#
# spec file for package firebird
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define upversion 2.5.6.27020
%define pkgversion Firebird-%{upversion}-0

%if 0%{?suse_version} < 1130
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif

Name:           firebird
Version:        %{upversion}
Release:        0
Source:         %{pkgversion}.tar.xz
Source1:        README.SUSE
Source99:       baselibs.conf
Url:            http://www.firebirdsql.org/
BuildRequires:  gcc-c++
BuildRequires:  libedit-devel
BuildRequires:  libicu-devel
BuildRequires:  libtool
BuildRequires:  ncurses-devel
BuildRequires:  pkg-config
BuildRequires:  xz
%ifnarch %{ix86} x86_64
BuildRequires:  libatomic-ops-devel
%endif
Requires(pre):  pwdutils
Requires:       %{name}-server = %{version}
Summary:        An SQL database server
License:        SUSE-IDPL-1.0 and SUSE-IBPL-1.0
Group:          Productivity/Databases/Servers

# SUSE specific patches
Patch1:         allow-creating-buildRoot-as-non-root-user.patch
Patch2:         fbguard-allow-creating-a-guard-pidfile.patch
Patch3:         use-killproc-in-stop-branch-of-SuSE-init-script.patch
Patch4:         disable-xinetd-service-by-default.patch
Patch5:         do-not-use-DatabaseAccess-Full-in-default-config.patch
Patch6:         add-pkgconfig-files.patch
# backport from upstream 3.0 branch
Patch21:        Fixed-CORE-3431-ISQL-pads-UTF-8-data-incorrectly.patch
Patch22:        isql-fix-output-if-charset-is-different-from-locale.patch
Patch23:        isql-fix-buffer-overflow-when-set-width-sets-bigger-.patch
# SUSE only, 2.5 only
Patch31:        add-experimental-support-for-m68k-architecture.patch
# bug fixes
Patch41:        Backported-fix-for-CORE-5474-Restrict-UDF-is-not-eff.patch

%description
Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%prep
%setup -q -n %{pkgversion}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch31 -p1
%patch41 -p1

%build
rm -vf builds/make.new/config/config.{guess,sub}
./autogen.sh --prefix=%{_prefix} \
  --enable-superserver \
  --with-system-icu --with-system-editline \
  --with-fbbin=%{_bindir} --with-fbsbin=%{_sbindir} \
  --with-fbconf=%{_sysconfdir}/%{name} \
  --with-fblib=%{_libdir} --with-fbinclude=%{_includedir}/%{name} \
  --with-fbdoc=%{_docdir}/%{name} \
  --with-fbudf=%{_libdir}/%{name}/udf \
  --with-fbsample=%{_docdir}/%{name}/sample \
  --with-fbsample-db=%{_libdir}/%{name}/sample \
  --with-fbhelp=%{_libdir}/%{name}/lib \
  --with-fbintl=%{_libdir}/%{name}/intl \
  --with-fbmisc=%{_datadir}/%{name}/misc \
  --with-fbsecure-db=%{_localstatedir}/lib/%{name}/secdb \
  --with-fbmsg=%{_libdir}/%{name}/lib \
  --with-fblog=%{_localstatedir}/log/%{name} \
  --with-fbglock=%{_localstatedir}/run/%{name} \
  --with-fbplugins=%{_libdir}/%{name}/plugins
make %{?jobs:CPU=%jobs}
cd gen
make -f Makefile.install buildRoot
chmod -R u+w buildroot%{_docdir}/%{name}

%install
cp -r gen/buildroot/* ${RPM_BUILD_ROOT}/
mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
install -m 755 gen/install/misc/firebird.init.d.suse \
  ${RPM_BUILD_ROOT}/etc/init.d/firebird
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig
cp -v gen/install/misc/*.pc ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig/
cd ${RPM_BUILD_ROOT}
mkdir -p .%{_libdir}/%{name}/utils
mv -v .%{_sbindir}/*.sh .%{_libdir}/%{name}/utils/
mv -v .%{_sbindir}/fb_config .%{_libdir}/%{name}/utils/
mv -v .%{_bindir}/isql .%{_bindir}/isql-fb
mv -v .%{_bindir}/gstat .%{_bindir}/gstat-fb
rm -vf .%{_includedir}/%{name}/perf.h
rm -vf .%{_libdir}/libicu*.so
rm -vf .%{_includedir}/*.h
chmod -R u+w .%{_docdir}/%{name}
rm -vf .%{_datadir}/%{name}/misc/firebird.init.*
rm -vf .%{_datadir}/%{name}/misc/rc.config.firebird
rm -vf .%{_datadir}/%{name}/misc/firebird.xinetd
mv -v .%{_sysconfdir}/%{name}/README .%{_sysconfdir}/%{name}/WhatsNew \
  .%{_docdir}/%{name}/
mv -v .%{_sysconfdir}/%{name}/IDPLicense.txt .%{_docdir}/%{name}/
mv -v .%{_sysconfdir}/%{name}/IPLicense.txt .%{_docdir}/%{name}/
cp -v %{S:1} .%{_docdir}/%{name}/
mkdir -p srv/%{name}
ln -s /etc/init.d/firebird usr/sbin/rcfirebird

%files
%defattr(-,root,root)
%{_sbindir}/fbguard
%{_sbindir}/rcfirebird
%{_libdir}/%{name}/utils
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*.conf
%{_libdir}/libib_util.so
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name}
%{_libdir}/%{name}/lib
%{_libdir}/%{name}/intl
%{_datadir}/%{name}/misc
%{_libdir}/%{name}/plugins
%{_libdir}/%{name}/udf
%attr(755,root,root) /etc/init.d/firebird
%{_docdir}/%{name}/IDPLicense.txt
%{_docdir}/%{name}/IPLicense.txt
%{_docdir}/%{name}/README.SUSE

%dir %{_localstatedir}/lib/%{name}
%dir %{_localstatedir}/lib/%{name}/secdb
%attr(0600,firebird,firebird) %config(noreplace) %{_localstatedir}/lib/%{name}/secdb/security2.fdb
%dir %{_libdir}/%{name}/sample
%attr(0600,firebird,firebird) %{_libdir}/%{name}/sample/*
%attr(0750,firebird,firebird) %{_localstatedir}/log/%{name}
%dir %attr(0750,firebird,firebird) /srv/firebird

%pre
getent group firebird >/dev/null || groupadd -r firebird || :
getent passwd firebird >/dev/null \
  || /usr/sbin/useradd -r -g firebird -c 'Firebird SQL server' \
       -d /srv/firebird firebird \
  || :
exit 0

%post
%restart_on_update

%preun
%stop_on_removal

%postun
%restart_on_update
%insserv_cleanup

# ----------------------------------------------------------------------------

%package superserver
Conflicts:      %{name}-classic
Requires:       %{name} = %{version}
Provides:       %{name}-server
Summary:        SuperServer architecture binaries for Firebird SQL server
Group:          Productivity/Databases/Servers

%description superserver
SuperServer architecture binaries for Firebird SQL server. SuperServer
architecture uses one multithreaded process for processing client
connections with exclusive database lock and cache shared between
connections.

Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%files superserver
%defattr(-,root,root)
%{_bindir}/*
%{_sbindir}/fbserver
%{_sbindir}/fbmgr.bin
%{_sbindir}/fb_lock_print

# ----------------------------------------------------------------------------

%package devel
Summary:        UDF support library for Firebird SQL server
Group:          Development/Libraries/C and C++

%description devel
This package is needed for development of client applications and user
defined functions (UDF) for Firebird SQL server.

Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%files devel
%defattr(-,root,root)
%{_includedir}/%{name}
%{_docdir}/%{name}/sample

# ----------------------------------------------------------------------------

%package doc
Requires:       %{name} = %{version}
Summary:        Documentation for Firebird SQL server
Group:          Documentation/Other
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%endif

%description doc
Documentation for Firebird SQL server.

Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%files doc
%defattr(-,root,root)
%{_docdir}/%{name}
%exclude %{_docdir}/%{name}/sample
%exclude %{_docdir}/%{name}/IDPLicense.txt
%exclude %{_docdir}/%{name}/IPLicense.txt
%exclude %{_docdir}/%{name}/README.SUSE

# ----------------------------------------------------------------------------

%package -n libfbclient2
Summary:        Firebird SQL server client library
Group:          Development/Libraries/C and C++

%description -n libfbclient2
Shared client library for Firebird SQL server.

Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%files -n libfbclient2
%defattr(-,root,root)
%{_libdir}/libfbclient.so.*

%post -n libfbclient2
/sbin/ldconfig

%postun -n libfbclient2
/sbin/ldconfig

# ----------------------------------------------------------------------------

%package -n libfbclient2-devel
Summary:        Development libraries and headers for Firebird SQL server
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel
Requires:       libfbclient2 = %{version}

%description -n libfbclient2-devel
Development files for Firebird SQL server client library.
 
Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, and a variety of Unix platforms.
Firebird offers excellent concurrency, high performance, and powerful
language support for stored procedures and triggers. It has been used
in production systems, under a variety of names, since 1981.


%files -n libfbclient2-devel
%defattr(-,root,root)
%{_libdir}/libfbclient.so
%{_libdir}/pkgconfig/fbclient.pc

%changelog
openSUSE Build Service is sponsored by