File logisim-evolution.spec of Package logisim-evolution

#
# spec file for package logisim-evolution
#
# Copyright (c) 2023 SUSE LLC
#
# 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/
#


%define javaversion 21

Name:           logisim-evolution
Version:        3.9.0
Release:        0
Summary:        Digital logic design tool and simulator
License:        GPL-3.0-only
Group:          Productivity/Scientific/Electronics
URL:            https://github.com/logisim-evolution/logisim-evolution
Source0:        %{name}-%{version}.tar.gz
Source1:        logisim-evolution-kit.tar.xz

BuildRequires:  fdupes
BuildRequires:  gradle
BuildRequires:  java = %{javaversion}
BuildRequires:  java-devel = %{javaversion}

Recommends:     %{name}-doc

Requires:       java = %{javaversion}

%description
Logisim-evolution is educational software for designing and simulating digital logic circuits.

%package doc
Summary:        Documentation for logisim-evolution
License:        GPL-3.0-only
Group:          Productivity/Scientific/Electronics
BuildArch:      noarch

%description doc
Logisim-evolution is educational software for designing and simulating digital logic circuits.

%prep
%setup -q

rm -rf /tmp/gradle*
(cd /tmp; tar xf %{S:1})

%build
export LANG=en_US.UTF-8
export GRADLE_OPTS="-Xmx1024m"
export GRADLE_USER_HOME=/tmp/gradle
export JAVA_HOME=%{_jvmdir}/java-%{javaversion}-openjdk-%{javaversion}

gradle \
  --gradle-user-home $GRADLE_USER_HOME \
  --project-cache-dir /tmp/gradle-cache \
  --continue \
  -Dbuild.snapshot=false \
  -Dfile.encoding=UTF-8 \
  --offline \
  genFiles

gradle \
  --gradle-user-home $GRADLE_USER_HOME \
  --project-cache-dir /tmp/gradle-cache \
  --continue \
  -Dbuild.snapshot=false \
  -Dfile.encoding=UTF-8 \
  --offline \
  jar

%install
export LANG=en_US.UTF-8
export GRADLE_OPTS="-Xmx1024m"
export GRADLE_USER_HOME=/tmp/gradle
export JAVA_HOME=%{_jvmdir}/java-%{javaversion}-openjdk-%{javaversion}

gradle \
  --gradle-user-home $GRADLE_USER_HOME \
  --project-cache-dir /tmp/gradle-cache \
  --continue \
  -Dbuild.snapshot=false \
  -Dfile.encoding=UTF-8 \
  --offline \
  installDist

install -d %{buildroot}%{_datadir}
cp -a build/install/%{name} %{buildroot}%{_datadir}

install -d %{buildroot}%{_bindir}
ln -s %{_datadir}/%{name}/bin/%{name} %{buildroot}%{_bindir}

# doc
install -d %{buildroot}%{_docdir}/%{name}
cp -a build/resources/main/doc %{buildroot}%{_docdir}/%{name}

%fdupes %{buildroot}%{_docdir}/%{name}

%files
%defattr(-,root,root)
%license LICENSE.md
%doc README.md
%{_bindir}/%{name}

%doc docs/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*

%files doc
%defattr(-,root,root)
%doc build/resources/main/doc
%{_docdir}/%{name}/doc

%changelog
openSUSE Build Service is sponsored by