# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils fdo-mime flag-o-matic toolchain-funcs IUSE="java" INSTDIR="/usr/share/mecat" DESCRIPTION="MeCat - Media Catalog, catalog for dvd, cd, vhs, books,..." SRC_URI="mirror://sourceforge/${PN}/${P}-src.tar.gz" HOMEPAGE="http://mecat.sourceforge.net/" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" RDEPEND="java? ( >=virtual/jre-1.5.0 ) dev-java/xerces virtual/tetex" DEPEND="java? ( >=virtual/jdk-1.5.0 ) dev-java/ant" pkg_setup() { if [ -z "${JDK_HOME}" ] || [ ! -d "${JDK_HOME}" ] then eerror "In order to compile java sources you have to set the" eerror "\$JDK_HOME environment properly." eerror "" eerror "You can achieve this by using the java-config tool:" eerror " emerge java-config" die "Couldn't find a valid JDK home" fi } src_unpack() { unpack "${A}" einfo "Use patch for MeCat to work with Gentoo and Java 5.0" cd "${S}" epatch "${FILESDIR}/mecat-1.0-gentoo.patch" } src_compile() { # MeCat needs Java 5.0, but it is not necessary to # set the Java 5.0 through java-config. einfo "Change to Java 5.0 for compiling MeCat" for n in /etc/env.d/java/20sun-*-1.5*; do . $n; done einfo "Change to directory ${S}" cd "${S}" ant || die "Couldn't compile the source maybe wrong java version" } src_install() { einfo "Installing MeCat into ${INSTDIR}..." dodir "${INSTDIR}"; insinto "${INSTDIR}"; exeinto "${INSTDIR}" doins "dist/${P}.jar" || die "Couldn't install dist/${P}" doexe "dist/MeCat" || die "Couldn't install startup script" dodir "/usr/bin" dosym "${D}${INSTDIR}/MeCat" "usr/bin/MeCat" || die "Couldn't link startup script" } pkg_postinst() { einfo " To start MeCat, run:" einfo einfo " $ MeCat" einfo }