File DLS.spec of Package DLS

# This file is part of the Data Logging Service (DLS).
# DLS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
# DLS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along
# with DLS. If not, see <>.
# vim: tw=78 spelllang=en

Name: dls
Version: 0 # set by set_version service
Release: 1

%define libver 6
%define data_dir /var/dls_data

%if 0%{?suse_version} >= 1210
%bcond_without systemd
%bcond_with systemd

Summary: Data Logging Service
License: GPL-3.0-or-later
Vendor: Ingenieurgemeinschaft IgH GmbH
Group: Productivity/Scientific/Other
Source0: %{name}-%{version}.tar.bz2
Source1: dls-rpmlintrc
PreReq: permissions
BuildRoot: %_tmppath/%name-%{version}-root

Requires(pre): shadow
Requires(post): %fillup_prereq
%if %{without systemd}
Requires(post): %insserv_prereq
Requires: cron
Requires: desktop-file-utils

BuildRequires: fftw3-devel
BuildRequires: fltk-devel
BuildRequires: fontconfig-devel
BuildRequires: gcc-c++
BuildRequires: libXext-devel
BuildRequires: libXft-devel
BuildRequires: libXinerama-devel
BuildRequires: libfltk1
BuildRequires: xorg-x11-proto-devel
BuildRequires: shared-mime-info
BuildRequires: desktop-file-utils
BuildRequires: liburiparser-devel
BuildRequires: libpdcom1-devel
BuildRequires: protobuf-devel
BuildRequires: libxml2-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pcre-devel
BuildRequires: mercurial

%if 0%{?suse_version} == 1310
BuildRequires: libqt5-qtbase-devel
BuildRequires: libqt5-qtbase-common-devel
BuildRequires: libQt5Core-devel
BuildRequires: libQt5Network-devel
BuildRequires: libQt5Widgets-devel
BuildRequires: libqt5-qtsvg-devel
BuildRequires: libQt5Test-devel
BuildRequires: libQt5Svg-devel
BuildRequires: libqt5-qttools-devel
BuildRequires: libQt5PrintSupport-devel

%if %{with systemd}
BuildRequires: systemd-rpm-macros

%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates

DLS is a process data logging service, capable of capturing high-frequency
data over a long time and storing it in a compressed way. The aim is to allow
the user unlimited high-performance access to the data at any time. Be it a
year's overview or a small signal peak in fractions of a second.

%package -n dls-devel
Summary:        Development files for data logging service
Summary(de):    Entwickungsdateien für den DLS
Group:          Development/Libraries/C and C++
Requires:       %name = %version
Requires:       fftw3-devel
Requires:       zlib-devel

%description -n dls-devel
The %name-devel package contains the static libraries and header files
needed for development with %name.

%setup -n %{name}-%{version}
hg log --branch default --style=changelog > ChangeLog

make %{?_smp_mflags}
cd widgets
qmake-qt5 PREFIX=%{_prefix} LIBDIR=%{_libdir}
make %{?_smp_mflags}
cd ..
cd gui
qmake-qt5 PREFIX=%{_prefix}
make %{?_smp_mflags}
cd ..

make DESTDIR=${RPM_BUILD_ROOT} install

# apply settings to sysconfig file
sed -i s:#DLS_DIR=/vol/dls_data:DLS_DIR=%{data_dir}: \
sed -i s:#DLS_USER=dls:DLS_USER=dls: \

%if "%{_vendor}" == "suse"
    install -d ${RPM_BUILD_ROOT}%{_sbindir}
    install -d ${RPM_BUILD_ROOT}%{_fillupdir}
    mv ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/dls \

%if %{with systemd}
    install -D -m 644 script/dls.service %{buildroot}%{_unitdir}/dls.service
    rm  ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/dls
    %if "%{_vendor}" == "suse"
        ln -s service ${RPM_BUILD_ROOT}%{_sbindir}/rcdls
    %if "%{_vendor}" == "suse"
        ln -s %{_sysconfdir}/init.d/dls ${RPM_BUILD_ROOT}%{_sbindir}/rcdls

# install cron file for quota service
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.d
cat <<'EOF' > ${RPM_BUILD_ROOT}%{_sysconfdir}/cron.d/dls_quota
54 02 * * * dls test -x $DOQUOTA && $DOQUOTA -i 0 -d %{data_dir}

cd widgets
cd ..
cd gui
cd ..

%{__rm} -rf $RPM_BUILD_ROOT

%verify_permissions -e /usr/bin/dls_ctl
%verify_permissions -e /usr/bin/dls_view
%verify_permissions -e /usr/bin/dlsgui
%verify_permissions -e /etc/cron.d/

%if %{with systemd}
%service_add_pre dls.service
getent group dls >/dev/null || groupadd -r dls
getent passwd dls >/dev/null || useradd -r -g dls -d %{data_dir} \
    -s /sbin/nologin -c "DLS user" dls
exit 0

%if %{with systemd}
%{fillup_only dls}
%service_add_post dls.service
%{fillup_and_insserv dls}
%set_permissions /usr/bin/dls_ctl
%set_permissions /usr/bin/dls_view
%set_permissions /usr/bin/dlsgui
%set_permissions /etc/cron.d/
if ! test -d %{data_dir}; then
    mkdir -p %{data_dir}
    mkdir %{data_dir}/spool
    echo 100 > %{data_dir}/id_sequence
    chown -R dls:dls %{data_dir}
/usr/bin/update-mime-database /usr/share/mime
touch /usr/share/icons/hicolor

%if %{with systemd}
%service_del_preun dls.service

%if %{with systemd}
%service_del_postun dls.service
/usr/bin/update-mime-database /usr/share/mime
touch /usr/share/icons/hicolor

%config %{_sysconfdir}/profile.d/
%dir %{_sysconfdir}/cron.d
%config %{_sysconfdir}/cron.d/dls_quota
%if "%{_vendor}" == "suse"
%if %{with systemd}
%if "%{_vendor}" == "suse"

%files -n dls-devel
%dir %{_includedir}/DlsWidgets
%dir %{_includedir}/LibDLS

* Tue Mar 27 2018
- Fixed cron file variables.
* Mon Mar 26 2018
- Removed package_version (set by set_version sevice)
- Add user, data directory and cronjob
* Tue Jan 8 2013
- Added some BuildRequires
* Thu Jan 26 2012
- Used macro dirs
- Added .desktop files
* Mon Jan 23 2012
- Improved Url, BuildRoot, Source, BuildRequires.
openSUSE Build Service is sponsored by