File javadict.spec of Package javadict

#
# spec file for package javadict
#
# Copyright (c) 2018 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 https://bugs.opensuse.org/
#


Name:           javadict
Version:        1.1
Release:        0
Summary:        Japanese-English Dictionary Lookup Tool Featuring Handwriting Recognition
License:        GPL-2.0-or-later
Group:          Productivity/Office/Dictionary
URL:            http://www.cs.arizona.edu/japan/JavaDict/
Source0:        http://www2.cs.arizona.edu/projects/japan/JavaDict/download/JavaDict-contest.tgz
Source1:        javadict.sh
Patch0:         javadict-fontsetup.patch
Patch1:         javadict-java.patch
BuildRequires:  edict
BuildRequires:  java2-devel-packages
BuildRequires:  xjdic-indices
Requires:       edict
Requires:       jre1.6.x
Requires:       xjdic-indices
BuildArch:      noarch

%description
JavaDict is a Japanese-English dictionary and character dictionary
browser (for Jim Breen's EDICT dictionary) featuring handwriting
recognition-based character lookup.

It is portable, easy to use, and primarily intended for use by
English-speaking students of Japanese (or Japanese-speaking students of
English).

%prep
%setup -q -c %{name}-%{version}
%patch0 -p1
%patch1
find . -type d | xargs chmod 755
# clean up precompiled classes
rm *.class

%build
javac -target 1.6 -source 1.6 *.java
mkdir javadict
mv *.class javadict
cat <<EOF > manifest
Manifest-Version: 1.0
Main-Class: javadict/JavaDict
EOF
# sic!, see jar -help
jar -cvfm javadict.jar manifest javadict/*
rm -rf javadict
rm *.java
# fix permissions
chmod a-x *.gif

%install
[ %{buildroot} != "/" ] && [ -d %{buildroot} ] && rm -rf $RPM_BUILD_ROOT;
# install startscript:
mkdir -p %{buildroot}%{_bindir}
install -p -m 755 %{SOURCE1} %{buildroot}%{_bindir}/javadict
# install Java stuff:
mkdir -p %{buildroot}%{_prefix}/lib/javadict
cp -a  ./* %{buildroot}%{_prefix}/lib/javadict
# remove docs in installed tree (because they will also be in
# %{_defaultdocdir}/%{packagename}:
for i in COPYING READ.ME README.html docs/
do
    rm -rf %{buildroot}/$i
done
# make symbolic links to the dictionaries from the "edict" package:
for i in enamdict edict jddict.v02 pandpdic geodic lingdic concrete \
         classical aviation j_places kanjidic compverb mktdic compdic \
         kanjd212 edicth 4jwords findic
do
    test -e %{_datadir}/edict/$i-euc || continue
    ln -s -f %{_datadir}/edict/$i-euc %{buildroot}%{_prefix}/lib/javadict/$i
done

%files
%license COPYING
%doc READ.ME README.html docs/
%{_bindir}/javadict
%dir %{_prefix}/lib/javadict/
%{_prefix}/lib/javadict/*

%changelog
openSUSE Build Service is sponsored by