Name: ledgersmb
Version: 1.2.21
Release: 1%{?dist}
Summary: Financial accounting program
Group: Applications/Productivity
License: GPLv2+
URL: http://www.ledgersmb.org/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: README.fedora
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(Locale::Maketext::Lexicon), texlive-latex, httpd, postgresql, perl(DBD::Pg)
Requires: perl(DBI), perl(version), perl(Smart::Comments), perl(MIME::Lite), perl(Class::Std)
Requires: perl(AppConfig::Std),
%{?perl_default_filter}
%description
LedgerSMB is a double-entry accounting system written in perl.
LedgerSMB is a fork of sql-ledger offering better security and data
integrity, and many advanced features.
%prep
%setup -q -n ledgersmb
cp %{SOURCE1} .
# Remove executable permissions from templates
find templates -type f | xargs chmod -x
find . -name '*.sql' -or -name '*.po' -or -name '*.css' -or -name '*.pm' -or -type f | xargs chmod -x
find . -name '*.pl' | xargs chmod +x
chmod +x utils/devel/find-use utils/pos/pos-hardware-client-startup-script utils/devel/chart-load-test.sh
find . -name '*.pl' | xargs sed -i -e '1d;2i#!/usr/bin/perl'
%build
cat << TAK > rpm-ledgersmb-httpd.conf
Alias /ledgersmb/doc/LedgerSMB-manual.pdf %{_docdir}/%{name}-%{version}/LedgerSMB-manual.pdf
TAK
perl -p -e "s,/some/path/to/ledgersmb,%{_datadir}/%{name},g" ledgersmb-httpd.conf >> rpm-ledgersmb-httpd.conf
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p -m0755 $RPM_BUILD_ROOT%{_datadir}/%{name} # /usr/lib/ledgersmb - readonly code and cgi directory
mkdir -p -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name} # /etc/ledgersmb - configs
mkdir -p -m0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name} # /var/lib/ledgersmb - data files, modified by cgi
mkdir -p -m0755 $RPM_BUILD_ROOT%{_localstatedir}/spool/%{name} # /var/spool/ledgersmb - spool files, modified by cgi
# the conf, placed in etc, symlinked back in place
mv ledgersmb.conf.default $RPM_BUILD_ROOT%{_sysconfdir}/ledgersmb/ledgersmb.conf
ln -s ../../..%{_sysconfdir}/ledgersmb/ledgersmb.conf \
$RPM_BUILD_ROOT%{_datadir}/%{name}/ledgersmb.conf
# install relevant parts in data/cgi directory
cp -rp *.pl favicon.ico index.html ledger-smb.eps ledger-smb.gif ledger-smb.png ledger-smb_small.png menu.ini \
bin LedgerSMB sql utils locale drivers \
$RPM_BUILD_ROOT%{_datadir}/%{name}/
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/locale/legacy
# css - written to by cgi
mkdir -p -m0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/css
ln -s ../../..%{_localstatedir}/lib/%{name}/css \
$RPM_BUILD_ROOT%{_datadir}/%{name}/css
cp -rp css/* \
$RPM_BUILD_ROOT%{_datadir}/%{name}/css
# templates - written to by cgi
mkdir -p -m0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/templates
ln -s ../../..%{_localstatedir}/lib/%{name}/templates \
$RPM_BUILD_ROOT%{_datadir}/%{name}/templates
cp -rp templates/* \
$RPM_BUILD_ROOT%{_datadir}/%{name}/templates
# spool - written to by cgi
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/%{name}
ln -s ../../..%{_localstatedir}/spool/%{name} \
$RPM_BUILD_ROOT%{_datadir}/%{name}/spool
# apache config file
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
install -m 644 rpm-ledgersmb-httpd.conf \
$RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ledgersmb.conf
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_datadir}/%{name}
%doc doc/{COPYRIGHT,faq.html,LedgerSMB-manual.pdf,README,release_notes} README.fedora
%doc BUGS Changelog CONTRIBUTORS INSTALL LICENSE README.translations TODO UPGRADE
%attr(-, apache, apache) %config(noreplace) %{_localstatedir}/lib/%{name}
%attr(-, apache, apache) %dir %{_localstatedir}/spool/%{name}
%attr(0755, root, apache) %dir %{_sysconfdir}/%{name}
%attr(0644, root, apache) %config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
%changelog
* Tue Jan 15 2010 Rakesh Pandit - 1.2.21-1
- Initial package (took upstream spec as sample)