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

Last change on this file was 154076, checked in by mojca@…, 11 months ago

mythtv, mythweb: switch to perl5.24 (#52081)

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