File wallabag.spec of Package wallabag

#
# spec file for package wallabag
#
# Copyright (c) Lars Vogdt <lars@linux-schulserver.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 http://bugs.opensuse.org/
#

Name:           wallabag
Version:        2.1.5
Release:        0
License:        MIT
Summary:        Self hostable application for saving web pages
Url:            https://www.wallabag.org/
Group:          Productivity/Networking/Web/Utilities
# https://github.com/wallabag/wallabag 
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}_apache.conf
Source2:        %{name}-rpmlintrc
BuildRequires:  apache2
BuildRequires:  fdupes
Requires:       pcre
Requires:       php-bcmath
Requires:       php-ctype
Requires:       php-curl
Requires:       php-dom
Requires:       php-gd
Requires:       php-gettext
Requires:       php-hash
Requires:       php-iconv
Requires:       php-json
Requires:       php-mbstring
Requires:       php-session
Requires:       php-tidy
Requires:       php-tokenizer
Requires:       php-xmlreader
Requires:       php-zlib
Requires:       php5 >= 5.3.3
Requires:       php_any_db
Requires:       php-pdo
Recommends:     Sphinx >= 1.3.0
Recommends:     guzzle_sphinx_theme >= 0.7.0
Recommends:     php-pgsql
Recommends:     php-composer
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%define         app_dir %{_datadir}/%{name}

%description
wallabag is a self hostable application for saving web pages. Unlike other
services, wallabag is free (as in freedom) and open source.

With this application you will not miss content anymore. Click, save, read it
when you want. It saves the content you select so that you can read it when you
have time.

%prep
%setup -q
for file in .composer-auth.json .editorconfig .eslintrc.json .gitignore .scrutinizer.yml .stylelintrc .travis.yml .zappr.yaml; do
	rm $file
done
rm -rf .github
find . -size 0 -delete
find -name .htaccess -delete
cd scripts
for i in *.sh; do
	BASH=$(which bash)
	sed -i "s|/usr/bin/env.*|$BASH|g" $i
	chmod +x $i
done
cd ..
find app/Resources -type f -exec chmod -x {} \;

%build
#
%install
mkdir -p %{buildroot}%{app_dir} \
         %{buildroot}/%{_sysconfdir}/apache2/vhosts.d \
         %{buildroot}%{_sysconfdir}/%{name}

sed -e "s|__APP_DIR__|%{app_dir}|g" %{SOURCE1} > %{buildroot}/%{_sysconfdir}/apache2/vhosts.d/%{name}.conf

mv -v app/config/* %{buildroot}%{_sysconfdir}/%{name}/
rm -rf app/config
cp -r . %{buildroot}%{app_dir}/
cd %{buildroot}%{app_dir}/app
ln -s %{_sysconfdir}/%{name} config
rm %{buildroot}%{app_dir}/*.md
%fdupes -s %{buildroot}%{app_dir} 

%files
%defattr(-,root,root)
%doc *.md
%dir %{app_dir}
%dir %{_sysconfdir}/%{name}
%{app_dir}/*
%config(noreplace) %{_sysconfdir}/%{name}/*
%defattr(-,wwwrun,www)
%config(noreplace) %{_sysconfdir}/apache2/vhosts.d/%{name}.conf

%changelog