summaryrefslogtreecommitdiff
path: root/audio/tuxguitar/Makefile
blob: 8d41255f24c2fe9dbd74a40a19c21cb2aeeffd8c (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Created by: Pietro Cerutti (gahr@gahr.ch)
# $FreeBSD$

PORTNAME=	tuxguitar
PORTVERSION=	1.2
PORTREVISION=	9
CATEGORIES=	audio java
MASTER_SITES=	SF/${PORTNAME}/TuxGuitar/TuxGuitar-${PORTVERSION}:src \
		LOCAL/gahr/:fluid \
		http://people.freebsd.org/~gahr/distfiles/:fluid \
		http://www.alsa-project.org/~james/sound-fonts/:fluid
DISTNAME=	${PORTNAME}-src-${DISTVERSION}
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:src \
		8MBGMSFX.SF2:fluid
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Multitrack tablature editor and player

LICENSE=	LGPL21

BUILD_DEPENDS=	${JAVALIBDIR}/swt-devel.jar:${PORTSDIR}/x11-toolkits/swt-devel \
		${JAVALIBDIR}/itext.jar:${PORTSDIR}/devel/itext \
		${JAVALIBDIR}/gervill.jar:${PORTSDIR}/audio/gervill
RUN_DEPENDS:=	${BUILD_DEPENDS}
LIB_DEPENDS=	libfluidsynth.so:${PORTSDIR}/audio/fluidsynth \
		libjack.so:${PORTSDIR}/audio/jack

MAKE_ENV+=	PREFIX=${PREFIX} INSTALL_DOC_DIR=${DOCSDIR} \
		INSTALL_SHARE_DIR=${DATADIR}

USES=		desktop-file-utils gmake pkgconfig
USE_JAVA=	yes
USE_ANT=	yes
WITH_GECKO=	libxul
USE_LDCONFIG=	yes
JAVA_VERSION=	1.6+
NOCCACHE=	yes

WRKSRC_SUBDIR=	TuxGuitar

OPTIONS_DEFINE=	DOCS

.include <bsd.port.pre.mk>
PLUGINS=	ascii browser-ftp compat converter fluidsynth gervill gtp \
		jsa lilypond midi musicxml oss pdf ptb tef tray tuner

SUB_FILES=	tuxguitar
SUB_LIST=	DATADIR=${DATADIR} \
		PREFIX=${PREFIX} \
		JAVALIBDIR=${JAVALIBDIR} \
		GECKO=${GECKO:S/19//}

post-extract:
	${CP} ${DISTDIR}/8MBGMSFX.SF2 ${WRKDIR}

post-patch:
	${FIND} ${WRKSRC}/.. -name build.properties | ${XARGS} ${REINPLACE_CMD} -e '\
	    s|path\.swt=.*|path.swt=${JAVAJARDIR}/swt-devel.jar|; \
	    s|path\.itext=.*|path.itext=${JAVAJARDIR}/itext.jar|; \
	    s|path\.gervill=.*|path.gervill=${JAVAJARDIR}/gervill.jar|'
	${FIND} ${WRKSRC}/.. -name GNUmakefile | ${XARGS} ${REINPLACE_CMD} -e '\
	    s|-I$$(shell gcj -print-file-name=include/)|-I${JAVA_HOME}/include \
	    -I${JAVA_HOME}/include/freebsd -I${LOCALBASE}/include|; \
	    s|-I $$(shell $$(GCJ) -print-file-name=include/)|-I${JAVA_HOME}/include \
	    -I${JAVA_HOME}/include/freebsd -I${LOCALBASE}/include|; \
	    s|LDFLAGS\?=.*|LDFLAGS+=-L${LOCALBASE}/lib|; \
	    s|CFLAGS\?=|CFLAGS+=|'
	${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g; \
	    s|%%PREFIX%%|${PREFIX}|g; \
	    s|%%JAVAJARDIR%%|${JAVAJARDIR}|g; \
	    s|%%JAVASHAREDIR%%|${JAVASHAREDIR}|g; \
	    s|%%DATADIR%%|${DATADIR}|g; \
	    s|%%DOCSDIR%%|${DOCSDIR}|g' \
	    ${WRKSRC}/build.properties

post-build:
.for p in ${PLUGINS}
	(cd ${WRKSRC}/../TuxGuitar-${p}; \
	    ${SETENV} ${MAKE_ENV} ${ANT} ${MAKE_ARGS} ${ALL_TARGET})
.endfor
	cd ${WRKSRC}/../TuxGuitar-oss/jni && ${SETENV} ${MAKE_ENV} ${MAKE_CMD}
	cd ${WRKSRC}/../TuxGuitar-fluidsynth/jni && ${SETENV} ${MAKE_ENV} ${MAKE_CMD}
	cd ${WRKSRC}/../TuxGuitar-jack/jni && ${SETENV} ${MAKE_ENV} ${MAKE_CMD}

do-install:
	@${INSTALL} -d ${STAGEDIR}${DATADIR}
	@${INSTALL} -d ${STAGEDIR}${DATADIR}/plugins
	# Main program and plugins
	${INSTALL_SCRIPT} ${WRKDIR}/tuxguitar ${STAGEDIR}${PREFIX}/bin
	${INSTALL_DATA} ${WRKSRC}/tuxguitar.jar ${STAGEDIR}${DATADIR}
	${INSTALL_DATA} ${WRKSRC}/../misc/*.tg ${STAGEDIR}${DATADIR}
	${INSTALL_DATA} ${WRKDIR}/8MBGMSFX.SF2 ${STAGEDIR}${DATADIR}
	${INSTALL_PROGRAM} ${WRKSRC}/../TuxGuitar-oss/jni/libtuxguitar-oss-jni.so ${STAGEDIR}${PREFIX}/lib
	${INSTALL_PROGRAM} ${WRKSRC}/../TuxGuitar-fluidsynth/jni/libtuxguitar-fluidsynth-jni.so ${STAGEDIR}${PREFIX}/lib
.for p in ${PLUGINS}
	${INSTALL_DATA} ${WRKSRC}/../TuxGuitar-${p}/tuxguitar-${p}.jar ${STAGEDIR}${DATADIR}/plugins
.endfor
	# Inline documentation
	cd ${WRKSRC}/share/help &&   ${COPYTREE_SHARE} \* ${STAGEDIR}${DATADIR}/help
	cd ${WRKSRC}/share/lang &&   ${COPYTREE_SHARE} \* ${STAGEDIR}${DATADIR}/lang
	cd ${WRKSRC}/share/scales && ${COPYTREE_SHARE} \* ${STAGEDIR}${DATADIR}/scales
	cd ${WRKSRC}/share/skins &&  ${COPYTREE_SHARE} \* ${STAGEDIR}${DATADIR}/skins

	# XPM icon
	@${INSTALL} -d ${STAGEDIR}${PREFIX}/share/pixmaps
	${INSTALL_DATA} ${WRKSRC}/../misc/tuxguitar.xpm ${STAGEDIR}${PREFIX}/share/pixmaps

	# Desktop entry
	@${INSTALL} -d ${PREFIX}/share/applications
	${INSTALL_DATA} ${WRKSRC}/../misc/tuxguitar.desktop ${STAGEDIR}${PREFIX}/share/applications

	# MAN page
	${INSTALL_MAN} ${WRKSRC}/../misc/tuxguitar.1 ${STAGEDIR}${PREFIX}/man/man1

post-install:
.if ${PORT_OPTIONS:MDOCS}
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	cd ${WRKSRC}/doc && ${COPYTREE_SHARE} \* ${STAGEDIR}${DOCSDIR}
.endif
	@${ECHO}
	@${ECHO} "SoundFonts for the FluidSynth plugin are available at:"
	@${ECHO} "${DATADIR}/8MBGMSFX.SF2"
	@${ECHO} "Add this path in the FluidSynth plugin configuration to"
	@${ECHO} "enable them."
	@${ECHO}

.include <bsd.port.post.mk>