File MediathekView.spec of Package MediathekView

#
# spec file for package MediathekView
#
# Copyright (c) 2020 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 java_version 21
Name:           MediathekView
Version:        14.2.0.20250228T114838
Release:        0
Summary:        Searches the online media library
Summary(de):    Durchsucht verschiedene Mediatheken
License:        GPL-3.0-only
Group:          Productivity/Multimedia/Video/Players
URL:            https://mediathekview.de/
Source0:        %{name}-%{version}.tar.xz
Source2:        %{name}.desktop
Source4:        %{name}_maven_build_files.tar.bz2
Source10:       %{name}.vmoptions
BuildRequires:  java-devel = %{java_version}
BuildRequires:  xz
Requires:       ffmpeg
Requires:       java = %{java_version}
Requires:       rtmpdump
Requires:       vlc
BuildArch:      noarch
Obsoletes:      MediathekView-next

%description
MediathekView searches the online media library of various German tv stations.
(ARD, ZDF, Arte, 3Sat, MDR, NDR, ORF, SF), invites contributions with a
program of your choice and can create topics as subscriptions and automatically
download new contributions. There is also a way to manage and download podcast.

%description -l de
Das Programm durchsucht die Mediathek verschiedener Sender (ARD, ZDF, Arte,
3Sat, MDR, NDR, ORF, SF), lädt Beiträge mit einem Programm eigener Wahl und
kann Themen als Abos anlegen und neue Beiträge automatisch downloaden.
Es gibt auch eine Möglichkeit, Podcast zu verwalten und zu downloaden.

%prep
%setup -q -n %{name}-%{version}
# Install maven files as /home/abuild/.m2
tar -xjf %{SOURCE4} -C $HOME

# cleanup
find -name '*.class' -type f -exec rm -r {} \;

# W: wrong-file-end-of-line-encoding
sed -i 's/\r$//' res/README.txt


%build
export CLASSPATH=$(build-classpath)
# Skip tests as one of them fails
./mvnw -DskipTests=true package

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
# app
install -d -m 755 %{buildroot}%{_javadir}/%{name}
install -m 755 target/MediathekView.jar %{buildroot}%{_javadir}/%{name}/MediathekView-%{version}.jar
pushd %{buildroot}%{_javadir}/%{name}
ln -sf MediathekView-%{version}.jar MediathekView.jar
popd
# vmoptions
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/
install -m 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/%{name}/%{name}.vmoptions
# other
install -d -m 755 %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -m 644 res/%{name}.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
install -d -m 755 %{buildroot}%{_datadir}/applications/
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/applications/MediathekView.desktop

# Create Startscript
cat > MediathekView.sh << EOF
#!/bin/bash
# use right java version
JAVA_HOME=%{_sysconfdir}/alternatives/jre_%{java_version}
# set jar-entry-class
MAIN_CLASS="mediathek.Main"
# source the jpackage helpers and set environment
VERBOSE=1
.  %{_javadir}-utils/java-functions
set_javacmd
check_java_env
set_jvm_dirs
# If the memory run short it can help to use set_options
# Xms set the initial and minimum Java heap size, Xmx set the maximum Java heap size
# default: Xms (25% of the amount of free physical memory in the system, up to 16 MB and at least 8 MB)
# default: Xmx (32bit: 50% of available physical memory up to 1 GB, 64bit: 50% of available physical memory up to 32 GB)
# Attention: set_options parameter now in MediathekView.vmoptions file.
set_options \$(sed '/#/d' /etc/MediathekView/MediathekView.vmoptions | tr '\n' ' ')
CLASSPATH=\`build-classpath MediathekView\`
run "\$@"
EOF

install -D -m755 MediathekView.sh %{buildroot}%{_bindir}/MediathekView.sh

%files
%attr(755,root,root) %{_bindir}/MediathekView.sh
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/%{name}-%{version}.jar
%{_javadir}/%{name}/%{name}.jar
%attr(644,root,root) %{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%attr(644,root,root) %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.vmoptions

%changelog
openSUSE Build Service is sponsored by