source: trunk/dports/multimedia/mythtv-core.25/Portfile @ 102174

Last change on this file since 102174 was 102174, checked in by jeremyhu@…, 7 years ago

misc: Update compiler dependency workaround for #32542, see #37817

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.6 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 102174 2013-01-29 07:53:39Z jeremyhu@macports.org $
3
4PortSystem          1.0
5PortGroup           github 1.0
6PortGroup           qt4 1.0
7PortGroup           conflicts_build 1.0
8
9set shorthash       117b611e
10# set fullhash      117b611ebdaf1c1710a1ccbcb2ffdeee06c92057
11set majorversion    .25
12set minorversion    .3
13github.setup        MythTV mythtv ${shorthash}
14name                mythtv-core${majorversion}
15version             0${majorversion}${minorversion}-Fixes-20121025
16revision            2
17categories          multimedia
18platforms           darwin
19license             GPL-2
20maintainers         cogeco.ca:ctreleaven openmaintainer
21
22description         MythTV - Open source digital video recorder
23long_description    The ultimate Digital Video Recorder and home media \
24                    center hub. Think of it as a Free and Open Source alternative \
25                    to Windows Media Center or Tivo. With its plugin architecture, \
26                    it has been extended from a mere TV viewing application into a \
27                    full home media center suite, capable of managing your personal \
28                    photo, video, and music collections, as well as keep you up to \
29                    date with the weather, a ZoneMinder home security system, and \
30                    more.
31
32homepage            http://www.mythtv.org/
33checksums           rmd160  d27c5ec16923e0e2e159f09271aa331ff739250f \
34                    sha256  8af9451307c70b43104beccfe6c4ab8835ea2f459934940b60e4e65423b1fa2d
35
36set nick            mythtv
37set mythtvhomedir   ${prefix}/var/mythtvuser
38set mythtvlogdir    ${prefix}/var/log/${nick}${majorversion}
39set mythtvrundir    ${prefix}/var/run/${nick}${majorversion}
40set mythtvpidfile   ${mythtvrundir}/${nick}
41set plistdir        ${prefix}/Library/LaunchDaemons
42set plistlabel      org.mythtv.mythbackend
43set plistfile       org.mythtv.mythbackend.plist
44set mythverstring   v0${majorversion}${minorversion}-${shorthash}-MacPorts
45set mythbranch      fixes/0${majorversion}
46set applescripts    {Myth_Frontend Myth_Frontend_Logging Myth_Filldatabase Myth_Setup Myth_Stop_Start}
47set mysqlver        mysql5
48set perlver         perl5.12
49set perlbin         ${prefix}/bin/${perlver}
50set perlmodver      p5.12
51set pythonver       python2.6
52set pythonbin       ${prefix}/bin/${pythonver}
53set pymodver        py26
54
55depends_lib         port:libdvdcss \
56                    port:libsdl \
57                    port:freetype \
58                    port:lame \
59                    port:x264 \
60                    port:qt4-mac-${mysqlver}-plugin \
61                    port:libpng \
62                    port:${pymodver}-mysql \
63                    port:${pymodver}-lxml \
64                    port:${pymodver}-urlgrabber \
65                    port:${perlmodver}-dbd-mysql \
66                    port:${perlmodver}-http-request-ascgi \
67                    port:${perlmodver}-lwp-useragent-determined \
68                    port:${perlmodver}-io-socket-inet6 \
69                    port:${perlmodver}-datemanip \
70                    port:${perlmodver}-net-upnp
71
72depends_build       port:yasm  port:pkgconfig
73
74conflicts_build     libdvdnav
75
76depends_run         port:logrotate
77
78patchfiles          patch-bindings-python-mythtv-utility.diff \
79                    patch-greedyh.asm.diff \
80                    patch-util-osx-objC.diff \
81                    patch-mythtv-libs-libmythtv-NuppelVideoRecorder.cpp.diff \
82                    patch-mythtv-libs-libmythtv-avformatwriter.cpp.diff
83
84# See https://trac.macports.org/ticket/35934
85compiler.blacklist  llvm-gcc-4.2 macports-llvm-gcc-4.2 macports-clang-3.1 \
86                    dragonegg-3.0 dragonegg-3.1 apple-gcc-4.2
87compiler.fallback-append macports-clang-3.0
88
89# Run time failures with XCode 4.4.x and 4.5.0
90if {[vercmp $xcodeversion 4.4] >= 0} {
91    compiler.blacklist-append clang
92}
93
94# TODO: base should do this: http://trac.macports.org/ticket/32542
95if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
96    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
97
98    # base 2.1.x ignores the argument and just use ${configure.compiler}
99    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
100        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
101    }
102
103    if {[string match macports-gcc* ${configure.compiler}]} {
104        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
105    }
106}
107
108post-extract {
109    file mkdir ${worksrcpath}/macports
110    foreach {applescript} ${applescripts} {
111        copy ${filespath}/${applescript}.applescript ${worksrcpath}/macports/${applescript}.applescript
112    }
113    copy ${filespath}/${plistfile} ${worksrcpath}/macports/${plistfile}
114    copy ${filespath}/logrotate.mythtv ${worksrcpath}/macports/logrotate.mythtv
115}
116
117post-patch {
118    set sedPath ${worksrcpath}/mythtv/
119    ui_info "Make Myth utils use MacPorts Perl  <<<<"
120    reinplace -locale C "s|#!/usr/bin/env perl|#!${perlbin}|" \
121        ${sedPath}programs/scripts/internetcontent/topdocumentaryfilm.pl  \
122        ${sedPath}programs/scripts/internetcontent/twit.tv.pl
123
124    reinplace -locale C "s|#!/usr/bin/perl|#!${perlbin}|" \
125        ${sedPath}bindings/perl/Makefile.PL  \
126        ${sedPath}bindings/perl/MythTV.pm  \
127        ${sedPath}contrib/maintenance/optimize_mythdb.pl  \
128        ${sedPath}contrib/user_jobs/mythlink.pl  \
129        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
130        ${sedPath}programs/scripts/database/mythconverg_restore.pl
131
132    reinplace -locale C "s|/usr/local/bin|${prefix}/lib/${mysqlver}/bin|"  \
133        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
134        ${sedPath}programs/scripts/database/mythconverg_restore.pl
135
136    ui_info "Record Myth version strings  <<<<"
137    reinplace -locale C "s#\${SOURCE_VERSION}#${mythverstring}#g" ${sedPath}version.sh
138    reinplace -locale C "s#\${BRANCH}#${mythbranch}#g" ${sedPath}version.sh
139
140    ui_info "Make Myth scripts use MacPorts Python  <<<<"
141    # Hack to install Python bindings in ${prefix}/Library/Frameworks/Python.framework/Versions/2.6
142    reinplace -locale C "s|\$(ROOT_FLAGS) \$(PREFIX_FLAGS)|\$(ROOT_FLAGS) \--prefix=\"${frameworks_dir}/Python.framework/Versions/2.6\"|" \
143        ${sedPath}/bindings/python/Makefile
144    reinplace -locale C "s|/usr/local|${prefix}|" ${worksrcpath}/mythtv/bindings/python/MythTV/static.py
145    reinplace -locale C "s|#!python|#!${pythonbin}|" \
146        ${worksrcpath}/mythtv/bindings/python/scripts/mythpython \
147        ${worksrcpath}/mythtv/bindings/python/scripts/mythwikiscripts
148    fs-traverse f ${sedPath}/bindings/python/ {
149        if [string equal [ file extension ${f} ] ".py" ] {
150            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
151        }
152    }
153    fs-traverse f ${sedPath}/programs/scripts/ {
154        if [string equal [ file extension ${f} ] ".py" ] {
155            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
156        }
157    }
158    foreach f [glob -directory ${sedPath}/programs/scripts/hardwareprofile *.py] {
159    # fix even though they're currently non-functional on OS X
160        reinplace -locale C "s|^#!/usr/bin/python\$|#!${pythonbin}|" ${f}
161    }
162
163    ui_info "Customize other port files  <<<<"
164    foreach {applescript} ${applescripts} {
165        reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${applescript}.applescript
166        reinplace -locale C "s|@APPLICATIONS_DIR@|${applications_dir}|" ${worksrcpath}/macports/${applescript}.applescript
167        reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${applescript}.applescript
168        reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${applescript}.applescript
169    }
170    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${plistfile}
171    reinplace -locale C "s|@PLISTLABEL@|${plistlabel}|g" ${worksrcpath}/macports/${plistfile}
172    reinplace -locale C "s|@PYTHONVER@|${pythonver}|" ${worksrcpath}/macports/${plistfile}
173    reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${plistfile}
174    reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${plistfile}
175    reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|g" ${worksrcpath}/macports/logrotate.mythtv
176    reinplace -locale C "s|xxxyyyzzz|${mythtvpidfile}|" ${worksrcpath}/mythtv/configure
177}
178
179configure.dir       ${worksrcpath}/mythtv
180configure.args      --compile-type=release \
181                    --runprefix=${prefix} \
182                    --cc=${configure.cc} \
183                    --cxx=${configure.cxx} \
184                    --qmake=${qt_qmake_cmd} \
185                    --extra-ldflags='-F/System/Library/Frameworks' \
186                    --python=${pythonbin} \
187                    --disable-distcc \
188                    --disable-firewire \
189                    --disable-audio-jack --disable-indev=jack \
190                    --enable-libmp3lame --enable-libx264
191
192if {${configure.ccache} != "yes"} {
193    configure.args-append --disable-ccache
194}
195
196if {${configure.distcc} != "yes"} {
197    configure.args-append --disable-distcc
198}
199
200build.dir           ${worksrcpath}/mythtv
201
202pre-build {
203    ui_info "Build Myth AppleScript helper apps"
204    # Compile applescrips
205    foreach {applescript} ${applescripts} {
206        system "osacompile -x -o ${worksrcpath}/macports/${applescript}.app ${worksrcpath}/macports/${applescript}.applescript"
207    }
208    # Myth custom icon for a couple of the applets
209    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Frontend.app/Contents/Resources/applet.icns
210    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Stop_Start.app/Contents/Resources/applet.icns
211}
212
213destroot.destdir    INSTALL_ROOT=${destroot}
214
215post-destroot {
216# make some directories myth will need
217    xinstall -d -m 666 ${destroot}${mythtvhomedir}
218    xinstall -d -m 666 ${destroot}${mythtvlogdir}
219    xinstall -d -m 666 ${destroot}${mythtvlogdir}/old
220    xinstall -d -m 666 ${destroot}${prefix}/etc/logrotate.d
221    xinstall -d -m 644 ${destroot}${mythtvrundir}
222
223    destroot.keepdirs \
224        ${destroot}${mythtvhomedir} \
225        ${destroot}${mythtvlogdir} \
226        ${destroot}${mythtvlogdir}/old \
227        ${destroot}${mythtvrundir}
228
229# install logrotate.mythtv
230    xinstall -m 400 ${worksrcpath}/macports/logrotate.mythtv ${destroot}${prefix}/etc/logrotate.d/
231
232# install the launchd plist for the backend
233    ui_info "Installing startupitem/launchd plist..."
234    xinstall -d -m 0755 ${destroot}${plistdir}
235    xinstall ${worksrcpath}/macports/${plistfile} ${destroot}${plistdir}
236
237# install scripts we want in share/contrib
238    ui_info "Installing share/$name/contrib scripts..."
239
240    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/database
241    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/contrib
242
243    xinstall -m 755 \
244        ${configure.dir}/database/mc.sql \
245        ${destroot}${prefix}/share/${nick}/database/
246    xinstall -m 755 \
247        ${configure.dir}/contrib/maintenance/optimize_mythdb.pl \
248        ${configure.dir}/contrib/user_jobs/mythlink.pl \
249        ${destroot}${prefix}/share/${nick}/contrib/
250
251# install some simple Applescripts to launch common myth apps
252    ui_info "Installing Applescript helpers..."
253    # compile the Applescripts
254    xinstall -m 755 -d ${destroot}${applications_dir}/MythTV
255
256    foreach {applescript} ${applescripts} {
257        copy ${worksrcpath}/macports/${applescript}.app ${destroot}${applications_dir}/MythTV/${applescript}.app
258    }
259
260# Myth custom icon for a couple of the applets
261    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Frontend.app/Contents/Resources/applet.icns
262    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Stop_Start.app/Contents/Resources/applet.icns
263
264# Fix up library entries in dylibs and executables ...
265# need to loop on arch's if/when build universal ?!?
266    set libdir ${prefix}/lib
267
268    ui_info "Correcting library entries in dylibs..."
269
270    foreach {dylib} [glob -types f -tails -directory ${destroot}${libdir} *.dylib] {
271        # glob gives us both files and links to files
272        if { [file type ${destroot}${libdir}/${dylib}] == "file" } {
273            ui_debug "... for ${dylib}"
274            system "install_name_tool -id ${libdir}/${dylib} ${destroot}${libdir}/${dylib}"
275
276            set otool [lrange [split [exec otool -L ${destroot}${libdir}/${dylib}] \n] 1 end]
277
278            foreach {otoolentry} ${otool} {
279                # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
280                # assume anything without a leading slash needs fixing
281                set firstchar [string range [string trimleft ${otoolentry}] 0 0]
282                if  { ${firstchar} != "/" }  {
283                    set lib [lindex ${otoolentry} 0]
284                    ui_debug "      Change ${lib}  to  ${libdir}/[file tail ${lib}]"
285                    system "install_name_tool -change \
286                        ${lib} \
287                        ${libdir}/[file tail ${lib}] \
288                        ${destroot}${libdir}/${dylib}"
289                }
290            }
291        }
292    }
293    set bindir ${prefix}/bin
294    ui_info "Correcting library entries in executables..."
295
296    foreach {prog} [glob -types f -tails -directory ${destroot}${bindir} *] {
297        # glob gives us files and links to files but should be no links in bin dir
298        ui_debug "... for ${prog}"
299
300        set otool [lrange [split [exec otool -L ${destroot}${bindir}/${prog}] \n] 1 end]
301
302        foreach {otoolentry} ${otool} {
303            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
304            # assume anything without a leading slash needs fixing
305            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
306            if  { ${firstchar} != "/" }  {
307                set lib [lindex ${otoolentry} 0]
308                ui_debug "      Change ${lib} to ${libdir}/[file tail ${lib}]"
309                system "install_name_tool -change \
310                    ${lib} \
311                    ${libdir}/[file tail ${lib}] \
312                    ${destroot}${bindir}/${prog}"
313            }
314        }
315    }
316
317# fix lib entries in filters
318    set fltdir ${prefix}/lib/mythtv/filters
319    set liblist [glob -types f -tails -directory ${destroot}${libdir} -- *.dylib]
320    ui_info "Correcting library entries in plugins..."
321
322    foreach {flt} [glob -types f -tails -directory ${destroot}${fltdir} *] {
323        # glob gives us files and links to files but should be no links in filters dir
324        ui_debug "... for ${flt}"
325
326        set otool [lrange [split [exec otool -L ${destroot}${fltdir}/${flt}] \n] 1 end]
327
328        foreach {otoolentry} ${otool} {
329            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
330            # assume anything without a leading slash needs fixing
331            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
332            if  { ${firstchar} != "/" }  {
333                set lib [lindex ${otoolentry} 0]
334                if { [ lsearch $liblist ${lib} ] > 0 } {
335                    set goodprefix ${libdir}
336                } else {
337                    set goodprefix ${fltdir}
338                }
339                ui_debug "      Change ${lib} to ${goodprefix}/[file tail ${lib}]"
340                system "install_name_tool -change \
341                    ${lib} \
342                    ${goodprefix}/[file tail ${lib}] \
343                    ${destroot}${fltdir}/${flt}"
344            }
345        }
346    }
347}
348
349universal_variant           no
350
351post-activate {
352    # delete leftover file, if any
353    if [file exists /Library/LaunchDaemons/${plistfile}] {
354        file delete -force /Library/LaunchDaemons/${plistfile}
355    }
356    # The startupitem.install keyword does not exist in MacPorts < 2.1.
357    if {![info exists startupitem.install]} {
358        set startupitem.install yes
359    }
360    # If "startupitem.install" is set to "no" in macports.conf then do not link.
361    if {${startupitem.install} != "no"} {
362        ln -s ${plistdir}/${plistfile} /Library/LaunchDaemons
363    }
364}
365
366pre-deactivate {
367     file delete -force ${plistdir}/${plistfile}
368}
369
370notes "############################################################################
371#
372# See http://www.mythtv.org/wiki/Myth_for_Mac_with_MacPorts for information
373# essential to finishing the installation of MythTV!
374#
375# NB -
376# For troubleshooting, all Myth-related logs are stored in
377# ${mythtvlogdir}
378#
379############################################################################"
380
381livecheck.version       ${version}
382livecheck.regex         "tarball/v(0.25\[^\"\]+)"
Note: See TracBrowser for help on using the repository browser.