File kivitendo-erp.spec of Package kivitendo-erp
#
# spec file for package kivitendo-erp
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2023 WICH, Deidesheim, DE
#
# 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 https://bugs.opensuse.org/
#
Name: kivitendo-erp
%define old_sname lx-erp
%define pname %{name}-release
%define apxs %{_sbindir}/apxs2
%define ap_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define ap_serverroot %(%{apxs} -q PREFIX)
%if 0%{?suse_version}
%define sdir /srv
%define ap_docroot %(%{apxs} -q PREFIX)/htdocs
%define ap_usr wwwrun
%define ap_grp www
%else
%define sdir /srv
%define ap_docroot %(%{apxs} -q PREFIX)/html
%define ap_usr apache
%define ap_grp www
%endif
%define kivitendo_docroot %{ap_serverroot}/%{name}
Summary: Eine ausgereifte Warenwirtschafts- und Finanzbuchhaltungssoftware
License: GPL-2.0-or-later
Group: Productivity/Office/Finance
Version: 3.8.0
Release: 0
URL: http://www.kivitendo.de
Source0: https://github.com/kivitendo/%{name}/archive/release-%{version}/%{pname}-%{version}.tar.gz
Source1: %{name}-install.sh
Source2: %{name}.http
Source11: %{name}-taskd.init
Source12: %{name}-taskd.service
Source13: %{name}-taskd.tmpfile
Source100: rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: apache2-devel
BuildRequires: sed
%if 0%{?suse_version} >= 1100
BuildRequires: fdupes
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
Requires: apache2
Requires: ghostscript-library
Requires: html2ps
Requires: perl(Algorithm::CheckDigits)
Requires: perl(Archive::Zip) >= 1.40
Requires: perl(CAM::PDF)
Requires: perl(CGI) >= 3.43
#Requires: perl(CGI::Ajax)
#Requires: perl(Class::Accessor)
Requires: perl(Clone)
Requires: perl(Config::Std)
Requires: perl(DBD::Pg) >= 1.49
Requires: perl(DBI) >= 1.50
Requires: perl(Daemon::Generic) >= 0.71
Requires: perl(DateTime)
Requires: perl(DateTime::Event::Cron) >= 0.08
Requires: perl(DateTime::Format::Strptime)
Requires: perl(DateTime::Set) >= 0.12
#Requires: perl(Data::Dumper)
Requires: perl(Digest::SHA)
Requires: perl(Email::Address) >= 1.888
Requires: perl(Email::MIME)
Requires: perl(Exception::Class) >= 1.44
#Requires: perl(Exception::Lite)
Requires: perl(FCGI) >= 0.72
Requires: perl(File::Copy::Recursive)
Requires: perl(File::Flock) >= 2008.01
Requires: perl(File::MimeInfo)
# needed by SLES 11 SP3 (perl 5.10.0 -> File::Path 2.04)
#Requires: perl(File::Path) >= 2.07
Requires: perl(File::Slurp)
Requires: perl(GD)
Requires: perl(HTML::Parser)
Requires: perl(HTML::Restrict)
#Requires: perl(IO::Stringy)
Requires: perl(IPC::Run)
Requires: perl(Image::Info)
Requires: perl(Imager)
Requires: perl(Imager::QRCode)
Requires: perl(JSON)
# sub dependency by DateTime
#Requires: perl(List::MoreUtils)
Requires: perl(List::UtilsBy) >= 0.09
# needed for WebshopAPI
Requires: perl(LWP::Authen::Digest)
Requires: perl(LWP::UserAgent)
#
Requires: perl(Math::Round)
Requires: perl(PBKDF2::Tiny) >= 0.005
Requires: perl(PDF::API2) >= 2.000
Requires: perl(Params::Validate)
Requires: perl(REST::Client)
Requires: perl(Regexp::IPv6) >= 0.03
Requires: perl(Rose::DB)
Requires: perl(Rose::DB::Object) >= 0.788
Requires: perl(Rose::Object)
#Requires: perl(Set::Crontab)
Requires: perl(Set::Infinite)
Requires: perl(Sort::Naturally)
Requires: perl(String::ShellQuote) >= 1.01
# Template::Toolkit
Requires: perl(Template) >= 2.18
#Requires: perl(Test::Harness) >= 3.00
Requires: perl(Text::CSV_XS) >= 0.23
Requires: perl(Text::Iconv) >= 1.2
Requires: perl(Text::Unidecode)
Requires: perl(Try::Tiny)
Requires: perl(URI) >= 1.35
Requires: perl(XML::LibXML)
Requires: perl(XML::Writer) >= 0.602
Requires: perl(YAML) >= 0.62
Requires: perl(parent)
Requires: perl(version) >= 0.77
# pdfinfo
Requires: poppler-tools
#
Requires: postgresql-contrib
Requires: postgresql-server >= 10
# needed for printing
Requires: texlive-collection-langenglish
Requires: texlive-collection-langgerman
Requires: texlive-collection-latex
Requires: texlive-collection-latexextra
Requires: texlive-collection-latexrecommended
Requires: texlive-colortbl
Requires: texlive-eurosym
Requires: texlive-filecontents
Requires: texlive-fltpoint
Requires: texlive-german
Requires: texlive-lastpage
Requires: texlive-latex
#Requires: texlive-ngerman
Requires: texlive-numprint
Requires: texlive-substr
Requires: texlive-ulem
Requires: texlive-wallpaper
#Requires: texlive-watermark
Requires: texlive-xifthen
Requires: texlive-xstring
#Requires: texlive-xy
#
# Während die Erzeugung von reinen OpenDocument-Dateien keinerlei
# weitere Software benötigt, wird zur Umwandlung dieser Dateien in PDF
# LibreOffice oder OpenOffice benötigt. Soll dieses Feature genutzt
# werden, so muss neben LibreOffice oder OpenOffice auch der
# “X virtual frame buffer” (xvfb) installiert werden.
Recommends: libreoffice
Recommends: xorg-x11-server
# Zusätzlich gibt es zwei verschiedene Arten, wie kivitendo mit
# LibreOffice bzw. OpenOffice kommuniziert. Die erste Variante, die
# benutzt wird, wenn die Variable $openofficeorg_daemon gesetzt ist,
# startet ein LibreOffice oder OpenOffice, das auch nach der Umwandlung
# des Dokumentes gestartet bleibt. Bei weiteren Umwandlungen wird dann
# diese laufende Instanz benutzt. Der Vorteil ist, dass die Zeit zur
# Umwandlung deutlich reduziert wird, weil nicht für jedes Dokument
# ein LibreOffice bzw. OpenOffice gestartet werden muss. Der Nachteil
# ist, dass diese Methode Python und die Python-UNO-Bindings benötigt,
# die Bestandteil von LibreOffice bzw. OpenOffice sind.
Recommends: python
### optional packages (scripts/installation_check.pl -o)
Recommends: perl(IO::Socket::SSL)
Recommends: perl(Net::LDAP)
Recommends: perl(Net::SMTP::SSL)
Recommends: perl(Net::SSLGlue)
Recommends: perl(YAML::XS)
### needed for access via FCGI
Recommends: apache2-mod_fcgid
%description
kivitendo (ehemals Lx-Office) ist eine webbasierte Anwendung für
Kundenadressen, Produkte, Lagerverwaltung, Angebotswesen und
kaufmännischer Finanzbuchhaltung. Sie können damit sowohl im Intra-
als auch im Internet Ihre Büroarbeiten erledigen. Als Open
Source-Lösung ist es die erste Wahl, wenn spezielle Formulare,
Dokumente, Aufgaben oder Funktionen ergänzt werden sollen, mit denen
Sie Ihre individuellen Anforderungen erfüllen möchten. Das kann in
Eigenleistung oder durch Dienstleister geschehen.
http://kivitendo.de/information/leistungsumfang.html
Anmerkung:
Nach der Installation:
http://ip-adresse-server/kivitendo-erp/admin.pl aufrufen und eine
Datenbank sowie Benutzer anlegen.
%package devel
# ./scripts/installation_check.pl -d
Summary: Installs needed perl Modules
Group: Development/Languages/Perl
Requires: %{name} = %{version}
Requires: perl(DBIx::Log4perl)
Requires: perl(Devel::REPL)
Requires: perl(GD) >= 2.00
Requires: perl(LWP::Simple)
Requires: perl(Log::Log4perl)
Requires: perl(Moose::Role)
Requires: perl(Rose::DB::Object) >= 0.809
Requires: perl(Sys::CPU)
Requires: perl(Term::ReadLine::Gnu)
Requires: perl(Test::Deep)
Requires: perl(Test::Exception)
Requires: perl(Test::Output)
Requires: perl(Thread::Pool::Simple)
Requires: perl(URI::Find)
### Latex already needed for printing
#Requires: perl(LaTeX kpsewhich
%description devel
This package installs all needed perl Modules for developing @kivitendo
%prep
%setup -q -n %{pname}-%{version}
# remove delivered modules
# so kivitendo-erp is not provider for YAML and others .....
%{__rm} -rf modules/fallback/parent.pm
%{__rm} -rf modules/fallback/List
%{__rm} -rf modules/override/YAML*
# suse-filelist-forbidden (Badness: 10000):
%{__rm} -f doc/changelog.orig
## rpmlint
# wrong-file-end-of-line-encoding
%{__perl} -p -i -e 's|\r\n|\n|' doc/build/custom-cfg/*
%{__perl} -p -i -e 's|\r\n|\n|' doc/html/style.css
%{__perl} -p -i -e 's|\r\n|\n|' doc/modules/LICENSE.dhtmlsuite-for-applications
# script-without-shebang
%{__chmod} 0644 bin/mozilla/sepa.pl
%{__chmod} 0644 js/jquery/jquery.contextMenu.js
%{__chmod} 0644 modules/override/PDF/Table.pm
%{__chmod} 0644 SL/DB/Object.pm
%{__chmod} 0644 scripts/make_icons.sh
%{__chmod} 0644 templates/webpages/delivery_term/form.html
%{__chmod} 0644 templates/webpages/payment_term/form.html
%build
%install
# install all web-pages in htdocs
%{__install} -d -m 0750 %{buildroot}%{kivitendo_docroot}
%{__cp} -a * %{buildroot}%{kivitendo_docroot}
# add missing webdav DIR
%{__install} -d %{buildroot}%{kivitendo_docroot}/webdav
# correct OpenOffice-directory SuSE uses ooo-2.0
%{__mv} %{buildroot}%{kivitendo_docroot}/users/.openoffice.org2 \
%{buildroot}%{kivitendo_docroot}/users/.ooo-2.0
# apache2 configuration
%{__install} -D -m 0644 %{S:2} %{buildroot}%{ap_sysconfdir}/conf.d/%{name}.conf
# fix paths in http config
%{__sed} -i -e "s,@name@,%{name},g" -e "s,@kivitendo_docroot@,%{kivitendo_docroot},g" \
%{buildroot}%{ap_sysconfdir}/conf.d/%{name}.conf
# script to add need functions to template1
%{__cat} > %{name}-create-function.sql <<EOF
create function plpgsql_call_handler () returns opaque as '%{_libdir}/postgresql/plpgsql.so' language 'c';
create language 'plpgsql' handler plpgsql_call_handler lancompiler 'pl/pgsql';
EOF
# install script
%{__install} -D -m 0755 %{S:1} %{buildroot}%{_bindir}/%{name}-install.sh
# fix vars
%{__sed} -i -e "s,@docdir@,%{_docdir},g" -e "s,@name@,%{name},g" \
%{buildroot}%{_bindir}/%{name}-install.sh
# remove not needed files and perl Modules
for i in changelog COPYING copyright kivitendo-erp-create-function.sql modules release_management.txt UPGRADE; do
%{__rm} -rf %{buildroot}%{kivitendo_docroot}/doc/$i
done
%{__rm} -rf %{buildroot}%{kivitendo_docroot}/modules/fallback
for i in .htaccess .gitignore; do
find %{buildroot}%{kivitendo_docroot}/ -name "${i}" -exec %{__rm} -f {} \;
done
# systemd vs SysVinit
%{__install} -d %{buildroot}%{_sbindir}
%{__ln_s} -f %{kivitendo_docroot}/scripts/task_server.pl %{buildroot}%{_sbindir}/%{name}-taskd
%if 0%{?has_systemd}
%{__install} -D -m 0644 %{S:12} %{buildroot}%{_unitdir}/%{name}-taskd.service
%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-taskd
# systemd need to create a tmp dir: /run/kivitendo-erp
%{__install} -D -m 0644 %{S:13} %{buildroot}%{_tmpfilesdir}/%{name}-taskd.conf
%{__sed} -i -e "s,@ap_usr@,%{ap_usr},g" -e "s,@kivitendo_docroot@,%{kivitendo_docroot},g" \
%{buildroot}%{_unitdir}/%{name}-taskd.service
%{__sed} -i -e "s,@ap_usr@,%{ap_usr},g" \
%{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}-taskd.conf
%else
%{__install} -D -m 0755 %{S:11} %{buildroot}%{_sysconfdir}/init.d/%{name}-taskd
%{__ln_s} -f %{_sysconfdir}/init.d/%{name}-taskd %{buildroot}%{_sbindir}/rc%{name}-taskd
%{__sed} -i -e "s,@ap_usr@,%{ap_usr},g" -e "s,@name@,%{name},g" \
%{buildroot}%{_sysconfdir}/init.d/%{name}-taskd
%endif
### rpmlint
# fix shebang
for i in `find %{buildroot}%{kivitendo_docroot}/ -type f -name "*.pl"`; do
%{__perl} -p -i -e 's|/usr/local/bin/perl|/usr/bin/perl|g' $i
done
# files-duplicated-waste
%fdupes -s %{buildroot}%{kivitendo_docroot}/doc
%fdupes -s %{buildroot}%{kivitendo_docroot}/image
%fdupes -s %{buildroot}%{kivitendo_docroot}/js
%fdupes -s %{buildroot}%{kivitendo_docroot}/users
%clean
%{__rm} -rf %{buildroot}
%pre
# update?
### are we on update from lx-office to kivitendo ?
if [ ${1:-0} -gt 1 ]; then
[ -d %{sdir}/%{old_sname} ] && {
%{__cp} -a %{sdir}/%{old_sname} %{kivitendo_docroot}
} || :
fi
# fix templates/print/Standard >= 3.3.0
if test -f %{kivitendo_docroot}/templates/print/Standard; then
if [[ ! -L %{kivitendo_docroot}/templates/print/Standard ]]; then
mv %{kivitendo_docroot}/templates/print/Standard \
%{kivitendo_docroot}/templates/print/_old_Standard
fi
fi
# check for kivitendo_docroot
if [ -d %{ap_docroot}/%{name} -a ! -d %{kivitendo_docroot} ]; then
%{__mv} %{ap_docroot}/%{name} %{sdir}
fi
## some important changes since 2.6.3
# obsolete with >= 2.6.3
[ -f %{kivitendo_docroot}/config/kivitendo.conf ] && {
%{__cp} -a %{kivitendo_docroot}/config/kivitendo.conf \
%{kivitendo_docroot}/config/kivitendo.conf.sic
} || :
%if 0%{?has_systemd}
%service_add_pre %{name}-taskd.service
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}-taskd.service
%else
%stop_on_removal %{name}-taskd
%endif
%post
# some important changes since 2.6.3
if [ ! -f %{kivitendo_docroot}/config/kivitendo.conf ]; then
%{__cp} -a %{kivitendo_docroot}/config/kivitendo.conf.default \
%{kivitendo_docroot}/config/kivitendo.conf
fi
if [ -x /usr/sbin/a2enmod ]; then
a2enmod -q version || a2enmod version
#a2enmod -q fcgid || a2enmod fcgid
exit 0
fi
# if rpm is not in update mode
# do this stuff only on initial installations ...
if ! [ $1 -gt 1 ]; then
if [ -z "${YAST_IS_RUNNING}" ]; then
if [ -n "$LC_ALL" ]; then
lang="$LC_ALL"
elif [ -n "$LC_MESSAGE" ]; then
lang="$LC_MESSAGE"
elif [ -n "$LANG" ]; then
lang="$LANG"
else
lang=
fi
echo
case "$lang" in
de_*)
echo "Zur Erstkonfiguration von postgreSQL ausführen ..."
echo "/usr/bin/kivitendo-erp-install.sh"
;;
*)
echo "For Initial config of postgreSQL run ..."
echo "/usr/bin/kivitendo-erp-install.sh"
;;
esac
echo
fi
fi
%if 0%{?has_systemd}
%service_add_post %{name}-taskd.service
%tmpfiles_create %{_tmpfilesdir}/%{name}-taskd.conf
%else
%{fillup_and_insserv -f %{name}-taskd}
%{__install} -d -m0755 -o %{ap_usr} -g root %{_localstatedir}/run/%{name}
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun %{name}-taskd.service
%else
%restart_on_update %{name}-taskd
%{insserv_cleanup}
%endif
%files
%defattr(-,root,root)
%doc doc/changelog doc/COPYING doc/copyright doc/UPGRADE
%config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf
%{_bindir}/*
%{_sbindir}/*
%if 0%{?has_systemd}
%{_unitdir}/%{name}-taskd.service
%{_prefix}/lib/tmpfiles.d/%{name}-taskd.conf
%ghost %dir /run/%{name}
%else
%{_sysconfdir}/init.d/%{name}-taskd
%endif
# html pages and perl-modules
%defattr(-,wwwrun,root)
%attr(-,wwwrun,root) %dir %{kivitendo_docroot}
%attr(-,wwwrun,root) %{kivitendo_docroot}/*
# docs
%defattr(0644,root,root,0755)
%doc %{name}-create-function.sql
%files devel
%defattr(-,root,root)
%doc doc/COPYING
%changelog