A new user interface for you! Read more...

File tuxguitar.spec of Package tuxguitar

#
# spec file for package tuxguitar
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


Summary:        A multitrack tablature editor and player written in Java-SWT
License:        LGPL-2.1+
Group:          Applications/Multimedia

Name:           tuxguitar
Version:        1.2
Release:        0
Url:            http://www.tuxguitar.com.ar
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-src-%{version}.tar.bz2
Source1:        Makefile
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       itext
Requires:       java >= 1.6
Requires:       jpackage-utils
Requires:       libswt3-gtk2
Requires:       timidity
%if 0%{?suse_version} == 1130
Requires:       libswt3-gtk2 = 3.4
BuildRequires:  libswt3-gtk2 = 3.4
%endif
BuildRequires:  alsa-lib-devel
BuildRequires:  ant
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  fluidsynth-devel
BuildRequires:  itext
BuildRequires:  java-devel >= 1.6.0
BuildRequires:  jpackage-utils
BuildRequires:  libswt3-gtk2
BuildRequires:  update-desktop-files

%description
TuxGuitar is a guitar tablature editor with player support through 
midi. It can display scores and multitrack tabs. Various features 
TuxGuitar provides include autoscrolling while playing, note 
duration management, bend/slide/vibrato/hammer-on/pull-off effects,
support for tuplets, time signature management, tempo management,
gp3/gp4/gp5 import and export.

%prep
%setup -q -n %{name}-src-%{version}
%__cp %{SOURCE1} .
# The following issues were discussed in:
# http://www.tuxguitar.com.ar/forum/4/817/need-help-with-packaging-for-fedora/
# Prevent static library paths to be built in TuxGuitar.jar (META-INF/MANIFEST.MF)
sed -i 's/<attribute name="Class-Path" value="${lib.swt.jar} ${dist.share.path}"\/>//' TuxGuitar/build.xml
# Export the library path during runtime instead
sed -i 's|env_$|env_\nexport CLASSPATH=$CLASSPATH:%{_libdir}/java/swt.jar\n|' misc/tuxguitar.sh
# Set place where .so files are located
sed -i 's|PACKAGE_LIB:=/usr/lib/jni|PACKAGE_LIB:=%{_libdir}/%{name}|' misc/tuxguitar.sh
# OpenSuse fix for java path
sed -i 's|JAVA=${JAVA:=${JAVA_HOME}/jre/bin/java}|JAVA=${JAVA:=/usr/bin/java}|' misc/tuxguitar.sh
# Disable the pdf plugin that depends on "iText" which is currently not available on Fedora
#sed -i 's/TuxGuitar-pdf \\/\\/g' Makefile
#sed -i 's/.\/TuxGuitar-pdf\/tuxguitar-pdf.jar \\/\\/g' Makefile
# Change /lib to %%{_lib}
sed -i 's/\/lib\//\/%{_lib}\//g' Makefile
sed -i 's/\/lib\//\/%{_lib}\//g' misc/tuxguitar.sh
sed -i 's/\/lib\//\/%{_lib}\//g' TuxGuitar/xml/build-linux.xml
# Don't strip the binaries during %%install
sed -i 's/install -s/install -m 755/g' Makefile
# Remove pre-shipped binaries
find -name .DS_Store -exec rm {} \;
# Update desktop file
sed -i -e 's|Version=1.0|GenericName=%{name}|g' misc/tuxguitar.desktop
sed -i -e 's|Categories=AudioVideo;Audio;|Categories=AudioVideo;Music;Java|g' misc/tuxguitar.desktop

%build
%define openjdkdir /usr/%{_lib}/jvm/java-openjdk
%if 0%{?suse_version} == 1130
make SWT_JAR=%{_datadir}/java/swt-gtk-3.4.jar CFLAGS="${RPM_OPT_FLAGS} -I%{openjdkdir}/include -I%{openjdkdir}/include/linux -fPIC"
%else
make SWT_JAR=%{_libdir}/java/swt.jar CFLAGS="${RPM_OPT_FLAGS} -I%{openjdkdir}/include -I%{openjdkdir}/include/linux -fPIC"
%endif

%install
make DESTDIR=$RPM_BUILD_ROOT INSTALL_LIB_DIR=$RPM_BUILD_ROOT/%{_libdir}/%{name} install
install -dm 755 $RPM_BUILD_ROOT/%{_libdir}/%{name}
make DESTDIR=$RPM_BUILD_ROOT INSTALL_LIB_DIR=$RPM_BUILD_ROOT/%{_libdir}/%{name} install-linux
# Makefile does not install the plugins by default so install them manually
install -dm 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/plugins
for jardir in TuxGuitar-*; do
 if [ -e $jardir/*jar ]
 then 
  install -m 644 $jardir/*jar  $RPM_BUILD_ROOT/%{_datadir}/%{name}/plugins/
 fi
done
# desktop files
install -dm 755 $RPM_BUILD_ROOT/%{_datadir}/applications
install -pm 644 misc/tuxguitar.desktop $RPM_BUILD_ROOT/%{_datadir}/applications/
# mime-type icons
install -dm 755 $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/96x96/mimetypes
install -pm 644 TuxGuitar/share/skins/Lavender/icon-96x96.png $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/96x96/mimetypes/audio-x-tuxguitar.png
install -pm 644 TuxGuitar/share/skins/Lavender/icon-96x96.png $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/96x96/mimetypes/audio-x-gtp.png
install -pm 644 TuxGuitar/share/skins/Lavender/icon-96x96.png $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/96x96/mimetypes/audio-x-ptb.png
# mime-type file
install -dm 755 $RPM_BUILD_ROOT/%{_datadir}/mime/packages
install -pm 644 misc/%{name}.xml $RPM_BUILD_ROOT/%{_datadir}/mime/packages/
#install also big icon
install -D -m 644 TuxGuitar/share/skins/Lavender/icon-48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/tuxguitar.png
%suse_update_desktop_file -n -i tuxguitar AudioVideo Music Java
%fdupes $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post
update-mime-database %{_datadir}/mime  > /dev/null 2>&1 ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
update-mime-database %{_datadir}/mime  > /dev/null 2>&1 ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%files
%defattr(-,root,root,-)
#%doc AUTHORS ChangeLog LICENSE README COPYING
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/96x96
%dir %{_datadir}/icons/hicolor/96x96/mimetypes
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/*.xml
%{_datadir}/pixmaps/*.png
%{_bindir}/%{name}

%changelog