File selfphp.spec of Package selfphp

#
# spec file for package selfphp
#
# 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:           selfphp
Version:        5.7.3
Release:        1
License:        Public Domain, Freeware
Summary:        PHP reference and tutorial
Url:            http://www.selfphp.info/
Group:          Documentation/Other
Source:         SELFPHP_%{version}_.tar.bz2
Source2:        selfphp.desktop
Source3:        %{name}.conf
Source4:        selfphp-rpmlintrc
%if 0%{suse_version}
Recommends:     apache2
BuildRequires:  fdupes
%define         apache_sysconfdir   %{_sysconfdir}/apache2
%else
BuildRequires:  desktop-file-utils
%define         apache_sysconfdir   %{_sysconfdir}/httpd2
%endif
BuildRequires:  dos2unix
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
AutoReqProv:    off


%description
Every PHP instruction is explained with at least one example and its
output in the web-browser. Useful for beginners and for anvanced PHP
programmers. Available in german only.

%prep
%setup -q -T -c %name -a0

%build

%install
export NO_BRP_CHECK_BYTECODE_VERSION="true"
mkdir -p %{buildroot}%{_datadir}/doc/selfphp
cp -r . %{buildroot}%{_datadir}/doc/selfphp/

for file in $(find %{buildroot}%{_datadir}/doc/selfphp/ -type f); do
	if file $file | grep -q text; then
	    dos2unix -o $file
	fi
done

# install desktop entry
install -D -m644 %{buildroot}%{_datadir}/doc/selfphp/src/SELFPHP_72dpi_Logo.gif %{buildroot}%{_datadir}/pixmaps/selfphp.gif
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/applications/selfphp.desktop
mkdir -p %{buildroot}%{_datadir}/susehelp/meta/SelfPHP
%if 0%{?suse_version}
# entry for susehelp
cp %{buildroot}%{_datadir}/applications/selfphp.desktop %{buildroot}%{_datadir}/susehelp/meta/SelfPHP/
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
# install desktop file
desktop-file-install --vendor="%{vendor}" \
  --dir=%{buildroot}%{_datadir}/applications \
  %{SOURCE2}
%endif
# create apache configuration
%{__mkdir_p} %{buildroot}%{apache_sysconfdir}/conf.d
%{__install} -m 644 %{SOURCE3} %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf

%if 0%{?suse_version} > 1020
%fdupes -s %{buildroot}
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(644,root,root,755)
%dir %{apache_sysconfdir}
%dir %{apache_sysconfdir}/conf.d
%doc %{_datadir}/doc/selfphp
%doc %{_datadir}/susehelp/meta/SelfPHP
%dir %{_datadir}/susehelp
%dir %{_datadir}/susehelp/meta
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/*
%config (noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf

%changelog
openSUSE Build Service is sponsored by