parlay

yet another gentoo overlay
git clone https://git.parazyd.org/parlay
Log | Files | Refs | README

tuxguitar-1.5.1.ebuild (3569B)


      1 # Copyright 1999-2017 Gentoo Foundation
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI="6"
      5 JAVA_PKG_IUSE="source"
      6 
      7 inherit eutils java-pkg-2 java-ant-2 toolchain-funcs flag-o-matic gnome2-utils
      8 
      9 MY_P="${P}-src"
     10 DESCRIPTION="TuxGuitar is a multitrack guitar tablature editor and player written in Java-SWT"
     11 HOMEPAGE="http://tuxguitar.herac.com.ar/"
     12 SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
     13 LICENSE="LGPL-2.1"
     14 SLOT="0"
     15 
     16 IUSE="alsa fluidsynth jack lilypond oss pdf timidity tray"
     17 
     18 KEYWORDS="~amd64 ~x86"
     19 
     20 CDEPEND="dev-java/swt:3.7[cairo]
     21 	dev-java/commons-compress
     22 	alsa? ( media-libs/alsa-lib )
     23 	pdf? ( dev-java/itext:5 )
     24 	fluidsynth? ( media-sound/fluidsynth )
     25 	lilypond? ( media-sound/lilypond )"
     26 
     27 RDEPEND=">=virtual/jre-1.5
     28 	timidity? ( media-sound/timidity++[alsa?,oss?] )
     29 	${CDEPEND}"
     30 
     31 DEPEND=">=virtual/jdk-1.5
     32 	${CDEPEND}"
     33 
     34 S="${WORKDIR}/${MY_P}"
     35 
     36 PATCHES=(
     37 	"${FILESDIR}/${P}.patch"
     38 )
     39 
     40 LIBRARY_LIST=()
     41 PLUGIN_LIST=()
     42 
     43 src_prepare() {
     44 	default_src_prepare
     45 	java-pkg-2_src_prepare
     46 	java-ant-2_src_configure
     47 
     48 	sed -e "s|../TuxGuitar/lib/swt.jar|$(java-pkg_getjar swt-3.7 swt.jar)|" \
     49 		-i TuxGuitar*/build.properties || die "sed TuxGuitar*/build.properties failed"
     50 
     51 	if use pdf; then
     52 		sed -e "s|../TuxGuitar/lib/itext.jar|$(java-pkg_getjar itext-5 itext.jar)|" \
     53 		-i TuxGuitar-pdf/build.properties || die "sed TuxGuitar-pdf/build.properties failed"
     54 	fi
     55 
     56 	LIBRARY_LIST=(
     57 		TuxGuitar-lib
     58 		TuxGuitar-editor-utils
     59 		TuxGuitar-gm-utils
     60 		TuxGuitar-ui-toolkit
     61 		TuxGuitar-ui-toolkit-swt
     62 		TuxGuitar
     63 	)
     64 
     65 	PLUGIN_LIST=( $(usev alsa) ascii browser-ftp community compat
     66 		converter $(usev fluidsynth) gm-settings gpx gtp gtp-ui image
     67 		$(usev jack) $(usex jack jack-ui "") jsa $(usev lilypond) midi
     68 		musicxml $(usev oss) $(usev pdf) ptb svg tef $(usev tray) tuner
     69 	)
     70 }
     71 
     72 src_compile() {
     73 	local build_order=( ${LIBRARY_LIST[@]} ${PLUGIN_LIST[@]/#/TuxGuitar-} )
     74 	local directory
     75 
     76 	append-flags -fPIC $(java-pkg_get-jni-cflags)
     77 
     78 	for directory in ${build_order[@]}; do
     79 		cd "${S}"/${directory} || die "cd ${directory} failed"
     80 
     81 		#java-ant_rewrite-classpath
     82 		eant
     83 
     84 		if [[ -d jni ]]; then
     85 			CC=$(tc-getCC) emake -C jni
     86 		fi
     87 	done
     88 }
     89 
     90 src_install() {
     91 	local tuxguitar_inst_path="/usr/share/${PN}"
     92 	local library
     93 	local plugin
     94 
     95 	for library in ${LIBRARY_LIST[@]}; do
     96 		cd "${S}"/${library} || die "cd ${library} failed"
     97 		java-pkg_dojar ${library,,}.jar
     98 		use source && java-pkg_dosrc src/org
     99 	done
    100 
    101 	java-pkg_dolauncher ${PN} \
    102 		--main org.herac.tuxguitar.app.TGMainSingleton \
    103 		--java_args "-Xmx512m  -Dtuxguitar.share.path=${tuxguitar_inst_path}/share"
    104 
    105 	# Images and Files
    106 	insinto ${tuxguitar_inst_path}
    107 	doins -r share
    108 
    109 	java-pkg_sointo ${tuxguitar_inst_path}/lib
    110 	insinto ${tuxguitar_inst_path}/share/plugins
    111 	for plugin in ${PLUGIN_LIST[@]/#/TuxGuitar-}; do
    112 		cd "${S}"/${plugin} || die "cd ${plugin} failed"
    113 		doins ${plugin,,}.jar
    114 
    115 		#TuxGuitar has its own classloader. No need to register the plugins.
    116 		if [[ -d jni ]]; then
    117 			java-pkg_doso jni/lib${plugin,,}-jni.so
    118 		fi
    119 	done
    120 
    121 	insinto ${tuxguitar_inst_path}/share
    122 	doins -r "${S}"/TuxGuitar-resources/resources/soundfont
    123 	doman "${S}/misc/${PN}.1"
    124 	insinto /usr/share/mime/packages
    125 	doins "${S}/misc/${PN}.xml"
    126 	doicon "${S}/misc/${PN}.xpm"
    127 	domenu "${S}/misc/${PN}.desktop"
    128 }
    129 
    130 pkg_postinst() {
    131 	xdg_mimeinfo_database_update
    132 	gnome2_icon_cache_update
    133 
    134 	if use fluidsynth; then
    135 		ewarn "Fluidsynth plugin blocks behavior of JSA plugin."
    136 		ewarn "Enable only one of them in \"Tools > Plugins\""
    137 	fi
    138 }
    139 
    140 pkg_postrm() {
    141 	xdg_mimeinfo_database_update
    142 	gnome2_icon_cache_update
    143 }