File intellij-idea-community-edition.spec of Package intellij-idea-community-edition

#
# spec file for package intellij-idea-community-edition
#
# Copyright (c) 2017 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/
#


%define __provides_exclude \\.so
%define __requires_exclude \\.so
%define _name   intellijidea-ce
%define _build_ver 173.4548.28
Name:           intellij-idea-community-edition
Version:        2017.3
Release:        4
Summary:        The Most Intelligent Java IDE
License:        Apache-2.0
Group:          Development/Tools/IDE
Url:            https://jetbrains.com/idea
Source:         http://download.jetbrains.com/idea/ideaIC-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Requires:       giflib-progs
Requires:       java >= 1.6.0
ExclusiveArch:  x86_64

%description
IntelliJ IDEA is an intelligent Java IDE (Community Edition).

%prep
%setup -q -n idea-IC-%{_build_ver}
# Replace "-n" with "! -z" as "-n" in some cases proves to be utterly buggy.
sed -i 's/\(if \[ \)-n/\1! -z/g' bin/idea.sh

cat << EOF > %{_name}.sh
#!/bin/sh

cd '%{_libdir}/%{_name}/bin/'
exec ./idea.sh "\$%{nil}@"
EOF
cat << EOF > %{_name}.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA CE
GenericName=IntelliJ IDEA Community Edition
Comment=The Most Intelligent Java IDE
Exec=%{_name} %U
Icon=%{_name}
Terminal=false
Categories=Development;IDE;
EOF

%build
# Nothing to build.

%install
mkdir -p %{buildroot}%{_libdir}/
cp -a . %{buildroot}%{_libdir}/%{_name}

install -Dpm 0755 %{_name}.sh %{buildroot}%{_bindir}/%{_name}
install -Dpm 0644 %{_name}.desktop \
  %{buildroot}%{_datadir}/applications/%{_name}.desktop
install -Dpm 0644 bin/idea.png \
  %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{_name}.png

%fdupes %{buildroot}%{_libdir}/

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc NOTICE.txt license/
%{_bindir}/%{_name}
%{_libdir}/%{_name}/
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{_name}.png

%changelog
openSUSE Build Service is sponsored by