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

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

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

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 18.0 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           compiler_blacklist_versions 1.0
8
9set shorthash       1a4cebf79
10# set fullhash      1a4cebf795a1400987347f57faeb57cacd0805f9
11set majorversion    .26
12set minorversion    .1
13github.setup        MythTV mythtv ${shorthash}
14name                mythtv-core${majorversion}
15version             0${majorversion}${minorversion}-Fixes-20140321
16revision            5
17categories          multimedia
18platforms           darwin
19# i386 unsupported -- https://trac.macports.org/ticket/40337
20supported_archs     x86_64
21license             GPL-2
22maintainers         ctreleaven openmaintainer
23
24description         personal video recorder (PVR) and media centre system
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.
28
29homepage            http://www.mythtv.org/
30checksums           rmd160  46c249c9746e72ffceea40310bfdce00b6491192 \
31                    sha256  efe5a6d918e0be15896bc3bdd8a397f652d6aaee919381894cc6c6c7f69048be
32
33set nick            mythtv
34set mythtvhomedir   ${prefix}/var/mythtvuser
35set mythtvlogdir    ${prefix}/var/log/${nick}${majorversion}
36set mythtvrundir    ${prefix}/var/run/${nick}${majorversion}
37set mythtvpidfile   ${mythtvrundir}/${nick}
38set plistdir        ${prefix}/Library/LaunchDaemons
39set plistfiles      {org.mythtv.mythbackend.plist org.mythtv.mythlogserver.plist}
40set mythverstring   v0${majorversion}${minorversion}-${shorthash}-MacPorts
41set mythbranch      fixes/0${majorversion}
42set applescripts    {Myth_Frontend Myth_Filldatabase Myth_Setup Myth_Stop_Start}
43set mysqlver        mysql5
44set perlver         perl5.24
45set perlbin         ${prefix}/bin/${perlver}
46set perlmodver      p5.24
47set pythonver       python2.7
48set pythonbin       ${prefix}/bin/${pythonver}
49set pymodver        py27
50
51depends_lib         port:libdvdcss \
52                    port:freetype \
53                    port:lame \
54                    port:x264 \
55                    port:qt4-mac-${mysqlver}-plugin \
56                    port:libpng \
57                    port:${pymodver}-mysql \
58                    port:${pymodver}-lxml \
59                    port:${pymodver}-urlgrabber \
60                    port:${perlmodver}-dbd-mysql \
61                    port:${perlmodver}-http-request-ascgi \
62                    port:${perlmodver}-lwp-useragent-determined \
63                    port:${perlmodver}-io-socket-inet6 \
64                    port:${perlmodver}-datemanip \
65                    port:${perlmodver}-net-upnp
66
67depends_build       port:yasm  port:pkgconfig
68
69conflicts           mythtv-core.25 mythtv-core.27
70
71depends_run         port:logrotate
72
73# See http://code.mythtv.org/trac/ticket/11070
74# Run-time failures experienced with certain versions of Clang.  Unable to discern cause.
75# Most recent version of clang seems OK, let's try again
76
77compiler.fallback-append apple-gcc-4.2
78compiler.blacklist-append { clang <= 500.2.79 } \
79    macports-clang*
80
81pre-fetch {
82    if {${os.platform} eq "darwin" && ${os.major} < 9} {
83        ui_error "${name} ${version} requires Mac OS X 10.5 or greater."
84        return -code error "incompatible Mac OS X version"
85    }
86}
87
88# eliminate /usr/include
89patchfiles          patch-configure-configincludepath.diff
90
91#fix libmythtv linking against prior installed versions
92# see mythtv-dev thread, committed to master
93patchfiles-append   patch-libs_fix_linking.diff
94
95# following three patches currently required to support MythExpress
96# See tickets:
97#    http://code.mythtv.org/trac/ticket/10773
98#    http://code.mythtv.org/trac/ticket/10825
99#    http://code.mythtv.org/trac/ticket/11032
100patchfiles-append   patch-bonjour-correction.diff \
101                    patch-protect-metadata-loads-from-multiple-threads.diff \
102                    patch-restore-fe-netcontrol-play-resume-functionality.diff
103
104# Clang fixes committed to 0.27-fixes but not 0.26-fixes
105#  https://github.com/MythTV/mythtv/commit/f5e61804d7a8ad6afc4aa4484e2c05f24ddb396b
106patchfiles-append   patch-clang_fixes.diff
107
108# patches to support freetype 2.5.1 changes to include layout
109#  http://code.mythtv.org/trac/ticket/11967
110patchfiles-append   patch-freetype-2.5.1.diff
111
112post-extract {
113    file mkdir ${worksrcpath}/macports
114    foreach {applescript} ${applescripts} {
115        copy ${filespath}/${applescript}.applescript ${worksrcpath}/macports/${applescript}.applescript
116    }
117    foreach {plist} ${plistfiles} {
118        copy ${filespath}/${plist} ${worksrcpath}/macports/${plist}
119    }
120    copy ${filespath}/logrotate.conf ${worksrcpath}/macports/logrotate.conf
121    copy ${filespath}/logrotate.mythtv ${worksrcpath}/macports/logrotate.mythtv
122}
123
124post-patch {
125    set sedPath ${worksrcpath}/mythtv/
126    ui_info "Make Myth utils use MacPorts Perl"
127    reinplace -locale C "s|check_cmd perl -e|check_cmd ${perlbin} -e|" \
128        ${sedPath}configure
129
130    reinplace -locale C "s|#!/usr/bin/env perl|#!${perlbin}|" \
131        ${sedPath}programs/scripts/internetcontent/topdocumentaryfilm.pl  \
132        ${sedPath}programs/scripts/internetcontent/twit.tv.pl
133
134    reinplace -locale C "s|#!/usr/bin/perl|#!${perlbin}|" \
135        ${sedPath}bindings/perl/Makefile.PL  \
136        ${sedPath}bindings/perl/MythTV.pm  \
137        ${sedPath}contrib/maintenance/optimize_mythdb.pl  \
138        ${sedPath}contrib/user_jobs/mythlink.pl  \
139        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
140        ${sedPath}programs/scripts/database/mythconverg_restore.pl
141
142    reinplace -locale C "s|/usr/local/bin|${prefix}/lib/${mysqlver}/bin|"  \
143        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
144        ${sedPath}programs/scripts/database/mythconverg_restore.pl
145
146    ui_info "Record Myth version strings"
147    reinplace -locale C "s#\${SOURCE_VERSION}#${mythverstring}#g" ${sedPath}version.sh
148    reinplace -locale C "s#\${BRANCH}#${mythbranch}#g" ${sedPath}version.sh
149
150    ui_info "Make Myth scripts use MacPorts Python  <<<<"
151    # Hack to install Python bindings in ${prefix}/Library/Frameworks/Python.framework/Versions/2.7
152    reinplace -locale C "s|\$(ROOT_FLAGS) \$(PREFIX_FLAGS)|\$(ROOT_FLAGS) \--prefix=\"${frameworks_dir}/Python.framework/Versions/2.7\"|" \
153        ${sedPath}/bindings/python/Makefile
154    reinplace -locale C "s|/usr/local|${prefix}|" ${worksrcpath}/mythtv/bindings/python/MythTV/static.py
155    reinplace -locale C "s|#!python|#!${pythonbin}|" \
156        ${worksrcpath}/mythtv/bindings/python/scripts/mythpython \
157        ${worksrcpath}/mythtv/bindings/python/scripts/mythwikiscripts
158    fs-traverse f ${sedPath}/bindings/python/ {
159        if [string equal [ file extension ${f} ] ".py" ] {
160            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
161        }
162    }
163    fs-traverse f ${sedPath}/programs/scripts/ {
164        if [string equal [ file extension ${f} ] ".py" ] {
165            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
166        }
167    }
168    foreach f [glob -directory ${sedPath}/programs/scripts/hardwareprofile *.py] {
169    # fix even though they're currently non-functional on OS X
170        reinplace -locale C "s|^#!/usr/bin/python\$|#!${pythonbin}|" ${f}
171    }
172
173    foreach {applescript} ${applescripts} {
174        reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${applescript}.applescript
175        reinplace -locale C "s|@APPLICATIONS_DIR@|${applications_dir}|" ${worksrcpath}/macports/${applescript}.applescript
176        reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${applescript}.applescript
177        reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${applescript}.applescript
178    }
179    foreach {plist} ${plistfiles} {
180        reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${plist}
181        reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${plist}
182        reinplace -locale C "s|@PYTHONVER@|${pythonver}|" ${worksrcpath}/macports/${plist}
183        reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${plist}
184    }
185    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/logrotate.conf
186    reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|g" ${worksrcpath}/macports/logrotate.mythtv
187    reinplace -locale C "s|xxxyyyzzz|${mythtvpidfile}|" ${worksrcpath}/mythtv/configure
188#    reinplace -locale C "s|--includedir=|CC=${configure.cc} CXX=${configure.cxx} --includedir=|" \
189#        ${worksrcpath}/mythtv/external/Makefile
190}
191
192################################################################################
193# Let Myth set its own flags... (ala qt4-mac)                                  #
194################################################################################
195
196# except workaround broken configure handling of freetype
197configure.cflags    -I${prefix}//include/freetype2
198configure.cppflags
199configure.cxxflags
200configure.objcflags
201configure.ldflags
202
203configure.universal_cflags
204configure.universal_cppflags
205configure.universal_cxxflags
206configure.universal_ldflags
207
208configure.cc_archflags
209configure.cxx_archflags
210configure.ld_archflags
211
212configure.dir       ${worksrcpath}/mythtv
213configure.args      --compile-type=release \
214                    --runprefix=${prefix} \
215                    --cc=${configure.cc} \
216                    --cxx=${configure.cxx} \
217                    --qmake=${qt_qmake_cmd} \
218                    --python=${pythonbin} \
219                    --disable-ceton \
220                    --disable-firewire \
221                    --disable-audio-jack --disable-indev=jack \
222                    --disable-libvpx --disable-libxvid \
223                    --disable-qtdbus \
224                    --disable-sdl \
225                    --disable-xrandr \
226                    --enable-libfreetype \
227                    --enable-libmp3lame --enable-libx264
228
229if {${configure.ccache} != "yes"} {
230    configure.args-append --disable-ccache
231}
232
233if {${configure.distcc} != "yes"} {
234    configure.args-append --disable-distcc
235}
236
237build.dir           ${worksrcpath}/mythtv
238
239pre-build {
240    ui_info "Build Myth AppleScript helper apps"
241    # Compile applescrips
242    foreach {applescript} ${applescripts} {
243        system "osacompile -x -o ${worksrcpath}/macports/${applescript}.app ${worksrcpath}/macports/${applescript}.applescript"
244    }
245    # Myth custom icon for a couple of the applets
246    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Frontend.app/Contents/Resources/applet.icns
247    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Stop_Start.app/Contents/Resources/applet.icns
248}
249
250destroot.destdir    INSTALL_ROOT=${destroot}
251
252post-destroot {
253# make some directories myth will need
254    xinstall -d -m 755 ${destroot}${mythtvhomedir}
255    xinstall -d -m 777 ${destroot}${mythtvlogdir}
256    xinstall -d -m 777 ${destroot}${mythtvlogdir}/old
257    xinstall -d -m 755 ${destroot}${prefix}/etc/logrotate.d
258    xinstall -d -m 744 ${destroot}${mythtvrundir}
259
260    destroot.keepdirs \
261        ${destroot}${mythtvhomedir} \
262        ${destroot}${mythtvlogdir} \
263        ${destroot}${mythtvlogdir}/old \
264        ${destroot}${mythtvrundir}
265
266# install logrotate.mythtv
267    xinstall -m 400 ${worksrcpath}/macports/logrotate.mythtv ${destroot}${prefix}/etc/logrotate.d
268
269# install the launchd plist for the backend
270    ui_info "Installing startupitem/launchd plist..."
271    xinstall -d -m 0755 ${destroot}${plistdir}
272    foreach {plist} ${plistfiles} {
273        xinstall ${worksrcpath}/macports/${plist} ${destroot}${plistdir}
274    }
275
276# install scripts we want in share/contrib
277    ui_info "Installing share/$name/contrib scripts..."
278
279    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/database
280    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/contrib
281
282    xinstall -m 755 \
283        ${configure.dir}/database/mc.sql \
284        ${destroot}${prefix}/share/${nick}/database
285    xinstall -m 755 \
286        ${configure.dir}/contrib/maintenance/optimize_mythdb.pl \
287        ${configure.dir}/contrib/user_jobs/mythlink.pl \
288        ${destroot}${prefix}/share/${nick}/contrib
289
290# install some simple Applescripts to launch common myth apps
291    ui_info "Installing Applescript helpers..."
292    # compile the Applescripts
293    xinstall -m 755 -d ${destroot}${applications_dir}/MythTV
294
295    foreach {applescript} ${applescripts} {
296        copy ${worksrcpath}/macports/${applescript}.app ${destroot}${applications_dir}/MythTV/${applescript}.app
297    }
298
299# Myth custom icon for a couple of the applets
300    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Frontend.app/Contents/Resources/applet.icns
301    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Stop_Start.app/Contents/Resources/applet.icns
302
303# Fix up library entries in dylibs and executables ...
304# need to loop on arch's if/when build universal ?!?
305    set libdir ${prefix}/lib
306
307    ui_info "Correcting library entries in dylibs..."
308
309    foreach {dylib} [glob -types f -tails -directory ${destroot}${libdir} *.dylib] {
310        # glob gives us both files and links to files
311        if { [file type ${destroot}${libdir}/${dylib}] == "file" } {
312            ui_debug "... for ${dylib}"
313            system "install_name_tool -id ${libdir}/${dylib} ${destroot}${libdir}/${dylib}"
314
315            set otool [lrange [split [exec otool -L ${destroot}${libdir}/${dylib}] \n] 1 end]
316
317            foreach {otoolentry} ${otool} {
318                # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
319                # assume anything without a leading slash needs fixing
320                set firstchar [string range [string trimleft ${otoolentry}] 0 0]
321                if  { ${firstchar} != "/" }  {
322                    set lib [lindex ${otoolentry} 0]
323                    ui_debug "      Change ${lib}  to  ${libdir}/[file tail ${lib}]"
324                    system "install_name_tool -change \
325                        ${lib} \
326                        ${libdir}/[file tail ${lib}] \
327                        ${destroot}${libdir}/${dylib}"
328                }
329            }
330        }
331    }
332    set bindir ${prefix}/bin
333    ui_info "Correcting library entries in executables..."
334
335    foreach {prog} [glob -types f -tails -directory ${destroot}${bindir} *] {
336        # glob gives us files and links to files but should be no links in bin dir
337        ui_debug "... for ${prog}"
338
339        set otool [lrange [split [exec otool -L ${destroot}${bindir}/${prog}] \n] 1 end]
340
341        foreach {otoolentry} ${otool} {
342            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
343            # assume anything without a leading slash needs fixing
344            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
345            if  { ${firstchar} != "/" }  {
346                set lib [lindex ${otoolentry} 0]
347                ui_debug "      Change ${lib} to ${libdir}/[file tail ${lib}]"
348                system "install_name_tool -change \
349                    ${lib} \
350                    ${libdir}/[file tail ${lib}] \
351                    ${destroot}${bindir}/${prog}"
352            }
353        }
354    }
355
356# fix lib entries in filters
357    set fltdir ${prefix}/lib/mythtv/filters
358    set liblist [glob -types f -tails -directory ${destroot}${libdir} -- *.dylib]
359    ui_info "Correcting library entries in plugins..."
360
361    foreach {flt} [glob -types f -tails -directory ${destroot}${fltdir} *] {
362        # glob gives us files and links to files but should be no links in filters dir
363        ui_debug "... for ${flt}"
364
365        set otool [lrange [split [exec otool -L ${destroot}${fltdir}/${flt}] \n] 1 end]
366
367        foreach {otoolentry} ${otool} {
368            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
369            # assume anything without a leading slash needs fixing
370            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
371            if  { ${firstchar} != "/" }  {
372                set lib [lindex ${otoolentry} 0]
373                if { [ lsearch $liblist ${lib} ] > 0 } {
374                    set goodprefix ${libdir}
375                } else {
376                    set goodprefix ${fltdir}
377                }
378                ui_debug "      Change ${lib} to ${goodprefix}/[file tail ${lib}]"
379                system "install_name_tool -change \
380                    ${lib} \
381                    ${goodprefix}/[file tail ${lib}] \
382                    ${destroot}${fltdir}/${flt}"
383            }
384        }
385    }
386}
387
388universal_variant           no
389
390post-activate {
391    # make logrotate ready to go
392    if {![file exists ${prefix}/etc/logrotate.conf]} {
393        file copy ${destroot}logrotate.conf ${prefix}/etc/logrotate.conf
394    }
395    # delete leftover files, if any
396    foreach {plist} ${plistfiles} {
397        if [file exists /Library/LaunchDaemons/${plist}] {
398            file delete -force /Library/LaunchDaemons/${plist}
399        }
400    }
401    # The startupitem.install keyword does not exist in MacPorts < 2.1.
402    if {![info exists startupitem.install]} {
403        set startupitem.install yes
404    }
405    # If "startupitem.install" is set to "no" in macports.conf then do not link.
406    if {${startupitem.install} != "no"} {
407        foreach {plist} ${plistfiles} {
408            ln -s ${plistdir}/${plist} /Library/LaunchDaemons
409        }
410    }
411}
412
413pre-deactivate {
414    foreach {plist} ${plistfiles} {
415        file delete -force ${plistdir}/${plist}
416    }
417}
418
419notes "############################################################################
420#
421# See http://www.mythtv.org/wiki/Myth_for_Mac_with_MacPorts for information
422# essential to finishing the installation of MythTV!
423#
424# NB -
425# For troubleshooting, all Myth-related logs are stored in
426# ${mythtvlogdir}
427#
428############################################################################"
429
430livecheck.version       ${majorversion}${minorversion}
431livecheck.regex         "archive/v(0${majorversion}\[\\.\\d\]?)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.