File gradle.spec of Package gradle

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

# copied from home:scalpel4k / gradle

%define _icondir %_datadir/icons

Name:           gradle
Version:        2.11
Release:        0
License:        Apache-2.0
Summary:        Build Automation Framework
Url:            http://www.gradle.org
Group:          Development/Tools/Building
BuildArch:      noarch
#Source:         https://services.gradle.org/distributions/%{name}-%{version}-bin.zip
Source:		%{name}-%{version}-bin.zip
BuildRequires:  unzip
BuildRequires:  filesystem
BuildRequires:  hicolor-icon-theme
Requires:       jre >= 1.6.0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description

%prep
%setup -q

%build

%install

mkdir -p %{buildroot}%{_datadir}/java/%{name}-%{version}/bin
install -p bin/%{name} %{buildroot}%{_datadir}/java/%{name}-%{version}/bin/

mkdir -p %{buildroot}%{_sysconfdir}/%{name}-%{version}/
install -p -m 0644 init.d/readme.txt %{buildroot}%{_sysconfdir}/%{name}-%{version}/
ln -s %{_sysconfdir}/%{name}-%{version} %{buildroot}%{_datadir}/java/%{name}-%{version}/init.d

mkdir -p %{buildroot}%{_datadir}/java/%{name}-%{version}/lib
cp -R lib/* %{buildroot}%{_datadir}/java/%{name}-%{version}/lib


mkdir -p %{buildroot}%{_bindir}
for binary in %{name} ; do
	ln -s %{_datadir}/java/%{name}-%{version}/bin/$binary %{buildroot}%{_bindir}/%{name}-%{version}
done

for size in 16 24 32 48 64 128 256 ; do
    mkdir -p %{buildroot}%{_icondir}/hicolor/"$size"x"$size"/apps
    install -m 0644 media/%{name}-icon-"$size"x"$size".png %{buildroot}%{_icondir}/hicolor/"$size"x"$size"/apps/%{name}-%{version}.png
    list="$list""%{_icondir}/hicolor/"$size"x"$size"/apps/%{name}-%{version}.png\n"
done
echo -e "$list" > icons.list

%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%files -f icons.list
%defattr(-,root,root)
%doc LICENSE NOTICE changelog.txt getting-started.html
%dir %{_sysconfdir}/%{name}-%{version}/
%config(noreplace) %{_sysconfdir}/%{name}-%{version}/*
%{_datadir}/java/%{name}-%{version}
%{_bindir}/%{name}-%{version}