EAPI=5
inherit eutils user subversion
DESCRIPTION="A free, open source, web-based media server in Java."
HOMEPAGE="http://www.subsonic.org"
ESVN_REPO_URI="svn://svn.code.sf.net/p/subsonic/code/tags/release-${PV}"
ESVN_PROJECT="${PN}"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="no-license"
DEPEND=""
RDEPEND="virtual/jre
media-sound/lame
virtual/ffmpeg"
INSTALL_BASE="/opt/${PN}"
S="${WORKDIR}"
SUBSONIC_HOME="/var/${PN}"
SUBSONIC_USER="subsonic"
pkg_preinst() {
ebegin "Creating ${UG} user"
enewuser "${SUBSONIC_USER}" -1 -1 "${SUBSONIC_HOME}" audio
fowners ${SUBSONIC_USER}:audio ${SUBSONIC_HOME}
}
src_prepare() {
use no-license && epatch "${FILESDIR}"/no-license.patch
epatch "${FILESDIR}"/no-installers.patch
}
src_compile() {
mkdir "${T}"/maven || die "Can't make tempdir"
cat /usr/share/$(readlink /usr/bin/mvn | sed 's:mvn:maven-bin:')/conf/settings.xml | \
sed -e 's:/path/to/local/repo:'"${T}"/maven':g' \
-e 's:<!-- localRepository::' >"${T}"/settings.xml
addpredict / # bad bad bad
mvn -s "${T}"/settings.xml -P full package || die "Maven failed"
}
src_install() {
dodoc subsonic-main/README.TXT
dohtml subsonic-main/"Getting Started.html"
insinto ${INSTALL_BASE}
doins subsonic-booter/target/subsonic-booter-jar-with-dependencies.jar
doins subsonic-main/target/subsonic.war
exeinto ${INSTALL_BASE}
doexe subsonic-booter/src/main/script/subsonic.sh
dodir ${SUBSONIC_HOME}
newinitd "${FILESDIR}/subsonic.initd" subsonic
newconfd "${FILESDIR}/subsonic.confd" subsonic
dosym ${INSTALL_BASE}/subsonic.sh /opt/bin/subsonic
}