File bluej.spec of Package bluej

#
# spec file for package bluej
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

Name:             bluej
Summary:          An integrated Java environment specifically designed for introductory teaching
Version:          3.1.7
# without the obsoletes below, versions with the older version scheme would "never" be updated
Obsoletes:        %{name} == 305
Obsoletes:        %{name} == 304
Obsoletes:        %{name} == 251
Release:          1
License:          GPL-2.0 and BSD-3-Clause and CDDL-1.0 and CPL-1.0 and Apache-2.0
Url:              http://www.bluej.org/
Group:            Development/Tools/IDE
Vendor:           openSUSE-Education
BuildRequires:    ant
BuildRequires:    unzip
BuildRequires:    java-sdk >= 1.6.0
BuildRequires:    jpackage-utils
%if 0%{?suse_version}
BuildRequires:    update-desktop-files
%endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires:    desktop-file-utils
%endif
%if 0%{?centos_version}
BuildRequires:    java-1.6.0-openjdk-devel
%endif
Requires:         java-sdk >= 1.6.0
%if !0%{?fedora} && !0%{?rhel_version} && !0%{?centos_version}
Suggests:         bluej-extensions
%endif
Requires(post):   shared-mime-info
Requires(postun): shared-mime-info
BuildArch:        noarch
Source0:          BlueJ-source-317.zip
Source1:          %{name}.desktop
Source2:          bluej-hicolor-icons.tar.gz
Source3:          build.properties
Source4:          %{name}.xml
Source5:          bluej_oxygen_icons.tar.gz
Source6:          bluej_open_project.desktop
Source7:          bluej_open_folder.desktop
Patch0:           bluej-blackbox.patch
BuildRoot:        %{_tmppath}/%{name}-%{version}-build

%description
The BlueJ environment was developed as part of a university research project
about teaching object-orientation to beginners. The aim of BlueJ is to provide
an easy-to-use teaching environment for the Java language that facilitates the
teaching of Java to first year students. Special emphasis has been placed on
visualisation and interaction techniques to create a highly interactive
environment that encourages experimentation and exploration.

BlueJ is based on the Blue system. Blue is an integrated teaching environment
and language, developed at the University of Sydney and Monash University,
Australia. BlueJ provides a Blue-like environment for the Java language.



Authors:
-------
    M. Kölling and J. Rosenberg

%package oxygen-icons
License:          LGPL-3.0
Summary:          BlueJ Icons for Oxygen Icon Theme
Group:            Development/Tools/IDE
Requires:         oxygen-icon-theme
Requires:         %{name} = %{version}
%if !0%{?fedora} && !0%{?rhel_version} && !0%{?centos_version} && !0%{?mandriva_version}
Supplements:      packageand(%{name}:oxygen-icon-theme)
%endif

