aboutsummaryrefslogtreecommitdiffstats
path: root/audio/csound/Makefile
blob: 8456395c3cc3350b55ba3775c2eb77613b144b89 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Created by: trevor
# $FreeBSD$

PORTNAME=   csound
PORTVERSION=    5.18.02
CATEGORIES= audio lang
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}5/${PORTNAME}5.18/ \
        SF/${PORTNAME}/${PORTNAME}5/${PORTNAME}${PORTVERSION:R}/manual:manual
DISTNAME=   ${PORTNAME:S/c/C/}${PORTVERSION}
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= c.petrik.sosa@gmail.com
COMMENT=    Sound synthesizer

LICENSE=    LGPL21
LICENSE_FILE=   ${WRKSRC}/COPYING

DIST_SUBDIR=    csound
BUILD_DEPENDS=  ${LOCALBASE}/bin/swig:${PORTSDIR}/devel/swig13 \
        ${LOCALBASE}/include/gmm/gmm.h:${PORTSDIR}/math/gmm++ \
        ${LOCALBASE}/bin/flex:${PORTSDIR}/textproc/flex
LIB_DEPENDS=    sndfile:${PORTSDIR}/audio/libsndfile

OPTIONS_DEFINE= ALSA DSSI FLUIDSYNTH JACK OSC PORTAUDIO PULSEAUDIO FLTK
OPTIONS_DEFAULT=FLTK
ALSA_DESC=  Build ALSA I/O module
DSSI_DESC=  Build DSSI/LADSPA host opcodes
FLUIDSYNTH_DESC=Building FluidSynth opcodes
JACK_DESC=  Build Jack I/O module and opcodes
OSC_DESC=   Build OSC opcodes
PORTAUDIO_DESC= Build the PortAudio I/O module
PULSEAUDIO_DESC=Build the PulseAudio I/O module
FLTK_DESC=  Build FLTK plugin and GUI

CONFLICTS_INSTALL=  outguess-*

SSP_UNSAFE= yes
USE_PYTHON= 2.6+
USES=       bison gettext
USE_SCONS=  yes
SCONS_BUILDENV= PATH=${LOCALBASE}/bin:$$PATH
SCONS_ARGS= prefix="${PREFIX}" CC="${CC}" CXX="${CXX}" \
        CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
        buildCsoundAC=0 buildCsoundVST=0 buildInterfaces=1 \
        buildRelease=1 buildVirtual=1 dynamicCsoundLibrary=1 \
        install=1 noDebug=1 useDouble=1 \
        useGettext=1 usePortMIDI=0
USE_LDCONFIG=   yes

SUB_FILES=  pkg-message

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MALSA}
LIB_DEPENDS+=   asound:${PORTSDIR}/audio/alsa-lib
SCONS_ARGS+=    useALSA=1
PLIST_SUB+= ALSA=""
ALSA_H=     alsa/asoundlib.h
.else
SCONS_ARGS+=    useALSA=0
PLIST_SUB+= ALSA="@comment "
ALSA_H=     ##alsa/asoundlib.h##
.endif

.if ${PORT_OPTIONS:MDSSI}
BUILD_DEPENDS+= dssi>=0:${PORTSDIR}/audio/dssi
RUN_DEPENDS+=   dssi>=0:${PORTSDIR}/audio/dssi
SCONS_ARGS+=    buildDSSI=1
PLIST_SUB+= DSSI=""
.else
SCONS_ARGS+=    buildDSSI=0
PLIST_SUB+= DSSI="@comment "
.endif

.if ${PORT_OPTIONS:MFLUIDSYNTH}
LIB_DEPENDS+=   fluidsynth:${PORTSDIR}/audio/fluidsynth
PLIST_SUB+= FLUIDSYNTH=""
FLUIDSYNTH_H=   fluidsynth.h
.else
PLIST_SUB+= FLUIDSYNTH="@comment "
FLUIDSYNTH_H=   ##fluidsynth.h##
.endif

.if ${PORT_OPTIONS:MJACK}
LIB_DEPENDS+=   jack:${PORTSDIR}/audio/jack
SCONS_ARGS+=    useJack=1
PLIST_SUB+= JACK=""
.else
SCONS_ARGS+=    useJack=0
PLIST_SUB+= JACK="@comment "
.endif

.if ${PORT_OPTIONS:MOSC}
LIB_DEPENDS+=   lo:${PORTSDIR}/audio/liblo
SCONS_ARGS+=    useOSC=1
PLIST_SUB+= OSC=""
.else
SCONS_ARGS+=    useOSC=0
PLIST_SUB+= OSC="@comment "
.endif

