Ticket #47192: Portfile

File Portfile, 16.6 KB (added by RJVB (René Bertin), 9 years ago)
Line 
1# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;
3
4PortSystem          1.0
5PortGroup           compiler_blacklist_versions 1.0
6
7name                VLC
8version             2.2.0
9
10
11categories          multimedia devel
12
13subport             lib${name} {
14    maintainers         gmail.com:rjvbertin openmaintainer
15    description         the core engine and interface to VLC's multimedia framework
16    long_description    libVLC is the core engine and the interface to the multimedia \
17                        framework on which VLC media player is based.  It allows developers \
18                        to create a wide range of multimedia applications using the VLC features.
19    conflicts           ${name} VLC-devel libVLC-devel
20    homepage            http://www.videolan.org/vlc/libvlc.html
21}
22
23if {${subport} ne "lib${name}"} {
24    maintainers         nomaintainer
25    description         VLC is a cross-platform media player and streaming server
26    long_description    VLC media player is a highly portable multimedia player for \
27                        various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, \
28                        mp3, ogg, ...) as well as DVDs, VCDs, and various streaming protocols. \
29                        It can also be used as a server to stream in unicast or multicast \
30                        in IPv4 or IPv6 on a high-bandwidth network.
31    conflicts           lib${name} libVLC-devel VLC-devel
32    homepage            http://www.videolan.org
33}
34
35license             GPL
36
37platforms           darwin
38conflicts           VLC
39
40
41master_sites        http://download.videolan.org/pub/videolan/vlc/${version}/
42distname            vlc-${version}
43use_xz              yes
44
45checksums           rmd160  b57bdb04e8bacbd3a5d2b8c8e43c2570d2d4a7d5 \
46                    sha256  5e0a27e248c47da723a696420aca3a4dd15cc3ed8cc81618d3f1dc8661b25517
47
48# Enable HFS compression.
49depends_extract-append      port:libarchive
50extract.post_args           "| bsdtar -x -k --hfsCompression"
51
52depends_build       port:pkgconfig
53
54depends_lib         port:a52dec \
55                    port:avahi \
56                    port:bzip2 \
57                    port:faad2 \
58                    path:lib/libavcodec.dylib:ffmpeg \
59                    port:flac \
60                    port:fluidsynth \
61                    port:fontconfig \
62                    port:FreeRDP \
63                    port:freetype \
64                    port:fribidi \
65                    port:gettext \
66                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
67                    port:gmp \
68                    port:gnutls \
69                    port:jpeg \
70                    port:lame \
71                    port:libass \
72                    port:libbluray \
73                    port:libcddb \
74                    port:libcdio \
75                    port:libdc1394 \
76                    port:libdca \
77                    port:libdvbpsi \
78                    port:libdvdnav \
79                    port:libdvdread \
80                    port:libebml \
81                    port:libgcrypt \
82                    port:libgpg-error \
83                    port:libiconv \
84                    port:libid3tag \
85                    port:libidn \
86                    port:libmad \
87                    port:libmatroska \
88                    port:libmodplug \
89                    port:libmpcdec \
90                    port:libmpeg2 \
91                    port:libmtp \
92                    port:libogg \
93                    port:libopus \
94                    port:libpng \
95                    port:libproxy \
96                    port:libsamplerate \
97                    port:libsdl \
98                    port:libsdl_image \
99                    port:libsndfile \
100                    port:libssh2 \
101                    port:libtheora \
102                    port:libupnp \
103                    port:libusb \
104                    port:libvorbis \
105                    port:libxml2 \
106                    port:live555 \
107                    port:lua \
108                    port:ncurses \
109                    port:nettle \
110                    port:opencv \
111                    port:openjpeg15 \
112                    port:openssl \
113                    port:orc \
114                    port:p11-kit \
115                    port:readline \
116                    port:schroedinger \
117                    port:speex \
118                    port:taglib \
119                    port:tiff \
120                    port:twolame \
121                    port:vcdimager \
122                    port:x264 \
123
124# VLC-2.1 and later are x86_64-only: https://trac.videolan.org/vlc/ticket/8161
125universal_variant   no
126supported_archs     x86_64
127
128compiler.blacklist  gcc-4.2 llvm-gcc-4.2 {clang < 300}
129
130pre-fetch {
131    if {${os.platform} eq "darwin" && ${os.major} < 10} {
132        ui_error "${name} ${version} requires Mac OS X 10.6 or greater."
133        return -code error "incompatible Mac OS X version"
134    }
135}
136
137patchfiles          buildfix-package.mak.patch \
138                    configure.ac-no-arch.patch \
139                    PR-34741-no__clang_version__.patch \
140                    static_assert.patch \
141                    no-sparkle.patch \
142                    patch-vlc-no-O4.diff
143
144post-patch {
145    reinplace "s:librsvg-2/librsvg:librsvg:" \
146        ${worksrcpath}/modules/text_renderer/svg.c
147
148    if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} == "libc++"} {
149        reinplace "s:-lstdc\+\+:-lc++:" \
150            ${worksrcpath}/configure.ac \
151            ${worksrcpath}/modules/access/Makefile.am
152    }
153}
154
155use_autoreconf      yes
156autoreconf.cmd      ./bootstrap
157autoreconf.pre_args
158autoreconf.args
159depends_build-append port:libtool port:autoconf port:automake
160
161configure.env-append CXXCPP="${configure.cxx} -E"
162build.args-append    DESTDIR=${worksrcpath}/dest_ignore V=1
163
164# gl.c:121:3: error: Platform not recognized.
165configure.cppflags-append -D__unix__=1
166
167# access/rdp.c:45:11: fatal error: 'freerdp/version.h' file not found
168configure.cppflags-append -DFREERDP_INTERFACE_VERSION -DFREERDP_VERSION_MAJOR=1 -DFREERDP_VERSION_MINOR=1
169
170# live555 is installed to a weird location
171configure.cppflags-append -I${prefix}/lib/live/liveMedia/include
172
173build.target        all
174destroot.target     install
175
176livecheck.type      none
177
178# Other
179configure.args-append \
180                    --with-contrib=${worksrcpath}/contrib \
181                    --disable-debug --disable-update-check --enable-gnutls \
182                    --disable-notify --disable-dbus --enable-lua \
183                    --disable-gnomevfs --disable-growl --disable-macosx-vlc-app
184
185# Input Plugins
186configure.args-append \
187                    --enable-dvdnav --enable-dvdread --disable-smbclient --enable-vcdx \
188                    --disable-macosx-qtkit --disable-macosx-eyetv --disable-realrtsp \
189                    --enable-freerdp --enable-opencv --enable-sftp
190
191# Mux/Demux Plugins
192configure.args-append \
193                    --enable-dvbpsi --enable-ogg --enable-mux_ogg \
194                    --enable-mkv --enable-mod --enable-mpc --disable-shout
195
196# Codec Plugins
197configure.args-append \
198                    --enable-a52 --enable-faad --enable-flac --enable-live555 \
199                    --enable-opus --enable-vorbis --enable-ogg --enable-mad --enable-libass \
200                    --enable-dca --enable-png --disable-quicktime --enable-twolame \
201                    --enable-speex --enable-theora --enable-x264 --enable-postproc \
202                    --enable-avcodec --enable-avformat --enable-swscale \
203                    --disable-fluidsynth --enable-schroedinger
204
205# Video Plugins. We do our best to deactivate X11 and disable its auto-detection by
206# claiming the headers and libs are somewhere they're not.
207configure.args-append \
208                    --disable-caca --enable-sdl --enable-sdl-image \
209                    --without-x --disable-xcb --disable-xvideo --disable-glx \
210                    --x-includes=${destroot} --x-libraries=${destroot} \
211                    --enable-freetype --enable-fontconfig --enable-fribidi \
212                    --disable-svg
213
214# Audio Plugins
215configure.args-append \
216                    --disable-jack --enable-samplerate --disable-pulse
217
218# Interface Plugins
219configure.args-append \
220                    --disable-macosx --disable-macosx-dialog-provider \
221                    --disable-qt --enable-ncurses --disable-skins2
222
223# Visualisations and Video Filter Plugins
224configure.args-append \
225                    --disable-goom
226
227# Service Discovery Plugins
228configure.args-append \
229                    --enable-bonjour --enable-upnp
230
231# 20150209: Jack really would require a newer variant than what's currently in MacPorts
232variant jack description {Enable jack and fluidsynth plugins for audio output} {
233    depends_lib-append      port:jack port:fluidsynth port:portaudio
234    configure.args-delete   --disable-jack --disable-fluidsynth
235    configure.args-append   --enable-jack --enable-fluidsynth
236}
237
238variant dbus description {Enable DBus support} {
239    depends_lib-append      port:dbus
240    configure.args-delete   --disable-dbus
241    configure.args-append   --enable-dbus
242}
243
244variant qtkit description {Enable qtcapture and qtaudio} {
245    configure.args-delete   --disable-macosx-qtkit
246    configure.args-append   --enable-macosx-qtkit
247}
248
249variant svg description {Enable SVG support} {
250    depends_lib-append      port:librsvg
251    configure.args-delete   --disable-svg
252    configure.args-append   --enable-svg
253}
254
255variant shout description {Enable Shoutcast/Icecast streaming output support} {
256    depends_lib-append      port:libshout2
257    configure.args-delete   --disable-shout
258    configure.args-append   --enable-shout
259}
260
261variant smb description {Enable Samba 3 input support} {
262    depends_lib-append      port:samba3
263    configure.args-delete   --disable-smbclient
264    configure.args-append   --enable-smbclient
265    configure.ldflags-append    -L${prefix}/lib/samba3
266}
267
268variant pulse description {Enable PulseAudio support} {
269    depends_lib-append      port:pulseaudio
270    configure.args-delete   --disable-pulse
271    configure.args-append   --enable-pulse
272}
273
274variant x11 {
275    depends_lib-append \
276        port:xorg-libX11 \
277        port:xorg-libXau \
278        port:xorg-libXdmcp \
279        port:xorg-libXext \
280        port:xorg-libXrandr \
281        port:xorg-libxcb \
282        port:xrender \
283        port:XviD \
284        port:mesa \
285        port:xorg-libXinerama \
286        port:xorg-libXv \
287        port:xorg-libXxf86vm \
288        port:xorg-xcb-util \
289        port:xorg-xcb-util-keysyms
290
291    configure.args-delete   --without-x --disable-xvideo --disable-glx --disable-xcb \
292                            --x-includes=${destroot} --x-libraries=${destroot}
293    configure.args-append   --with-x --enable-xvideo --enable-xcb
294}
295
296if {${subport} ne "lib${name}"} {
297    variant qt4 description {Build using Qt4 UI.  This will use qt4-mac. Experimental and probably dysfunctional} {
298        patchfiles-append       patch-vlc-no-qt5.diff \
299                                patch-vlc-qt-configureac.diff \
300                                patch-simplepreferences.diff
301
302        configure.args-delete   --disable-qt
303        configure.args-append   --enable-qt
304
305        PortGroup               qt4 1.0
306        conflicts               qt5
307    }
308    variant qt5 description {Build using Qt5 UI.  This will use qt5-mac. Experimental and probably dysfunctional} {
309        patchfiles-append       patch-vlc-qt-configureac.diff \
310                                patch-simplepreferences.diff
311
312        configure.args-delete   --disable-qt
313        configure.args-append   --enable-qt
314
315        PortGroup               qt5 1.0
316        conflicts               qt4
317    }
318}
319
320variant quartz {
321    depends_lib-delete      port:libsamplerate
322    depends_lib-append      port:BGHUDAppKit
323
324    patchfiles-append       patch-vlc-for-macports.diff \
325                            patch-ignore-libGL.diff
326
327    configure.args-delete   --disable-macosx \
328                            --enable-samplerate --disable-realrtsp
329    configure.args-append   --enable-macosx
330    # taken from VLC's own configure.sh script for OS X:
331    configure.args-append   --disable-samplerate \
332                            --enable-merge-ffmpeg \
333                            --enable-realrtsp \
334}
335
336variant huge \
337    requires jack shout svg vcd \
338    description {Enable all variants except quartz, smb, and x11} {}
339
340if {${subport} ne "lib${name}"} {
341    variant full \
342        requires huge quartz smb x11 \
343        description {Enable all variants} {}
344} else {
345    variant full \
346        requires huge quartz smb \
347        description {Enable all variants} {}
348    # FreeRDP doesn't make a lot of sense with just the library
349    configure.args-delete --enable-freerdp
350    configure.args-append --disable-freerdp
351    depends_lib-delete port:FreeRDP
352}
353
354platform darwin 10 {
355    # FreeRDP fails to build on Snow Leopard
356    configure.args-delete --enable-freerdp
357    configure.args-append --disable-freerdp
358    depends_lib-delete port:FreeRDP
359}
360
361platform macosx {
362    default_variants-append +quartz +qtkit
363
364    configure.args-delete \
365        --disable-macosx-eyetv
366
367    configure.args-append \
368        --enable-macosx-eyetv
369
370    if {${subport} ne "lib${name}"} {
371        configure.args-delete --disable-macosx-vlc-app
372        configure.args-append --enable-macosx-vlc-app
373    }
374
375    post-patch {
376        reinplace "s/Appkit/AppKit/" ${worksrcpath}/configure.ac
377        reinplace "/Sparkle.framework/d" \
378            ${worksrcpath}/extras/package/macosx/vlc.xcodeproj/project.pbxproj
379        reinplace "/SDKROOT/d" \
380            ${worksrcpath}/extras/package/macosx/vlc.xcodeproj/project.pbxproj
381        reinplace "/Growl.framework/d" \
382            ${worksrcpath}/extras/package/macosx/package.mak
383
384        reinplace "s:LD_LIBRARY_PATH:DYLD_LIBRARY_PATH:g" \
385            ${worksrcpath}/Makefile.am
386
387        reinplace "/argv/s/environ/*_NSGetEnviron()/" \
388            ${worksrcpath}/modules/misc/inhibit/xdg.c \
389            ${worksrcpath}/modules/stream_filter/decomp.c
390
391        reinplace "s/extern char \\*\\*environ;/#include <crt_externs.h>/" \
392            ${worksrcpath}/modules/misc/inhibit/xdg.c \
393            ${worksrcpath}/modules/stream_filter/decomp.c
394
395        ln -s ${frameworks_dir}/BGHUDAppKit.framework ${worksrcpath}/contrib/BGHUDAppKit.framework
396
397        # To trick configure
398        file mkdir "${worksrcpath}/contrib/lib"
399    }
400
401    post-destroot {
402        eval file delete [glob ${destroot}${prefix}/lib/vlc/plugins/*/*.la]
403
404        if {[variant_isset qt4] || [variant_isset quartz]} {
405            if {${subport} ne "lib${name}"} {
406                file copy ${worksrcpath}/VLC.app ${destroot}${applications_dir}/VLC.app
407
408                # These are already in ${prefix}, so we don't need to bundle them as well
409                file delete -force ${destroot}${applications_dir}/VLC.app/Contents/Frameworks
410                file delete -force ${destroot}${applications_dir}/VLC.app/Contents/lib
411
412                # There's no need to install these into the bundle and the prefix
413                file delete -force ${destroot}${applications_dir}/VLC.app/Contents/MacOS/include
414                file delete -force ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
415                file delete -force ${destroot}${applications_dir}/VLC.app/Contents/MacOS/plugins
416
417                # http://trac.macports.org/ticket/35131
418                ln -s ${prefix}/lib ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
419                ln -s ${prefix}/lib/vlc/plugins ${destroot}${applications_dir}/VLC.app/Contents/MacOS/plugins
420
421                # the vlc executable needs to be started with a full path to the app bundle executable
422                # or else the Mac OS X interface will hang beyond even a ^C or ^\ :
423                file rename ${destroot}${prefix}/bin/vlc ${destroot}${prefix}/bin/vlc.exe
424                xinstall -m 755 ${filespath}/vlc ${destroot}${prefix}/bin
425                if {${applications_dir} ne "/Applications/MacPorts"} {
426                    reinplace "s|/Applications/MacPorts/|${applications_dir}/|g" ${destroot}${prefix}/bin/vlc
427                }
428            } else {
429                file delete -force ${destroot}${prefix}/bin
430                file delete -force ${destroot}${prefix}/share/applications
431                file delete -force ${destroot}${prefix}/share/man
432            }
433        }
434    }
435    post-activate {
436        if {[variant_isset qt4] || [variant_isset qt5]} {
437            ui_info "The Qt interface modules for VLC are currently dysfunctional. If you encounter bugs with them, please file them with VLC and not MacPorts."
438        }
439        system "${prefix}/lib/vlc/vlc-cache-gen -f ${prefix}/lib/vlc"
440    }
441}