%description oxygen-icons
This package provides MIME type icons that integrate well into the KDE/Oxygen icon theme (http://www.oxygen-icons.org).

%package kde
License:          LGPL-3.0
Summary:          KDE integration for BlueJ
Group:            Development/Tools/IDE
Requires:         kdebase4-runtime
Requires:         %{name} = %{version}
%if !0%{?fedora} && !0%{?rhel_version} && !0%{?centos_version} && !0%{?mandriva_version}
Supplements:      packageand(%{name}:kdebase4-runtime)
%endif

%description kde
This package installs a KDE service menu that lets the user open BlueJ projects by right clicking on BlueJ package files or folders.

%prep
unzip %{SOURCE0} -d %{name}-%{version}
%{__install} -m644 %{SOURCE3} %{name}-%{version}/build.properties
tar -xzf %{SOURCE2}
tar -xzf %{SOURCE5}
cd %{name}-%{version}
%patch0 -p1

%build
cd %{name}-%{version}
ant

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
%{__install} -d -m755 %{buildroot}%{_datadir}
cp -pr %{name}-%{version}/lib %{buildroot}%{_datadir}
mv %{buildroot}%{_datadir}/lib %{buildroot}%{_datadir}/%{name}

%{__install} -d -m 755 %{buildroot}/%{_sysconfdir}/%{name}
cp -d %{buildroot}%{_datadir}/%{name}/bluej.defs %{buildroot}/%{_sysconfdir}/%{name}
rm -f %{buildroot}%{_datadir}/%{name}/bluej.defs
ln -sf %{_sysconfdir}/%{name}/bluej.defs %{buildroot}%{_datadir}/%{name}/bluej.defs
cp -d %{buildroot}%{_datadir}/%{name}/greenfoot.defs %{buildroot}/%{_sysconfdir}/%{name}
rm -f %{buildroot}%{_datadir}/%{name}/greenfoot.defs
ln -sf %{_sysconfdir}/%{name}/greenfoot.defs %{buildroot}%{_datadir}/%{name}/greenfoot.defs
cp -d %{buildroot}%{_datadir}/%{name}/moe.defs %{buildroot}/%{_sysconfdir}/%{name}
rm -f %{buildroot}%{_datadir}/%{name}/moe.defs
ln -sf %{_sysconfdir}/%{name}/moe.defs %{buildroot}%{_datadir}/%{name}/moe.defs

for SIZE in 16x16 22x22 32x32 48x48 64x64 128x128 256x256; do
%{__install} -d -m755 %{buildroot}%{_datadir}/icons/hicolor/$SIZE/apps
%{__install} -d -m755 %{buildroot}%{_datadir}/icons/hicolor/$SIZE/mimetypes
%{__install} -m644 hicolor/$SIZE/apps/bluej.png %{buildroot}%{_datadir}/icons/hicolor/$SIZE/apps/%{name}.png
cp -d hicolor/$SIZE/mimetypes/text-x-bluej.png %{buildroot}%{_datadir}/icons/hicolor/$SIZE/mimetypes
done
for SIZE in 16x16 22x22 32x32 48x48 64x64 128x128 256x256; do
%{__install} -d -m755 %{buildroot}%{_datadir}/icons/oxygen/$SIZE/mimetypes
%{__install} -m644 bluej_oxygen_icons/oxygen/$SIZE/mimetypes/text-x-bluej.png %{buildroot}%{_datadir}/icons/oxygen/$SIZE/mimetypes
done
%{__install} -d -m755 %{buildroot}%{_datadir}/applications
%{__install} -m644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
%{__install} -d -m755 %{buildroot}%{_datadir}/mime/packages
%{__install} -m644 %{SOURCE4} %{buildroot}%{_datadir}/mime/packages/%{name}.xml
%{__install} -d -m755 %{buildroot}%{_datadir}/kde4/services/ServiceMenus
%{__install} -m644 %{SOURCE6} %{buildroot}%{_datadir}/kde4/services/ServiceMenus
%{__install} -m644 %{SOURCE7} %{buildroot}%{_datadir}/kde4/services/ServiceMenus
%{__install} -d -m755 %{buildroot}%{_docdir}/%{name}
%{__install} -m644 bluej-%{version}/doc/LICENSE.txt %{buildroot}%{_docdir}/%{name}/LICENSE.txt
%{__install} -m644 bluej-%{version}/doc/THIRDPARTYLICENSE.txt %{buildroot}%{_docdir}/%{name}/THIRDPARTYLICENSE.txt
cp -pr bluej-%{version}/examples %{buildroot}%{_docdir}/%{name}
%{__install} -d -m755 %{buildroot}%{_docdir}/%{name}-oxygen-icons
%{__install} -m644 bluej_oxygen_icons/COPYING %{buildroot}%{_docdir}/%{name}-oxygen-icons/
%{__install} -m644 bluej_oxygen_icons/README %{buildroot}%{_docdir}/%{name}-oxygen-icons/
%{__install} -d -m755 %{buildroot}%{_bindir}

#Remove forbidden files:
rm -f %{buildroot}%{_datadir}/%{name}/bluej.defs.orig

# startscript
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/bash
# simple script to start BlueJ
"/etc/alternatives/java_sdk/bin/java" -cp "%{_datadir}/%{name}/bluej.jar:/etc/alternatives/java_sdk/lib/tools.jar" bluej.Boot "\$@"
EOF
%{__chmod} 755 %{buildroot}%{_bindir}/%{name}

%if 0%{?suse_version}
%suse_update_desktop_file %{name}
%endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%endif

%clean
rm -rf %{buildroot}

%post
%if 0%{?mandriva_version}
%{update_menus}
%update_desktop_database
%update_mime_database
%update_icon_cache hicolor
%update_icon_cache oxygen
%else
%{_bindir}/update-mime-database %{_datadir}/mime >/dev/null
%endif

%postun
%if 0%{?mandriva_version}
%{clean_menus}
%clean_desktop_database
%clean_mime_database
%update_icon_cache hicolor
%update_icon_cache oxygen
%else
%{_bindir}/update-mime-database %{_datadir}/mime >/dev/null
%endif

%files
%defattr(-,root,root)
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/22x22
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor/64x64
%dir %{_datadir}/icons/hicolor/128x128
%dir %{_datadir}/icons/hicolor/256x256
%dir %{_datadir}/icons/hicolor/16x16/apps
%dir %{_datadir}/icons/hicolor/22x22/apps
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/icons/hicolor/48x48/apps
%dir %{_datadir}/icons/hicolor/64x64/apps
%dir %{_datadir}/icons/hicolor/128x128/apps
%dir %{_datadir}/icons/hicolor/256x256/apps
%dir %{_datadir}/icons/hicolor/16x16/mimetypes
%dir %{_datadir}/icons/hicolor/22x22/mimetypes
%dir %{_datadir}/icons/hicolor/32x32/mimetypes
%dir %{_datadir}/icons/hicolor/48x48/mimetypes
%dir %{_datadir}/icons/hicolor/64x64/mimetypes
%dir %{_datadir}/icons/hicolor/128x128/mimetypes
%dir %{_datadir}/icons/hicolor/256x256/mimetypes
%{_docdir}/%{name}
%{_datadir}/%{name}
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/*/*/*.png
%config /etc/%{name}

%files oxygen-icons
%defattr(-,root,root)
%dir %{_datadir}/icons/oxygen
%dir %{_datadir}/icons/oxygen/16x16
%dir %{_datadir}/icons/oxygen/22x22
%dir %{_datadir}/icons/oxygen/32x32
%dir %{_datadir}/icons/oxygen/48x48
%dir %{_datadir}/icons/oxygen/64x64
%dir %{_datadir}/icons/oxygen/128x128
%dir %{_datadir}/icons/oxygen/256x256
%dir %{_datadir}/icons/oxygen/16x16/mimetypes
%dir %{_datadir}/icons/oxygen/22x22/mimetypes
%dir %{_datadir}/icons/oxygen/32x32/mimetypes
%dir %{_datadir}/icons/oxygen/48x48/mimetypes
%dir %{_datadir}/icons/oxygen/64x64/mimetypes
%dir %{_datadir}/icons/oxygen/128x128/mimetypes
%dir %{_datadir}/icons/oxygen/256x256/mimetypes
%{_docdir}/%{name}-oxygen-icons
%{_datadir}/icons/oxygen/*/*/*.png

%files kde
%defattr(-,root,root)
%dir %{_datadir}/kde4
%dir %{_datadir}/kde4/services
%dir %{_datadir}/kde4/services/ServiceMenus
%{_datadir}/kde4/services/ServiceMenus/bluej_open_project.desktop
%{_datadir}/kde4/services/ServiceMenus/bluej_open_folder.desktop

%changelog
openSUSE Build Service is sponsored by