aboutsummaryrefslogtreecommitdiffstats
path: root/audio/csound/Makefile
blob: cd1d56c45b93d8ca425f62e355595c508a6994e6 (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
# Created by: trevor
# $FreeBSD$

PORTNAME=   csound
PORTVERSION=    5.19.01
PORTREVISION=   4
CATEGORIES= audio lang
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}5/${PORTNAME}${PORTVERSION:R} \
        SF/${PORTNAME}/${PORTNAME}5/${PORTNAME}${PORTVERSION:R}/manual:manual
DISTFILES=  ${PORTNAME:S/c/C/}${PORTVERSION}${EXTRACT_SUFX} \
        ${CSOUND_DOCS:S/$/:manual/}
DIST_SUBDIR=    csound

MAINTAINER= ports@FreeBSD.org
COMMENT=    Sound synthesizer

LICENSE=    LGPL21
LICENSE_FILE=   ${WRKSRC}/COPYING

BUILD_DEPENDS=  swig13>0:${PORTSDIR}/devel/swig13 \
        eigen>0:${PORTSDIR}/math/eigen3 \
        gmm++>0:${PORTSDIR}/math/gmm++
LIB_DEPENDS=    libsndfile.so:${PORTSDIR}/audio/libsndfile

PORTSCOUT=  limit:^5\.

OPTIONS_DEFINE= ALSA PNG DSSI FLTK FLUIDSYNTH JACK OSC PORTAUDIO PULSEAUDIO DOCS
OPTIONS_DEFAULT=FLTK
OPTIONS_SUB=    yes
ALSA_DESC=  Build ALSA I/O module
PNG_DESC=   Build image opcodes
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-* csound6

WRKSRC=     ${WRKDIR}/${PORTNAME:S/c/C/}${PORTVERSION}

USES=       bison cpe gettext scons compiler:openmp python
CPE_VENDOR= csounds
MAKE_ARGS=  instdir="${STAGEDIR}" prefix="${PREFIX}" \
        CC="${CC}" CXX="${CXX}" \
        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
SSP_UNSAFE= yes

CFLAGS+=    -fPIC -fopenmp -DUSE_OPENMP
LDFLAGS+=   -pthread -Wl,-export-dynamic
LINKFLAGS=  # empty

SUB_FILES=  pkg-message

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MALSA}
LIB_DEPENDS+=   libasound.so:${PORTSDIR}/audio/alsa-lib
MAKE_ARGS+= useALSA=1
ALSA_H=     alsa/asoundlib.h
.else
MAKE_ARGS+= useALSA=0
ALSA_H=     ##alsa/asoundlib.h##
.endif

.if ${PORT_OPTIONS:MPNG}
LIB_DEPENDS+=   libpng.so:${PORTSDIR}/graphics/png
MAKE_ARGS+= buildImageOpcodes=1
.else
MAKE_ARGS+= buildImageOpcodes=0
.endif

.if ${PORT_OPTIONS:MDSSI}
BUILD_DEPENDS+= dssi>=0:${PORTSDIR}/audio/dssi
LIB_DEPENDS+=   libasound.so:${PORTSDIR}/audio/alsa-lib
RUN_DEPENDS+=   dssi>=0:${PORTSDIR}/audio/dssi
MAKE_ARGS+= buildDSSI=1
.else
MAKE_ARGS+= buildDSSI=0
.endif

.if ${PORT_OPTIONS:MFLUIDSYNTH}
LIB_DEPENDS+=   libfluidsynth.so:${PORTSDIR}/audio/fluidsynth
FLUIDSYNTH_H=   fluidsynth.h
.else
FLUIDSYNTH_H=   ##fluidsynth.h##
.endif

.if ${PORT_OPTIONS:MJACK}
LIB_DEPENDS+=   libjack.so:${PORTSDIR}/audio/jack
MAKE_ARGS+= useJack=1
.else
MAKE_ARGS+= useJack=0
.endif

.if ${PORT_OPTIONS:MOSC}
LIB_DEPENDS+=   liblo.so:${PORTSDIR}/audio/liblo
MAKE_ARGS+= useOSC=1
.else
MAKE_ARGS+= useOSC=0
.endif

.if ${PORT_OPTIONS:MPORTAUDIO}
LIB_DEPENDS+=   libportaudio.so:${PORTSDIR}/audio/portaudio
MAKE_ARGS+= usePortAudio=1
.else
MAKE_ARGS+= usePortAudio=0
.endif

.if ${PORT_OPTIONS:MPULSEAUDIO}
LIB_DEPENDS+=   libpulse-simple.so:${PORTSDIR}/audio/pulseaudio
PULSEAUDIO_H=   pulse/simple.h
.else
PULSEAUDIO_H=   ##pulse/simple.h##
.endif

.if ${PORT_OPTIONS:MFLTK}
LIB_DEPENDS+=   libfltk.so:${PORTSDIR}/x11-toolkits/fltk
MAKE_ARGS+= buildCsound5GUI=1 buildCSEditor=1 buildWinsound=1 useFLTK=1
.else
MAKE_ARGS+= buildCsound5GUI=0 buildCSEditor=0 buildWinsound=0 useFLTK=0
.endif

.if ${PORT_OPTIONS:MDOCS}
CSOUND_DOCS=    Csound${PORTVERSION:R}_manual_html.zip
.endif

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

.if ${OSVERSION} < 1000033
BUILD_DEPENDS+= flex>0:${PORTSDIR}/textproc/flex
MAKE_ENV+=  PATH=${LOCALBASE}/bin:$$PATH
.endif

.if ${OSVERSION} >= 1000054
CXXLIB=     c++
.else
CXXLIB=     # empty
.endif

BROKEN_powerpc64=   Does not build

post-patch:
    @${SED} -e "s|%%LOCALBASE%%|${LOCALBASE}|g; \
        s|%%PYTHON_INCLUDEDIR%%|${PYTHON_INCLUDEDIR}|" \
        < ${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}|; \
        /LINKFLAGS/s|\['-Wl,-Bdynamic'\]|Split('${LDFLAGS}')|; \
        s|\"pthread\"|\"\"|; \
        s|'pthread'|''|; \
        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++'|'${CXXLIB}'|; \
        /linuxjoystick/s|^.*|    print \"\"|; \
        s|\"fluidsynth.h\"|\"${FLUIDSYNTH_H}\"|; \
        /mixer_main.c/s|'mixer'|'csmixer'|; \
        /jpluginEnvironment/s|'asound'|''|; \
        /portaudioEnvironment/s|'asound'|''|; \
        /jackEnvironment/s|'asound'|''|" ${WRKSRC}/SConstruct
    @${REINPLACE_CMD} -e "s|linux/if.h|sys/types.h|" \
        ${WRKSRC}/OOps/remote.c
    @${REINPLACE_CMD} -e "/Str/!s|fdclose|my_fdclose|" \
        ${WRKSRC}/OOps/*.c \
        ${WRKSRC}/Top/csound.c \
        ${WRKSRC}/Engine/auxfd.c \
        ${WRKSRC}/H/prototyp.h

post-install:
    ${LN} -sf libcsound64.so.5 ${STAGEDIR}${PREFIX}/lib/libcsound64.so
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/* ${STAGEDIR}${PREFIX}/lib/*.so* \
        ${STAGEDIR}${PREFIX}/lib/csound/plugins64/*.so

post-install-DOCS-on:
    @${MKDIR} ${STAGEDIR}${DOCSDIR}
    (cd ${WRKDIR}/html && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

.include <bsd.port.mk>