File firebird.spec of Package firebird
#
# spec file for package firebird (Version 2.1.3.18185.0)
#
# Copyright (c) 2009 SUSE LINUX Products 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/
#
%global pkgname Firebird-2.1.3.18185-0
%global fbroot %{_libdir}/%{name}
%global major 2.1.3
%define libfbclient libfbclient2
%define libfbembed libfbembed2
Summary: SQL relational database management system
Name: firebird
Version: 2.1.3.18185.0
Release: 1
Group: Applications/Databases
License: Interbase
Url: http://www.firebirdsql.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source0: http://downloads.sourceforge.net/firebird/%{pkgname}.tar.bz2
Source0: http://firebirdsql.org/downloads/prerelease/source/%{pkgname}.RC2.tar.bz2
Source3: firebird-logrotate
Source4: README.OpenSuse
Patch0: firebird-mcpu-to-mtune.patch
Patch1: Firebird-edit_fix.diff
Patch2: firebird-gcc-warnings-fixes.patch
Patch3: firebird_lock-file-location.patch
Patch4: firebird-gcc-icu.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: gcc-c++
BuildRequires: libicu-devel
BuildRequires: xinetd
Provides: %{name}-server-common
Obsoletes: %{name}-server-common < %{version}
Requires: %{name}-arch = %{version}
Requires: grep
Requires: sed
PreReq: pwdutils
PreReq: update-alternatives
Requires: %libfbclient
Requires: logrotate
Requires: netcfg
%description
This package contains common files between firebird-classic and
firebird-superserver. You will need this if you want to use either one.
%package doc
License: Interbase
Summary: Documentation for Firebird SQL RDBMS
Group: Applications/Databases
%description doc
This are the Firebird SQL Database shared doc and examples files.
%package filesystem
License: Interbase
Summary: Filesystem for Firebird SQL RDBMS
Group: Applications/Databases
%description filesystem
This is the Firebird SQL Database root file system.
%package devel
License: Interbase
Summary: Development Libraries for Firebird
Group: Development/Databases
Requires: %libfbclient = %{version}
Requires: %libfbembed = %{version}
%description devel
Development libraries for Firebird SQL RDBMS.
%package classic
License: Interbase
Summary: Classic (xinetd) server for Firebird SQL RDBMS
Group: Applications/Databases
Provides: %{name}-arch = %{version}-%{release}
Requires: xinetd
Requires: %{name} = %{version}
Conflicts: %{name}-superserver
Requires: %libfbembed = %{version}
Provides: %{name}-utils-classic
Obsoletes: %{name}-utils-classic < %{version}
Provides: %{name}-server-classic
Obsoletes: %{name}-server-classic < %{version}
PreReq: permissions
PreReq: update-alternatives
%description classic
This is the classic (xinetd) server Firebird SQL RDBMS.
It can also be used as an embedded server, when paired with the
client-embedded package.
%package superserver
License: Interbase
Summary: Superserver server for Firebird SQL RDBMS
Group: Applications/Databases
Provides: %{name}-arch = %{version}-%{release}
Requires: %{name} = %{version}
Conflicts: %{name}-classic
Provides: %{name}-utils-superserver
Obsoletes: %{name}-utils-superserver < %{version}
Provides: %{name}-server-superserver
Obsoletes: %{name}-server-superserver < %{version}
PreReq: update-alternatives
%description superserver
This is the Superserver (single process) Firebird SQL RDBMS.
%package -n libfbclient2
License: Interbase
Summary: Multi-threaded client libraries for Firebird SQL RDBMS
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: %{name}-filesystem
%description -n %libfbclient
Multi-threaded, non-local client libraries for Firebird SQL RDBMS
%package -n libfbembed2
License: Interbase
Summary: Multi-process client libraries for Firebird SQL RDBMS
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: %{name}-filesystem
%description -n %libfbembed
Multi-process, local client libraries for Firebird SQL RDBMS
%prep
%setup -q -n %{pkgname}
# convert intl character to UTF-8
iconv -f ISO-8859-1 -t utf-8 -c ./doc/README.intl -o ./doc/README.intl
# backport patch
%patch1 -p1
%patch0
%patch2
%patch3
%patch4
%build
# <mrl> For reference, the proccess fb_lock_mgr that keeps executing after
# building finish is started at gen/Makefile.codes, line 60 (target
# build_codes) but I can't do nothing for it without major hacking.
# classic
NOCONFIGURE=1 ./autogen.sh
%configure --prefix=%{fbroot} \
--with-system-icu \
--with-system-editline
# Can't use make %{?_smp_mflags} as parallel build is broken
make
cd gen
./install/makeInstallImage.sh
# here we patch a bug in the configure script
mv ./buildroot/ buildroot-classic
chmod 644 ./buildroot-classic%{fbroot}/help/help.fdb
cd ..
# superserver
NOCONFIGURE=1 ./autogen.sh
%configure --prefix=%{fbroot} \
--enable-superserver \
--with-system-icu \
--with-system-editline
# Can't use make %{?_smp_mflags} as parallel build is broken
make
cd gen
./install/makeInstallImage.sh
mv ./buildroot/ buildroot-superserver
chmod 644 ./buildroot-superserver%{fbroot}/help/help.fdb
%install
# we wanted to setup both Classic and Superserver, we need to do all here
cd %{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
mkdir -p %{buildroot}%{_initrddir}
mkdir -p %{buildroot}%{_sysconfdir}/xinetd.d
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
mkdir -p %{buildroot}%{_var}/run/%{name}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/data
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/system
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
mkdir -p %{buildroot}%{_includedir}/%{name}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{fbroot}
mkdir -p %{buildroot}%{fbroot}/help
mkdir -p %{buildroot}%{fbroot}/intl
mkdir -p %{buildroot}%{fbroot}/lib
mkdir -p %{buildroot}%{fbroot}/include
mkdir -p %{buildroot}%{fbroot}/bin-classic
mkdir -p %{buildroot}%{fbroot}/UDF-classic
mkdir -p %{buildroot}%{fbroot}/bin-superserver
mkdir -p %{buildroot}%{fbroot}/UDF-superserver
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/examples/empbuild/employee.fdb %{buildroot}%{_localstatedir}/lib/%{name}/data/employee.fdb
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/help/help.fdb %{buildroot}%{fbroot}/help/help.fdb
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/*.msg %{buildroot}%{fbroot}/
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/intl/fbintl %{buildroot}%{fbroot}/intl/fbintl
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/lib/libib_util.so %{buildroot}%{fbroot}/lib/
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/lib/libfbclient.so.%{major} %{buildroot}%{fbroot}/lib/
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/lib/libfbembed.so.%{major} %{buildroot}%{fbroot}/lib/
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/bin/* %{buildroot}%{fbroot}/bin-classic/
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/UDF/* %{buildroot}%{fbroot}/UDF-classic/
cp %{_builddir}/%{pkgname}/gen/buildroot-superserver%{fbroot}/bin/* %{buildroot}%{fbroot}/bin-superserver/
cp %{_builddir}/%{pkgname}/gen/buildroot-superserver%{fbroot}/UDF/* %{buildroot}%{fbroot}/UDF-superserver/
cd %{buildroot}%{fbroot}/bin-superserver/
ln -s fbmgr.bin fbmgr
cd %{buildroot}
major2=`echo %{major} | sed 's|\.[0-9]*$||'`
major1=`echo ${major2} | sed 's|\.[0-9]*$||'`
cd %{buildroot}%{fbroot}/lib/
ln -s %{fbroot}/lib/libfbembed.so.%{major} libfbembed.so.${major2}
ln -s %{fbroot}/lib/libfbembed.so.${major2} libfbembed.so
ln -s %{fbroot}/lib/libfbclient.so.%{major} libfbclient.so.${major1}
ln -s %{fbroot}/lib/libfbclient.so.${major1} libfbclient.so
cd %{buildroot}
cd %{buildroot}%{_libdir}
ln -s %{fbroot}/lib/libfbembed.so libfbembed.so
ln -s %{fbroot}/lib/libfbembed.so.${major2} libfbembed.so.${major2}
ln -s %{fbroot}/lib/libfbembed.so.%{major} libfbembed.so.%{major}
ln -s %{fbroot}/lib/libfbclient.so libfbclient.so
ln -s %{fbroot}/lib/libfbclient.so.${major1} libfbclient.so.${major1}
ln -s %{fbroot}/lib/libfbclient.so.%{major} libfbclient.so.%{major}
ln -s %{fbroot}/lib/libfbclient.so.%{major} libgds.so.0
ln -s %{fbroot}/lib/libfbclient.so libgds.so
ln -s %{fbroot}/lib/libib_util.so libib_util.so
cd %{buildroot}
touch %{buildroot}%{_localstatedir}/log/%{name}/%{name}.log
ln -sf %{_localstatedir}/log/%{name}/%{name}.log .%{fbroot}/%{name}.log
sed "s@%{name}.log@%{_localstatedir}/log/%{name}/%{name}.log@g" %{SOURCE3} > %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/include/* %{buildroot}%{_includedir}/%{name}/
cd %{buildroot}%{fbroot}/include/
ln -s %{_includedir}/%{name}/ibase.h ibase.h
ln -s %{_includedir}/%{name}/iberror.h iberror.h
ln -s %{_includedir}/%{name}/ib_util.h ib_util.h
ln -s %{_includedir}/%{name}/perf.h perf.h
cd %{buildroot}%{_includedir}
ln -s %{_includedir}/%{name}/ibase.h ibase.h
ln -s %{_includedir}/%{name}/iberror.h iberror.h
ln -s %{_includedir}/%{name}/ib_util.h ib_util.h
ln -s %{_includedir}/%{name}/perf.h perf.h
cd %{buildroot}
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/aliases.conf .%{_sysconfdir}/%{name}/aliases.conf
sed "s@%{fbroot}/examples/empbuild@%{_localstatedir}/lib/%{name}/data@" -i .%{_sysconfdir}/%{name}/aliases.conf
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/firebird.conf .%{_sysconfdir}/%{name}/firebird.conf
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/intl/fbintl.conf .%{_sysconfdir}/%{name}/fbintl.conf
cp %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/security2.fdb .%{_localstatedir}/lib/%{name}/system/security2.fdb
ln -s %{_sysconfdir}/%{name}/aliases.conf .%{fbroot}/aliases.conf
ln -s %{_sysconfdir}/%{name}/firebird.conf .%{fbroot}/firebird.conf
ln -s %{_localstatedir}/lib/%{name}/system/security2.fdb .%{fbroot}/security2.fdb
ln -s %{_sysconfdir}/%{name}/fbintl.conf .%{fbroot}/intl/fbintl.conf
sed "s@= root@= %{name}@" %{_builddir}/%{pkgname}/gen/buildroot-classic%{fbroot}/misc/%{name}.xinetd > %{buildroot}%{_sysconfdir}/xinetd.d/%{name}
cp %{_builddir}/%{pkgname}/gen/buildroot-superserver%{fbroot}/misc/%{name}.init.d.suse %{buildroot}%{_initrddir}/%{name}
ln -sf %{_initrddir}/%{name} %{buildroot}%{_sbindir}/rc%{name}
sed "s@%%{fbroot}@%{fbroot}@g" %{SOURCE4} > %{_builddir}/%{pkgname}/doc/README.OpenSuse
ln -s %{_var}/run/%{name} .%{fbroot}/run
# we need a dummy target for /etc/alternatives/
mkdir -p %{buildroot}/etc/alternatives
touch %{buildroot}/etc/alternatives/%{name}-bin
ln -s /etc/alternatives/%{name}-bin .%{fbroot}/bin
touch %{buildroot}/etc/alternatives/%{name}-UDF
ln -s /etc/alternatives/%{name}-UDF .%{fbroot}/UDF
touch %{buildroot}/etc/alternatives/isql-fb
ln -s /etc/alternatives/isql-fb .%{_bindir}/isql-fb
touch %{buildroot}/etc/alternatives/gbak
ln -s /etc/alternatives/gbak .%{_bindir}/gbak
touch %{buildroot}/etc/alternatives/gfix
ln -s /etc/alternatives/gfix .%{_bindir}/gfix
touch %{buildroot}/etc/alternatives/gsec
ln -s /etc/alternatives/gsec .%{_bindir}/gsec
touch %{buildroot}/etc/alternatives/nbackup
ln -s /etc/alternatives/nbackup .%{_bindir}/nbackup
touch %{buildroot}/etc/alternatives/gstat-fb
ln -s /etc/alternatives/gstat-fb .%{_bindir}/gstat-fb
# -----------------------------------------------------------------------------
%clean
rm -Rf %{buildroot}
# -----------------------------------------------------------------------------
# lib scripts
# -----------------------------------------------------------------------------
# While using -p flag, you can't leave comments until the next tag.
%post -n %libfbclient -p /sbin/ldconfig
%postun -n %libfbclient -p /sbin/ldconfig
%post -n %libfbembed -p /sbin/ldconfig
%postun -n %libfbembed -p /sbin/ldconfig
%post classic
update-alternatives --install %{fbroot}/bin %{name}-classic %{fbroot}/bin-classic 10 \
--slave %{fbroot}/UDF UDF %{fbroot}/UDF-classic \
--slave %{_bindir}/isql-fb isql-fb %{fbroot}bin-classic/isql \
--slave %{_bindir}/gbak gbak %{fbroot}/bin-classic/gbak \
--slave %{_bindir}/gsec gsec %{fbroot}/bin-classic/gsec \
--slave %{_bindir}/gfix gfix %{fbroot}/bin-classic/gfix \
--slave %{_bindir}/nbackup nbackup %{fbroot}/bin-classic/nbackup \
--slave %{_bindir}/gstat-fb gstat-fb %{fbroot}/bin-classic/gstat
%run_permissions
%verifyscript
%verify_permissions -e %{fbroot}/bin-classic/fb_lock_mgr
%preun classic
if [ $1 -eq 0 ]; then
update-alternatives --remove-all %{name}-classic
if /sbin/service xinetd status >& /dev/null; then
/etc/init.d/xinetd try-restart &>/dev/null || :
fi
fi
%post superserver
update-alternatives --install %{fbroot}/bin %{name}-super %{fbroot}/bin-superserver 10 \
--slave %{fbroot}/UDF %{name}-UDF %{fbroot}/UDF-superserver \
--slave %{_bindir}/isql-fb isql-fb %{fbroot}/bin-superserver/isql \
--slave %{_bindir}/gbak gbak %{fbroot}/bin-superserver/gbak \
--slave %{_bindir}/gsec gsec %{fbroot}/bin-superserver/gsec \
--slave %{_bindir}/gfix gfix %{fbroot}/bin-superserver/gfix \
--slave %{_bindir}/nbackup nbackup %{fbroot}/bin-superserver/nbackup \
--slave %{_bindir}/gstat-fb gstat-fb %{fbroot}/bin-superserver/gstat
if [ $1 -eq 1 ]; then
/sbin/chkconfig firebird off
fi
%preun superserver
%stop_on_removal %{name}
if [ $1 -eq 0 ]; then
update-alternatives --remove-all %{name}-super
fi
%postun superserver
%insserv_cleanup
%pre
# Create the firebird group if it doesn't exist
getent group %{name} >/dev/null || /usr/sbin/groupadd -r %{name}
getent passwd %{name} >/dev/null || /usr/sbin/useradd -d / -g %{name} -s /sbin/nologin -r %{name}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(0644,root,root,0755)
%doc doc/license/IDPL.txt
%doc doc/license/README.license.usage.txt
%doc doc/README.OpenSuse
%ghost /etc/alternatives/%{name}-bin
%ghost /etc/alternatives/%{name}-UDF
%ghost /etc/alternatives/isql-fb
%ghost /etc/alternatives/gbak
%ghost /etc/alternatives/gsec
%ghost /etc/alternatives/gfix
%ghost /etc/alternatives/nbackup
%ghost /etc/alternatives/gstat-fb
%defattr(0644,root,root,0755)
%dir %attr(0755,root,root) %{_localstatedir}/lib/%{name}
%dir %attr(0770,%{name},%{name}) %{_localstatedir}/lib/%{name}/data
%attr(0660,%{name},%{name}) %{_localstatedir}/lib/%{name}/data/employee.fdb
%dir %attr(0775,%{name},%{name}) %{_localstatedir}/log/%{name}
%ghost %attr(0664,%{name},%{name}) %{_localstatedir}/log/%{name}/%{name}.log
%{fbroot}/%{name}.log
%dir %{fbroot}/intl
%{fbroot}/UDF
%{fbroot}/bin
%dir %{_sysconfdir}/%{name}
%dir %attr(0770,%{name},%{name}) %{_localstatedir}/lib/%{name}/system
%config(noreplace) %attr (0600,%{name},%{name}) %{_localstatedir}/lib/%{name}/system/security2.fdb
%{fbroot}/security2.fdb
%config(noreplace) %attr (0664,%{name},%{name}) %{_sysconfdir}/%{name}/fbintl.conf
%config(noreplace) %attr (0664,%{name},%{name}) %{_sysconfdir}/%{name}/aliases.conf
%config(noreplace) %attr (0664,%{name},%{name}) %{_sysconfdir}/%{name}/firebird.conf
%{fbroot}/aliases.conf
%{fbroot}/firebird.conf
%{fbroot}/intl/fbintl.conf
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
%{fbroot}/*.msg
%{fbroot}/help
%{_libdir}/libib_util.so
%{fbroot}/lib/libib_util.so
%defattr(0644,root,root,0644)
%defattr(0755,root,root,0750)
%{fbroot}/intl/fbintl
%defattr(0755,root,root,0755)
%{_bindir}/isql-fb
%{_bindir}/gbak
%{_bindir}/gsec
%{_bindir}/gfix
%{_bindir}/nbackup
%{_bindir}/gstat-fb
%dir %attr(0775,%{name},%{name}) %{_var}/run/%{name}
%defattr(0755,root,root,0755)
%{fbroot}/run
%files filesystem
%defattr(0644,root,root,0755)
%doc doc/README.OpenSuse
%defattr(0755,root,root,0755)
%dir %{fbroot}
%dir %{fbroot}/lib
%files doc
%defattr(0644,root,root,0755)
%doc gen/buildroot-classic%{fbroot}/doc
%doc gen/buildroot-classic%{fbroot}/examples
%doc gen/buildroot-classic%{fbroot}/README
%doc gen/buildroot-classic%{fbroot}/misc/intl.sql
%doc gen/buildroot-classic%{fbroot}/misc/upgrade
%files devel
%defattr(0644,root,root,0755)
%dir %{fbroot}/include
%{fbroot}/include/*
%{fbroot}/lib/*.so
%{_includedir}/*
%{_libdir}/*.so
%files -n %libfbclient
%defattr(0644,root,root,0755)
%doc doc/license/IDPL.txt
%doc doc/license/README.license.usage.txt
%{_libdir}/libfbclient.so.*
%{_libdir}/libgds.so.0
%{fbroot}/lib/libfbclient.so.*
%files -n %libfbembed
%defattr(0644,root,root,0755)
%doc doc/license/IDPL.txt
%doc doc/license/README.license.usage.txt
%{_libdir}/libfbembed.so.*
%{fbroot}/lib/libfbembed.so.*
%files classic
%defattr(0644,root,root,0755)
%doc doc/license/IDPL.txt
%doc doc/license/README.license.usage.txt
%config(noreplace) %{_sysconfdir}/xinetd.d/%{name}
%dir %{fbroot}/bin-classic
%dir %{fbroot}/UDF-classic
%defattr(0755,root,root,0755)
%{fbroot}/bin-classic/c*
%{fbroot}/bin-classic/g*
%{fbroot}/bin-classic/i*
%{fbroot}/bin-classic/n*
%{fbroot}/bin-classic/q*
%{fbroot}/bin-classic/r*
%{fbroot}/bin-classic/fb_config
%{fbroot}/bin-classic/fb_inet_server
%{fbroot}/bin-classic/fb_lock_print
%{fbroot}/bin-classic/fbsvcmgr
%verify(not mode) %attr(0550,root,%{name}) %{fbroot}/bin-classic/fb_lock_mgr
%{fbroot}/UDF-classic/*.so
%defattr(0644,root,root,0755)
%{fbroot}/UDF-classic/*.sql
%files superserver
%defattr(0644,root,root,0755)
%doc doc/license/IDPL.txt
%doc doc/license/README.license.usage.txt
%defattr(0644,root,root,0755)
%dir %{fbroot}/bin-superserver
%dir %{fbroot}/UDF-superserver
%defattr(0755,root,root,0755)
%{_initrddir}/%{name}
%{_sbindir}/rc%{name}
%{fbroot}/bin-superserver/*
%{fbroot}/UDF-superserver/*.so
%defattr(0644,root,root,0755)
%{fbroot}/UDF-superserver/*.sql
%changelog