--- /dev/null
+diff -purN a/TuxGuitar/build.properties b/TuxGuitar/build.properties
+--- a/TuxGuitar/build.properties 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar/build.properties 2016-08-23 10:55:06.271917712 +0100
+@@ -5,4 +5,5 @@ ant.build.javac.source=1.5
+ ant.build.javac.target=1.5
+
+ path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
++path.tuxguitar-editor-utils=../TuxGuitar-editor-utils/tuxguitar-editor-utils.jar
+ path.swt=../TuxGuitar/lib/swt.jar
+diff -purN a/TuxGuitar/build.xml b/TuxGuitar/build.xml
+--- a/TuxGuitar/build.xml 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar/build.xml 2016-08-23 08:59:03.987797193 +0100
+@@ -12,6 +12,7 @@
+
+ <path id="class.path">
+ <pathelement location="${path.tuxguitar-lib}"/>
++ <pathelement location="${path.tuxguitar-editor-utils}"/>
+ <pathelement location="${path.swt}"/>
+ </path >
+
+diff -purN a/TuxGuitar-awt-graphics/build.properties b/TuxGuitar-awt-graphics/build.properties
+--- a/TuxGuitar-awt-graphics/build.properties 1970-01-01 01:00:00.000000000 +0100
++++ b/TuxGuitar-awt-graphics/build.properties 2016-08-23 09:11:06.737851049 +0100
+@@ -0,0 +1,7 @@
++### ANT Flags
++#
++# build.compiler=gcj
++ant.build.javac.source=1.5
++ant.build.javac.target=1.5
++
++path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
+diff -purN a/TuxGuitar-awt-graphics/build.xml b/TuxGuitar-awt-graphics/build.xml
+--- a/TuxGuitar-awt-graphics/build.xml 1970-01-01 01:00:00.000000000 +0100
++++ b/TuxGuitar-awt-graphics/build.xml 2016-08-23 12:40:24.005858183 +0100
+@@ -0,0 +1,45 @@
++<?xml version="1.0" encoding="iso-8859-1"?>
++
++<project name="TuxGuitar-awt-graphics" basedir="." default="all">
++ <description>
++ TuxGuitar AWT Graphics
++ </description>
++
++ <property file="build.properties" />
++ <property name="build.src.path" value="src" />
++ <property name="build.path" value="build" />
++ <property name="build.jar" value="tuxguitar-awt-graphics.jar" />
++
++ <path id="class.path">
++ <pathelement location="${path.tuxguitar-lib}"/>
++ </path >
++
++ <target name="init" depends="clean">
++ <mkdir dir="${build.path}" />
++ </target>
++
++ <target name="build" depends="init">
++ <echo>+-------------------------------------------------+</echo>
++ <echo>| B U I L D I N G P L U G I N |</echo>
++ <echo>+-------------------------------------------------+</echo>
++
++ <javac srcdir="${build.src.path}" destdir="${build.path}" debug="false" >
++ <classpath refid="class.path"/>
++ <include name="**/*.java"/>
++ </javac>
++
++ <echo>+-----------------------------------------------+</echo>
++ <echo>| P A C K A G I N G P L U G I N |</echo>
++ <echo>+-----------------------------------------------+</echo>
++
++ <jar destfile="${build.jar}" basedir="${build.path}" />
++ <delete quiet="true" dir="${build.path}" />
++ </target>
++
++ <target name="clean">
++ <delete quiet="true" dir="${build.path}" />
++ <delete quiet="true" file="${build.jar}" />
++ </target>
++
++ <target name="all" depends="build" />
++</project>
+diff -purN a/TuxGuitar-editor-utils/build.properties b/TuxGuitar-editor-utils/build.properties
+--- a/TuxGuitar-editor-utils/build.properties 1970-01-01 01:00:00.000000000 +0100
++++ b/TuxGuitar-editor-utils/build.properties 2016-08-23 08:46:42.164749665 +0100
+@@ -0,0 +1,7 @@
++### ANT Flags
++#
++# build.compiler=gcj
++ant.build.javac.source=1.5
++ant.build.javac.target=1.5
++
++path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
+diff -purN a/TuxGuitar-editor-utils/build.xml b/TuxGuitar-editor-utils/build.xml
+--- a/TuxGuitar-editor-utils/build.xml 1970-01-01 01:00:00.000000000 +0100
++++ b/TuxGuitar-editor-utils/build.xml 2016-08-23 10:51:44.533478977 +0100
+@@ -0,0 +1,45 @@
++<?xml version="1.0" encoding="iso-8859-1"?>
++
++<project name="TuxGuitar-editor-utils" basedir="." default="all">
++ <description>
++ TuxGuitar Editor Utils
++ </description>
++
++ <property file="build.properties" />
++ <property name="build.src.path" value="src" />
++ <property name="build.path" value="build" />
++ <property name="build.jar" value="tuxguitar-editor-utils.jar" />
++
++ <path id="class.path">
++ <pathelement location="${path.tuxguitar-lib}"/>
++ </path >
++
++ <target name="init" depends="clean">
++ <mkdir dir="${build.path}" />
++ </target>
++
++ <target name="build" depends="init">
++ <echo>+-------------------------------------------------+</echo>
++ <echo>| B U I L D I N G L I B R A R Y |</echo>
++ <echo>+-------------------------------------------------+</echo>
++
++ <javac srcdir="${build.src.path}" destdir="${build.path}" debug="false" >
++ <classpath refid="class.path"/>
++ <include name="**/*.java"/>
++ </javac>
++
++ <echo>+-----------------------------------------------+</echo>
++ <echo>| P A C K A G I N G L I B R A R Y |</echo>
++ <echo>+-----------------------------------------------+</echo>
++
++ <jar destfile="${build.jar}" basedir="${build.path}" />
++ <delete quiet="true" dir="${build.path}" />
++ </target>
++
++ <target name="clean">
++ <delete quiet="true" dir="${build.path}" />
++ <delete quiet="true" file="${build.jar}" />
++ </target>
++
++ <target name="all" depends="build" />
++</project>
+diff -purN a/TuxGuitar-gtp-ui/build.xml b/TuxGuitar-gtp-ui/build.xml
+--- a/TuxGuitar-gtp-ui/build.xml 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-gtp-ui/build.xml 2016-08-23 15:21:38.068032721 +0100
+@@ -9,7 +9,7 @@
+ <property name="build.src.path" value="src${file.separator}" />
+ <property name="build.share.path" value="share${file.separator}" />
+ <property name="build.path" value="build${file.separator}" />
+- <property name="build.jar" value="tuxguitar-gtp.jar" />
++ <property name="build.jar" value="tuxguitar-gtp-ui.jar" />
+
+ <path id="class.path">
+ <pathelement location="${path.tuxguitar-lib}"/>
+diff -purN a/TuxGuitar-jsa/build.properties b/TuxGuitar-jsa/build.properties
+--- a/TuxGuitar-jsa/build.properties 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-jsa/build.properties 2016-08-23 12:45:00.324325595 +0100
+@@ -7,4 +7,5 @@ ant.build.javac.target=1.5
+ path.tuxguitar=../TuxGuitar/tuxguitar.jar
+ path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
+ path.tuxguitar-gm-utils=../TuxGuitar-gm-utils/tuxguitar-gm-utils.jar
++path.tuxguitar-editor-utils=../TuxGuitar-editor-utils/tuxguitar-editor-utils.jar
+ path.swt=../TuxGuitar/lib/swt.jar
+diff -purN a/TuxGuitar-jsa/build.xml b/TuxGuitar-jsa/build.xml
+--- a/TuxGuitar-jsa/build.xml 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-jsa/build.xml 2016-08-23 12:46:07.932440095 +0100
+@@ -14,6 +14,7 @@
+ <path id="class.path">
+ <pathelement location="${path.tuxguitar-lib}"/>
+ <pathelement location="${path.tuxguitar-gm-utils}"/>
++ <pathelement location="${path.tuxguitar-editor-utils}"/>
+ <pathelement location="${path.tuxguitar}"/>
+ <pathelement location="${path.swt}"/>
+ </path >
+diff -purN a/TuxGuitar-pdf/build.properties b/TuxGuitar-pdf/build.properties
+--- a/TuxGuitar-pdf/build.properties 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-pdf/build.properties 2016-08-23 13:37:17.230856507 +0100
+@@ -7,5 +7,7 @@ ant.build.javac.target=1.5
+ path.tuxguitar=../TuxGuitar/tuxguitar.jar
+ path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
+ path.tuxguitar-gm-utils=../TuxGuitar-gm-utils/tuxguitar-gm-utils.jar
++path.tuxguitar-editor-utils=../TuxGuitar-editor-utils/tuxguitar-editor-utils.jar
++path.tuxguitar-awt-graphics=../TuxGuitar-awt-graphics/tuxguitar-awt-graphics.jar
+ path.itext=../TuxGuitar/lib/itext.jar
+ path.swt=../TuxGuitar/lib/swt.jar
+diff -purN a/TuxGuitar-pdf/build.xml b/TuxGuitar-pdf/build.xml
+--- a/TuxGuitar-pdf/build.xml 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-pdf/build.xml 2016-08-23 13:37:40.843895665 +0100
+@@ -17,6 +17,8 @@
+ <pathelement location="${path.tuxguitar}"/>
+ <pathelement location="${path.tuxguitar-lib}"/>
+ <pathelement location="${path.tuxguitar-gm-utils}"/>
++ <pathelement location="${path.tuxguitar-editor-utils}"/>
++ <pathelement location="${path.tuxguitar-awt-graphics}"/>
+ </path >
+
+ <target name="init" depends="clean">
+diff -purN a/TuxGuitar-tray/build.properties b/TuxGuitar-tray/build.properties
+--- a/TuxGuitar-tray/build.properties 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-tray/build.properties 2016-08-23 13:41:10.241259782 +0100
+@@ -6,4 +6,6 @@ ant.build.javac.target=1.5
+
+ path.tuxguitar=../TuxGuitar/tuxguitar.jar
+ path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
++path.tuxguitar-gm-utils=../TuxGuitar-gm-utils/tuxguitar-gm-utils.jar
++path.tuxguitar-editor-utils=../TuxGuitar-editor-utils/tuxguitar-editor-utils.jar
+ path.swt=../TuxGuitar/lib/swt.jar
+diff -purN a/TuxGuitar-tray/build.xml b/TuxGuitar-tray/build.xml
+--- a/TuxGuitar-tray/build.xml 2016-03-16 21:26:23.000000000 +0000
++++ b/TuxGuitar-tray/build.xml 2016-08-23 13:41:41.262315895 +0100
+@@ -15,6 +15,8 @@
+ <property name="service.provider" value="org.herac.tuxguitar.tray.TGTrayPlugin" />
+
+ <path id="class.path">
++ <pathelement location="${path.tuxguitar-editor-utils}"/>
++ <pathelement location="${path.tuxguitar-gm-utils}"/>
+ <pathelement location="${path.tuxguitar-lib}"/>
+ <pathelement location="${path.tuxguitar}"/>
+ <pathelement location="${path.swt}"/>
+diff -purN a/TuxGuitar-tuner/build.properties b/TuxGuitar-tuner/build.properties
+--- a/TuxGuitar-tuner/build.properties 2016-03-16 21:26:14.000000000 +0000
++++ b/TuxGuitar-tuner/build.properties 2016-08-23 13:42:25.501396719 +0100
+@@ -6,4 +6,5 @@ ant.build.javac.target=1.5
+
+ path.tuxguitar=../TuxGuitar/tuxguitar.jar
+ path.tuxguitar-lib=../TuxGuitar-lib/tuxguitar-lib.jar
++path.tuxguitar-gm-utils=../TuxGuitar-gm-utils/tuxguitar-gm-utils.jar
+ path.swt=../TuxGuitar/lib/swt.jar
+diff -purN a/TuxGuitar-tuner/build.xml b/TuxGuitar-tuner/build.xml
+--- a/TuxGuitar-tuner/build.xml 2016-03-16 21:26:14.000000000 +0000
++++ b/TuxGuitar-tuner/build.xml 2016-08-23 13:42:50.180442190 +0100
+@@ -12,6 +12,7 @@
+ <property name="build.jar" value="tuxguitar-tuner.jar" />
+
+ <path id="class.path">
++ <pathelement location="${path.tuxguitar-gm-utils}"/>
+ <pathelement location="${path.tuxguitar-lib}"/>
+ <pathelement location="${path.tuxguitar}"/>
+ <pathelement location="${path.swt}"/>
--- /dev/null
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $id$
+
+EAPI="6"
+JAVA_PKG_IUSE="source"
+
+inherit eutils java-pkg-2 java-ant-2 toolchain-funcs flag-o-matic fdo-mime gnome2-utils
+
+MY_P="${P}-src"
+DESCRIPTION="TuxGuitar is a multitrack guitar tablature editor and player written in Java-SWT"
+HOMEPAGE="http://tuxguitar.herac.com.ar/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+LICENSE="LGPL-2.1"
+SLOT="0"
+
+IUSE="alsa fluidsynth jack lilypond oss pdf timidity tray"
+
+KEYWORDS="~amd64 ~x86"
+
+CDEPEND="dev-java/swt:3.7[cairo]
+ alsa? ( media-libs/alsa-lib )
+ pdf? ( dev-java/itext:5 )
+ fluidsynth? ( media-sound/fluidsynth )
+ lilypond? ( media-sound/lilypond )"
+
+RDEPEND=">=virtual/jre-1.5
+ timidity? ( media-sound/timidity++[alsa?,oss?] )
+ ${CDEPEND}"
+
+DEPEND=">=virtual/jdk-1.5
+ ${CDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=( "${FILESDIR}"/${PN}-fixed-ant-files.patch )
+
+LIBRARY_LIST=()
+PLUGIN_LIST=()
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ default_src_prepare
+
+ sed -e "s|../TuxGuitar/lib/swt.jar|$(java-pkg_getjar swt-3.7 swt.jar)|" \
+ -i TuxGuitar*/build.properties || die "sed TuxGuitar*/build.properties failed"
+
+ if use pdf; then
+ sed -e "s|../TuxGuitar/lib/itext.jar|$(java-pkg_getjar itext-5 itext.jar)|" \
+ -i TuxGuitar-pdf/build.properties || die "sed TuxGuitar-pdf/build.properties failed"
+ fi
+
+ LIBRARY_LIST=( TuxGuitar-lib TuxGuitar-awt-graphics TuxGuitar-editor-utils
+ TuxGuitar-gm-utils TuxGuitar
+ )
+
+ PLUGIN_LIST=( $(usev alsa) ascii browser-ftp community compat
+ converter $(usev fluidsynth) gm-settings gpx gtp gtp-ui image
+ $(usev jack) $(usex jack jack-ui "") jsa $(usev lilypond) midi
+ musicxml $(usev oss) $(usev pdf) ptb svg tef $(usev tray) tuner
+ )
+}
+
+src_compile() {
+ local build_order=( ${LIBRARY_LIST[@]} ${PLUGIN_LIST[@]/#/TuxGuitar-} )
+ local directory
+
+ for directory in ${build_order[@]}; do
+ cd "${S}"/${directory} || die "cd ${directory} failed"
+ eant
+ if [[ -d jni ]]; then
+ append-flags -fPIC $(java-pkg_get-jni-cflags)
+ CC=$(tc-getCC) emake -C jni
+ fi
+ done
+}
+
+src_install() {
+ local tuxguitar_inst_path="/usr/share/${PN}"
+ local library
+ local plugin
+
+ for library in ${LIBRARY_LIST[@]}; do
+ cd "${S}"/${library} || die "cd ${library} failed"
+ java-pkg_dojar ${library,,}.jar
+ use source && java-pkg_dosrc src/org
+ done
+
+ java-pkg_dolauncher ${PN} \
+ --main org.herac.tuxguitar.app.TGMainSingleton \
+ --java_args "-Xmx512m -Dtuxguitar.share.path=${tuxguitar_inst_path}/share"
+
+ # Images and Files
+ insinto ${tuxguitar_inst_path}
+ doins -r share
+
+ java-pkg_sointo ${tuxguitar_inst_path}/lib
+ insinto ${tuxguitar_inst_path}/share/plugins
+ for plugin in ${PLUGIN_LIST[@]/#/TuxGuitar-}; do
+ cd "${S}"/${plugin} || die "cd ${plugin} failed"
+ doins ${plugin,,}.jar
+
+ #TuxGuitar has its own classloader. No need to register the plugins.
+ if [[ -d jni ]]; then
+ java-pkg_doso jni/lib${plugin,,}-jni.so
+ fi
+ done
+
+ insinto ${tuxguitar_inst_path}/share
+ doins -r "${S}"/TuxGuitar-resources/resources/soundfont
+ doman "${S}/misc/${PN}.1"
+ insinto /usr/share/mime/packages
+ doins "${S}/misc/${PN}.xml"
+ doicon "${S}/misc/${PN}.xpm"
+ domenu "${S}/misc/${PN}.desktop"
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ gnome2_icon_cache_update
+ if use fluidsynth; then
+ ewarn "Fluidsynth plugin blocks behavior of JSA plugin."
+ ewarn "Enable only one of them in \"Tools > Plugins\""
+ fi
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+ gnome2_icon_cache_update
+}