File avideo.spec of Package avideo

#
# spec file for package avideo
#
# Copyright (c) 2021 SUSE LINUX 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/
#


Name:           avideo
Version:        11
Release:        0
Summary:        A Video Platform
License:        JSON
Group:          Productivity/Networking/Web/Utilities
Url:            https://avideo.com/
Source:         AVideo-%{version}.tar.xz
Source1:        %{name}-tmpfile.conf
Source2:        %{name}-apache.conf 
BuildRequires:  apache2-devel
BuildRequires:  fdupes
BuildRequires:  logrotate
BuildRequires:  mariadb
BuildRequires:  pkgconfig(systemd)
Recommends:     php-APCu
Recommends:     php-ldap
Requires:       ffmpeg
Requires:       mod_php_any >= 5.6
Requires:       php-curl
Requires:       php-exif
Requires:       php-fileinfo
Requires:       php-gd
Requires:       php-gettext
Requires:       php-intl
Requires:       php-mbstring
Requires:       php-mysql
Requires:       php-pdo
Requires:       php-zip
Requires:       php >= 5.6
Requires:       apache2 >= 2.0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%{?suse_version}
%define ap_usr wwwrun
%define ap_grp www
%else
%define ap_usr nobody
%define ap_grp nogroup
%endif
Requires(pre):  apache2 >= 2.0
Requires(pre):  user(%ap_usr)
Requires(pre):  group(%ap_grp)
Requires(pre):  php >= 5.6
%define ap_sysconfdir %{_sysconfdir}/apache2
%define installdir /usr/share/php/%{name}
%{?systemd_requires}
%{!?_tmpfilesdir:%global _tmpfilesdir %{_prefix}/lib/tmpfiles.d}

%description
AVideo Platform is an audio and video platform for easy media surfing,
streaming, and sharing. AVideo is a generic term that means absolutely nothing,
or anything video. Since it doesn't mean anything the brand simply is
identifiable with a Platform that does Audio and Video or simply "A Video
Platform".

%prep
%setup -q -n AVideo-%{version}
# remove unwanted files
for file in \
	.babelrc \
	.config \
	.coveralls.yml \
	.coveralls.github-actions.yml \
	.editorconfig \
    .empty \
	.gitattributes \
	.gitkeep \
	.htaccess \
	.jscsrc \
	.npmignore \
	.php_cs \
	.php_cs.dist \
	.scrutinizer.yml \
	.styleci.yml \
	.travis.yml \
	.unknownextension \
	; do
  find . -type f -name $file -delete
done
for dir in .github ; do
    find . -type d -name "$dir" -prune -exec rm -rf {} + || :
done

# env-script-interpreter
find . -type f -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|g' {} +


%build
# nothing to build

%install
install -d -m0755 %{buildroot}/%{installdir}
# copy src from build to buildroot
cp -dR * %{buildroot}/%{installdir}/
rm %{buildroot}/%{installdir}/{Dockerfile,docker-compose.yml,*.md}

# create missing directories

# install apache config
mkdir -p %{buildroot}/%{ap_sysconfdir}/conf.d
sed -e 's|__avideo_web__|%{installdir}|g' \
    -e 's|__avideo_conf__|%{_sysconfdir}/%{name}|g' \
    -e 's|__avideo_log__|/var/log/%{name}|g' \
    %{SOURCE2} > %{buildroot}/%{ap_sysconfdir}/conf.d/%{name}.conf

# install tmpfile
install -D -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf
mkdir -p %{buildroot}/run/avideo_sessions

# reduce size, run fdupes
%fdupes %{buildroot}/%{installdir}

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
# enable modules in apache config
if [ -x %{_sbindir}/a2enmod ]; then
  %{_sbindir}/a2enmod headers 2>/dev/null || :
  %{_sbindir}/a2enmod php7 2>/dev/null || :
  %{_sbindir}/a2enmod rewrite 2>/dev/null || :
fi

%files
%defattr(0644,root,root,0755)
%doc     README.md 
%license LICENSE 
%dir %{_datadir}/php
%dir %{installdir}
%config(noreplace) %{ap_sysconfdir}/conf.d/%{name}.conf
%{_tmpfilesdir}/%{name}.conf
%{installdir}/*
%defattr(0640,%ap_usr,%ap_grp,0750)
%ghost %dir /run/avideo_sessions

%changelog

openSUSE Build Service is sponsored by