File MediathekView.spec of Package MediathekView

# norootforbuild

Name:           MediathekView
Summary:        Searches the online media library
Summary(de):    Durchsucht verschiedene Mediatheken
Group:			Productivity/Multimedia/Video/Players
Version:        13.4.0
Release:        1.1
URL:            https://mediathekview.de/
Source0:        https://github.com/mediathekview/MediathekView/archive/%{name}-%{version}.tar.gz
Source2:        %{name}.desktop
Source4:        %{name}_maven_buildfiles.tar.bz2 
License:        GPL-3.0-only
BuildRequires:	java-devel >= 11
Requires:		java >= 11
Requires:		vlc
Requires:		ffmpeg
Requires:		rtmpdump
BuildRoot:		%{_tmppath}/%{name}-%{version}-build
BuildArch:		noarch


%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)
./mvnw package

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
install -d -m 755 %{buildroot}%{_javadir}/Mediathek
install -m 755 target/MediathekView.jar %{buildroot}%{_javadir}/Mediathek/MediathekView-13.4.0.jar
pushd %{buildroot}%{_javadir}/Mediathek
ln -sf MediathekView-13.4.0.jar MediathekView.jar
popd
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 %{S:2} %{buildroot}%{_datadir}/applications/MediathekView.desktop

# Create Startscript
%__cat > MediathekView.sh << EOF
#!/bin/bash
# use right java version
JAVA_HOME=/etc/alternatives/jre_11
# 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)
set_options "-Xms256M" "-Xmx1G" "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" "-Dawt.useSystemAAFontSettings=on" "-Dswing.aatext=true"
CLASSPATH=\`build-classpath Mediathek\`
run "\$@"
EOF

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

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/MediathekView.sh
%dir %{_javadir}/Mediathek
%{_javadir}/Mediathek/%{name}-13.4.0.jar
%{_javadir}/Mediathek/%{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


%changelog