aboutsummaryrefslogtreecommitdiffstats
path: root/www/subsonic/Makefile
blob: 3dfb752536bfd1b83b77cba1886befa8791ef7fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Created by: Nicole Reid <root@cooltrainer.org>
# $FreeBSD$

PORTNAME=   subsonic
PORTVERSION=    4.7
CATEGORIES= www java
MASTER_SITES=   SF
DISTNAME=   ${PORTNAME}-${PORTVERSION}-war

MAINTAINER= root@cooltrainer.org
COMMENT=    Subsonic streaming media server

BUILD_DEPENDS+= ${LOCALBASE}/apache-tomcat-6.0:${PORTSDIR}/www/tomcat6
RUN_DEPENDS+=   ${JAVAJARDIR}/servlet-api.jar:${PORTSDIR}/www/servlet-api

OPTIONS=    TRANSCODING "Enable transcoding with FFmpeg and LAME"   On

.include <bsd.port.options.mk>

.if defined(WITH_TRANSCODING)
RUN_DEPENDS+=   ffmpeg:${PORTSDIR}/multimedia/ffmpeg \
        lame:${PORTSDIR}/audio/lame
.endif

#Subsonic does not currently run on Tomcat 7
SUB_FILES=  pkg-message
.if exists(${LOCALBASE}/apache-tomcat-6.0/webapps)
WEBAPPDIR=  ${PREFIX}/apache-tomcat-6.0/webapps
BUILD_DEPENDS+= ${LOCALBASE}/apache-tomcat-6.0/bin/bootstrap.jar:${PORTSDIR}/www/tomcat6
RUN_DEPENDS+=   ${LOCALBASE}/apache-tomcat-6.0/bin/bootstrap.jar:${PORTSDIR}/www/tomcat6
SUB_LIST=   TOMCATOPTS="tomcat60_java_opts"
.elif exists(${LOCALBASE}/tomcat5.5/webapps)
WEBAPPDIR=  ${PREFIX}/tomcat5.5/webapps
BUILD_DEPENDS+= ${LOCALBASE}/tomcat5.5/bin/bootstrap.jar:${PORTSDIR}/www/tomcat55
RUN_DEPENDS+=   ${LOCALBASE}/tomcat5.5/bin/bootstrap.jar:${PORTSDIR}/www/tomcat55
SUB_LIST=   TOMCATOPTS="tomcat55_java_opts"
.else
WEBAPPDIR=  ${PREFIX}/apache-tomcat-6.0/webapps
BUILD_DEPENDS+= ${LOCALBASE}/apache-tomcat-6.0/bin/bootstrap.jar:${PORTSDIR}/www/tomcat6
RUN_DEPENDS+=   ${LOCALBASE}/apache-tomcat-6.0/bin/bootstrap.jar:${PORTSDIR}/www/tomcat6
SUB_LIST=   TOMCATOPTS="tomcat60_java_opts"
.endif

NO_BUILD=   yes
USE_JAVA=   yes
JAVA_VERSION=   1.6+
USE_ZIP=    yes
USER=       www
GROUP=      www
SUBSONIC_HOME=  /var/subsonic
PLIST_SUB+= SUBSONIC_HOME="${SUBSONIC_HOME}"

.if defined(WITH_TRANSCODING)
PLIST_SUB+= TRANSCODING=""
.else
PLIST_SUB+= TRANSCODING="@comment "
.endif

PLIST_SUB+= WEBAPPS=${WEBAPPDIR:S|^${PREFIX}/||}

do-install:
    ${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.war ${WEBAPPDIR}
    @${MKDIR} ${SUBSONIC_HOME}
    @${CHOWN} ${USER}:${GROUP} ${SUBSONIC_HOME}

post-install:
.if defined(WITH_TRANSCODING)
    @${MKDIR} ${SUBSONIC_HOME}/transcode
    @${LN} -sf ${PREFIX}/bin/ffmpeg ${SUBSONIC_HOME}/transcode/ffmpeg
    @${LN} -sf ${PREFIX}/bin/lame ${SUBSONIC_HOME}/transcode/lame
.endif
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>