.if ${PORT_OPTIONS:MPORTAUDIO}
BUILD_DEPENDS+= portaudio>=19:${PORTSDIR}/audio/portaudio2
RUN_DEPENDS+=   portaudio>=19:${PORTSDIR}/audio/portaudio2
SCONS_ARGS+=    usePortAudio=1
PLIST_SUB+= PORTAUDIO=""
PORTAUDIO_L=    "${LOCALBASE}/lib/portaudio2"
PORTAUDIO_R=    "-Wl,-rpath,${LOCALBASE}/lib/portaudio2"
.else
SCONS_ARGS+=    usePortAudio=0
PLIST_SUB+= PORTAUDIO="@comment "
PORTAUDIO_L=    # empty
PORTAUDIO_R=    # empty
.endif

.if ${PORT_OPTIONS:MPULSEAUDIO}
LIB_DEPENDS+=   pulse-simple:${PORTSDIR}/audio/pulseaudio
PLIST_SUB+= PULSEAUDIO=""
PULSEAUDIO_H=   pulse/simple.h
.else
PLIST_SUB+= PULSEAUDIO="@comment "
PULSEAUDIO_H=   ##pulse/simple.h##
.endif

.if ${PORT_OPTIONS:MFLTK}
LIB_DEPENDS+=   fltk:${PORTSDIR}/x11-toolkits/fltk
PLIST_SUB+= FLTK=""
SCONS_ARGS+=    buildCsound5GUI=1 buildCSEditor=1 buildWinsound=1 useFLTK=1
.else
PLIST_SUB+= FLTK="@comment "
SCONS_ARGS+=    buildCsound5GUI=0 buildCSEditor=0 buildWinsound=0 useFLTK=0
.endif

.if ${PORT_OPTIONS:MDOCS}
EXTRACT_DEPENDS+=${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip
DISTFILES+= Csound${PORTVERSION:R}_manual_html.zip:manual
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} == amd64 || ${ARCH} == sparc64 || ${ARCH} == ia64
CMAKE_ARGS+=    Word64=1
.endif

post-extract:
.if ${PORT_OPTIONS:MDOCS}
    @(cd ${DISTDIR}/${DIST_SUBDIR} && ${UNZIP_CMD} -qo \
        Csound${PORTVERSION:R}_manual_html.zip -d ${WRKDIR})
.endif

post-patch:
    @${SED} -e "s|%%LOCALBASE%%|${LOCALBASE}|g; \
        s|%%PYTHON_INCLUDEDIR%%|${PYTHON_INCLUDEDIR}|; \
        s|%%PORTAUDIO_L%%|${PORTAUDIO_L}|; \
        s|%%PORTAUDIO_R%%|${PORTAUDIO_R}|; \
        s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|" \
        < ${FILESDIR}/custom.py.in > ${WRKSRC}/custom.py
    @${REINPLACE_CMD} -e "s|'unsupported'|'linux'|; \
        s|Exit(-1)|print \"\"|; \
        /CCFLAGS/s|\['-Wno-format'\]|Split('${CFLAGS}')|; \
        /CXXFLAGS/s|\['-Wno-format'\]|Split('${CXXFLAGS}')|; \
        s|/usr/local|${LOCALBASE}|; \
        s|/usr/X11R6|${LOCALBASE}|; \
        /\"pthread\"/d; \
        s|'pthread'|''|; \
        s|\"portaudio.h\"|\"portaudio2/portaudio.h\"|; \
        s|\"boost/any.hpp\"|\"##boost/any.hpp##\"|; \
        s|\"alsa/asoundlib.h\"|\"${ALSA_H}\"|; \
        s|'xmlfile.h'|'##xmlfile.h##'|; \
        s|\"pulse/simple.h\"|\"${PULSEAUDIO_H}\"|; \
        s|\"m_pd.h\"|\"##m_pd.h##\"|; \
        s|\"tcl.h\"|\"##tcl.h##\"|; \
        s|'5.2'|'5'|; \
        s|'dl'|''|; \
        s|'stdc++'|''|; \
        s|'-DNO_FLTK_THREADS'|''|; \
        s|\"fluidsynth.h\"|\"${FLUIDSYNTH_H}\"|; \
        /mixer_main.c/s|'mixer'|'csmixer'|; \
        /jpluginEnvironment/s|'asound'|''|; \
        /portaudioEnvironment/s|'asound'|''|; \
        /jackEnvironment/s|'asound'|''|; \
        s| stdc++ | |; \
        s| pthread | |" ${WRKSRC}/SConstruct
    @${REINPLACE_CMD} -e "s|<portaudio.h>|<portaudio2/portaudio.h>|" \
        ${WRKSRC}/InOut/rtpa.c
    @${REINPLACE_CMD} -e "s|linux/if.h|sys/types.h|" \
        ${WRKSRC}/OOps/remote.c
    @${REINPLACE_CMD} '1658,1659d' \
        ${WRKSRC}/SConstruct
post-install:
    @${LN} -sf libcsound64.so.5 ${PREFIX}/lib/libcsound64.so
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${DOCSDIR}
    @${ECHO_MSG} " Installing manual ${PORTVERSION}. "
    @(cd ${WRKDIR}/html && ${COPYTREE_SHARE} . ${DOCSDIR})
    @${ECHO_MSG} " Done."
.endif
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>