File geonext.spec of Package geonext

#
# spec file for package geonext
#
# Copyright (c) 2014 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:           geonext
Version:        1.74
Release:        0
Summary:        A tool for creating geometric constructions
License:        GPL-2.0+
Url:            http://www.geonext.de/
Source0:        %{name}.%{version}.zip
Source1:        %{name}.desktop
Source2:        %{name}.xml
Source3:        %{name}
Source4:        icons.tar.gz
BuildRequires:  unzip
Requires:       java >= 1.6.0
Requires(post): desktop-file-utils
Requires(post): hicolor-icon-theme
Requires(post): shared-mime-info
Requires(postun): desktop-file-utils
Requires(postun): hicolor-icon-theme
Requires(postun): shared-mime-info
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%{?mandriva_version}
Group:          Sciences/Mathematics
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
Group:          Applications/Productivity
%else
Group:          Productivity/Scientific/Math
%endif
%endif
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
BuildRequires:  desktop-file-utils
%endif
%endif
%if !0%{?fedora} && !0%{?rhel_version} && !0%{?centos_version} && !0%{?scientificlinux_version}
Recommends:     java-plugin >= 1.6.0
%endif
%define         installpath %{_datadir}/%{name}

%description
Geonext acts as a tool for creating geometric constructions with a various
number of construction tools. Compared to paper based constructions
constructions can be changed and varied dynamically afterwards.

%prep
%setup -q -n geonext_install
tar -xzf %{SOURCE4}

%build
#

%install
install -d -m 755 %{buildroot}/%{installpath}
install -d -m 755 %{buildroot}/%{_bindir}
install -d -m 755 %{buildroot}%{_docdir}/%{name}
install -m 644 license.txt %{buildroot}%{_docdir}/%{name}/COPYING
install -m 644 *.jar %{buildroot}/%{installpath}/
install -m 644 *.ico %{buildroot}/%{installpath}/
install -m 644 *.html %{buildroot}/%{installpath}/
install -m 644 didmat.crt %{buildroot}/%{installpath}/
install -m 644 *.gif %{buildroot}/%{installpath}/
install -m 644 *.png %{buildroot}/%{installpath}/
install -m 644 cacerts %{buildroot}/%{installpath}/
install -m 644 %{SOURCE3} %{buildroot}/%{installpath}/geonext
chmod +x %{buildroot}/%{installpath}/geonext

for SIZE in 16x16 22x22 32x32 48x48 64x64 128x128 256x256; do
install -d -m 755 %{buildroot}%{_datadir}/icons/hicolor/$SIZE/apps
install -d -m 755 %{buildroot}%{_datadir}/icons/hicolor/$SIZE/mimetypes
install -m 644 icons/hicolor/$SIZE/apps/geonext.png %{buildroot}%{_datadir}/icons/hicolor/$SIZE/apps/
cp -d icons/hicolor/$SIZE/mimetypes/application-vnd.geonext.png %{buildroot}%{_datadir}/icons/hicolor/$SIZE/mimetypes/
done

cat > %{buildroot}/%{_bindir}/%{name} << EOF
#!/bin/bash
#---------------------------------------------
# Script to start GEONExT
#---------------------------------------------

#---------------------------------------------
# Export name of this script

export GN_SCRIPTNAME=\$(basename \$0)

#---------------------------------------------
# Export path of system directory containing geonext.conf

export GN_SYS_CONFIG_PATH='%{_sysconfdir}/%{name}'

#---------------------------------------------
# Run

exec "%{installpath}/geonext" "\$@"
EOF

chmod 755 %{buildroot}/%{_bindir}/%{name}

install -d -m 755 %{buildroot}/%{_sysconfdir}/%{name}
cat > %{buildroot}/%{_sysconfdir}/%{name}/geonext.conf << EOF
# PLEASE DO NOT CHANGE %{_sysconfdir}/%{name}/geonext.conf!
# There are chances that your changes will be lost during system upgrades.
# Instead use %{_sysconfdir}/%{name}/geonext.conf.local for your local settings.


# This is the default GEONExT configuration file. It shows what the defaults
# for various options happen to be.
#
# If you don't need to change the default, you shouldn't uncomment the line.
# Doing so may cause run-time problems.


# JAVA OPTIONS
# -----------------------------------------------------------------------------

# Set Java command, e.g. '/usr/bin/java'.
#
#DEFAULT_JAVACMD='java'

# Set initial Java heap size, e.g. '32m'.
#
#DEFAULT_GN_XMS='32m'

# Set maximum Java heap size, e.g '512m'.
#
#DEFAULT_GN_XMX='1024m'

# Set native library path, e.g. '/usr/lib/jni'.
#
#DEFAULT_GN_DJAVA_LIBRARY_PATH=''

# Enable/disable the Xrender pipeline (true/false).
#
#DEFAULT_GN_DSUN_JAVA2D_XRENDER=''

# Enable/disable the OpenGL pipeline (true/false).
#
#DEFAULT_GN_DSUN_JAVA2D_OPENGL=''
EOF

cat > %{buildroot}%{_docdir}/%{name}/README << EOF
README for GEONExT
------------------

The defaults for various options are stored in the default GEONExT
configuration file %{_sysconfdir}/%{name}/geonext.conf. You should use
%{_sysconfdir}/%{name}/geonext.conf.local for your local settings.
EOF

#
# install mime data
#
install -d -m 755 %{buildroot}%{_datadir}/mime/packages
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/mime/packages/geonext.xml
#
# install desktop entry
#
install -Dm 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
%if 0%{?suse_version}
%suse_update_desktop_file %{name}
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%endif
%endif

%post
%if 0%{?mandriva_version}
%{update_mime_database}
%{update_icon_cache} hicolor
%else
%if !0%{?sles_version}
%mime_database_post
%icon_theme_cache_post hicolor
%else
%{_bindir}/update-mime-database %{_datadir}/mime > /dev/null
%endif
%endif

%postun
%if 0%{?mandriva_version}
%{clean_mime_database}
%{update_icon_cache} hicolor
%else
%if !0%{?sles_version}
%mime_database_postun
%icon_theme_cache_postun hicolor
%else
%{_bindir}/update-mime-database %{_datadir}/mime > /dev/null
%endif
%endif

%files
%defattr(-,root,root)
%dir %{installpath}
%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/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
%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
%{_datadir}/icons/hicolor/*/*/*.png
%config %{_sysconfdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{installpath}/*
%{_bindir}/%{name}
%{_datadir}/mime/packages/geonext.xml
%{_docdir}/%{name}

%changelog
openSUSE Build Service is sponsored by