source: trunk/dports/multimedia/mythtv-core.27/Portfile @ 139229

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

misc: Change port:openssl dependency to path:lib/libssl.dylib:openssl

This should allow usage of libressl as a replacement for openssl in relevant
ports. Not all ports have been tested, but libressl aims for API
compatibility with OpenSSL, so it is expected to work.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 18.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 139229 2015-08-08 03:10:35Z jeremyhu@macports.org $
3
4PortSystem          1.0
5PortGroup           github 1.0
6PortGroup           qt4 1.0
7PortGroup           compiler_blacklist_versions 1.0
8
9set shorthash       f1115fcd
10# set fullhash      f1115fcd2b5cef93e870f926f53bf32cf546da9d
11set majorversion    .27
12set minorversion    .4
13revision            2
14github.setup        MythTV mythtv ${shorthash}
15checksums           rmd160  192da2f27a4ee9a5079896ca51aff80413dfeab3 \
16                    sha256  6eec6b1d09b914028a3ac0ec3664519ca1e805b21708bf6bff9a0f658f666865
17
18name                mythtv-core${majorversion}
19version             0${majorversion}${minorversion}-Fixes-20150304
20categories          multimedia
21platforms           darwin
22# i386 unsupported -- https://trac.macports.org/ticket/40337
23supported_archs     x86_64
24license             GPL-2
25maintainers         ctreleaven openmaintainer
26
27description         personal video recorder (PVR) and media centre system
28long_description    The ultimate Digital Video Recorder and home media \
29                    center hub. Think of it as a Free and Open Source alternative \
30                    to Windows Media Center or Tivo.
31
32homepage            http://www.mythtv.org/
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_Filldatabase Myth_Setup Myth_Stop_Start}
45set mysqlver        mariadb
46set perlver         perl5.16
47set perlbin         ${prefix}/bin/${perlver}
48set perlmodver      p5.16
49set pythonver       python2.7
50set pythonbin       ${prefix}/bin/${pythonver}
51set pymodver        py27
52
53depends_lib         port:bzip2 \
54                    port:libass \
55                    port:libcdio \
56                    port:libdvdcss \
57                    port:libiconv \
58                    port:libxml2 \
59                    port:fftw-3-single \
60                    port:freetype \
61                    port:lame \
62                    port:faac \
63                    port:x264 \
64                    path:lib/libssl.dylib:openssl \
65                    port:qt4-mac \
66                    port:qt4-mac-${mysqlver}-plugin \
67                    port:taglib \
68                    port:zlib \
69                    port:${pymodver}-mysql \
70                    port:${pymodver}-lxml \
71                    port:${pymodver}-urlgrabber \
72                    port:${perlmodver}-dbd-mysql \
73                    port:${perlmodver}-http-request-ascgi \
74                    port:${perlmodver}-lwp-useragent-determined \
75                    port:${perlmodver}-io-socket-inet6 \
76                    port:${perlmodver}-datemanip \
77                    port:${perlmodver}-net-upnp
78
79depends_build       port:yasm  port:pkgconfig
80
81conflicts           mythtv-core.25 mythtv-core.26
82
83depends_run         port:logrotate
84
85pre-fetch {
86    if {${os.platform} eq "darwin" && ${os.major} < 9} {
87        ui_error "${name} ${version} requires Mac OS X 10.5 or greater."
88        return -code error "incompatible Mac OS X version"
89    }
90}
91
92# revert rpath linking stuff as it is non-functional in MacPorts
93patchfiles-append   patch-rpath_linking.diff
94
95post-extract {
96    file mkdir ${worksrcpath}/macports
97    foreach {applescript} ${applescripts} {
98        copy ${filespath}/${applescript}.applescript ${worksrcpath}/macports/${applescript}.applescript
99    }
100    copy ${filespath}/${plistfile} ${worksrcpath}/macports/${plistfile}
101    copy ${filespath}/logrotate.conf ${worksrcpath}/macports/logrotate.conf
102    copy ${filespath}/logrotate.mythtv ${worksrcpath}/macports/logrotate.mythtv
103    copy ${filespath}/my.cnf ${worksrcpath}/macports/my.cnf
104    copy ${filespath}/mythconverg_init.sql ${worksrcpath}/macports/mythconverg_init.sql
105}
106
107post-patch {
108    set sedPath ${worksrcpath}/mythtv/
109    ui_info "Make Myth utils use MacPorts Perl"
110    reinplace -locale C "s|check_cmd perl -e|check_cmd ${perlbin} -e|" \
111        ${sedPath}configure
112
113    reinplace -locale C "s|#!/usr/bin/env perl|#!${perlbin}|" \
114        ${sedPath}programs/scripts/internetcontent/topdocumentaryfilm.pl  \
115        ${sedPath}programs/scripts/internetcontent/twit.tv.pl
116
117    reinplace -locale C "s|#!/usr/bin/perl|#!${perlbin}|" \
118        ${sedPath}bindings/perl/Makefile.PL  \
119        ${sedPath}bindings/perl/MythTV.pm  \
120        ${sedPath}contrib/maintenance/optimize_mythdb.pl  \
121        ${sedPath}contrib/user_jobs/mythlink.pl  \
122        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
123        ${sedPath}programs/scripts/database/mythconverg_restore.pl
124
125    reinplace -locale C "s|/usr/local/bin|${prefix}/lib/${mysqlver}/bin|"  \
126        ${sedPath}programs/scripts/database/mythconverg_backup.pl \
127        ${sedPath}programs/scripts/database/mythconverg_restore.pl
128
129    ui_info "Record Myth version strings"
130    reinplace -locale C "s#\${SOURCE_VERSION}#${mythverstring}#g" ${sedPath}version.sh
131    reinplace -locale C "s#\${BRANCH}#${mythbranch}#g" ${sedPath}version.sh
132
133    ui_info "Make Myth scripts use MacPorts Python  <<<<"
134    # Hack to install Python bindings in ${prefix}/Library/Frameworks/Python.framework/Versions/2.7
135    reinplace -locale C "s|\$(ROOT_FLAGS) \$(PREFIX_FLAGS)|\$(ROOT_FLAGS) \--prefix=\"${frameworks_dir}/Python.framework/Versions/2.7\"|" \
136        ${sedPath}/bindings/python/Makefile
137    reinplace -locale C "s|/usr/local|${prefix}|" ${worksrcpath}/mythtv/bindings/python/MythTV/static.py
138    fs-traverse f ${sedPath}/bindings/python/ {
139        if [string equal [ file extension ${f} ] ".py" ] {
140            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
141        }
142    }
143    fs-traverse f ${sedPath}/programs/scripts/ {
144        if [string equal [ file extension ${f} ] ".py" ] {
145            reinplace -locale C "s|^#! */usr/bin/env python\$|#!${pythonbin}|" ${f}
146        }
147    }
148    foreach f [glob -directory ${sedPath}/programs/scripts/hardwareprofile *.py] {
149    # fix even though they're currently non-functional on OS X
150        reinplace -locale C "s|^#!/usr/bin/python\$|#!${pythonbin}|" ${f}
151    }
152
153    foreach {applescript} ${applescripts} {
154        reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${applescript}.applescript
155        reinplace -locale C "s|@APPLICATIONS_DIR@|${applications_dir}|" ${worksrcpath}/macports/${applescript}.applescript
156        reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${applescript}.applescript
157        reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${applescript}.applescript
158    }
159    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/${plistfile}
160    reinplace -locale C "s|@PLISTLABEL@|${plistlabel}|g" ${worksrcpath}/macports/${plistfile}
161    reinplace -locale C "s|@PYTHONVER@|${pythonver}|" ${worksrcpath}/macports/${plistfile}
162    reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|" ${worksrcpath}/macports/${plistfile}
163    reinplace -locale C "s|@MYTHTVPIDFILE@|${mythtvpidfile}|" ${worksrcpath}/macports/${plistfile}
164    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/logrotate.conf
165    reinplace -locale C "s|@PREFIX@|${prefix}|g" ${worksrcpath}/macports/my.cnf
166    reinplace -locale C "s|@MYTHTVLOGDIR@|${mythtvlogdir}|g" ${worksrcpath}/macports/logrotate.mythtv
167    reinplace -locale C "s|xxxyyyzzz|${mythtvpidfile}|" ${worksrcpath}/mythtv/configure
168}
169# Block various compilers:
170#
171# (shamelessly stolen from Qt4-mac, thanks Michael!)
172# * Some older versions of CLANG do not honor the LIBRARY_PATH
173# environment variables, which is required for compiling
174# this port when using MacPorts.  The versions seem to be: MacPorts
175# CLANG 3.0 or earlier, and Apple CLANG 318.0.61 or older (XCode 4.3.3 and prior).
176#
177# See http://code.mythtv.org/trac/ticket/11070
178# Run-time failures experienced with certain versions of Clang.  Unable to discern cause.
179# Most recent version of clang seems OK, let's try again
180
181compiler.fallback-append apple-gcc-4.2
182compiler.blacklist-append { clang <= 500.2.79 } \
183    macports-clang*
184
185# Clear all MacPorts flags...MythTV is smart enough to set up its own.
186# (ala qt4-mac/Portfile)
187configure.cflags
188configure.cppflags
189configure.cxxflags
190configure.objcflags
191configure.ldflags
192
193configure.universal_cflags
194configure.universal_cppflags
195configure.universal_cxxflags
196configure.universal_ldflags
197
198configure.cc_archflags
199configure.cxx_archflags
200configure.ld_archflags
201
202configure.dir       ${worksrcpath}/mythtv
203configure.args      --compile-type=release \
204                    --qmake=${qt_qmake_cmd} \
205                    --cc=${configure.cc} \
206                    --cxx=${configure.cxx} \
207                    --python=${pythonbin} \
208                    --disable-mythlogserver \
209                    --disable-ceton \
210                    --disable-firewire \
211                    --disable-audio-jack --disable-indev=jack \
212                    --disable-audio-pulseoutput \
213                    --disable-libpulse \
214                    --disable-libvpx --disable-libxvid \
215                    --disable-qtdbus \
216                    --disable-sdl \
217                    --disable-xrandr \
218                    --disable-xv \
219                    --enable-libmp3lame \
220                    --enable-libass \
221                    --enable-fft \
222                    --enable-libx264 --enable-libfaac --enable-nonfree
223
224if {${configure.ccache} != "yes"} {
225    configure.args-append --disable-ccache
226}
227
228if {${configure.distcc} != "yes"} {
229    configure.args-append --disable-distcc
230}
231
232build.dir           ${worksrcpath}/mythtv
233# make Myth's copy of ffmpeg build verbosely
234build.env-append    V=1
235
236pre-build {
237    # workaround broken linker flags, see
238    # https://trac.macports.org/ticket/40136
239    reinplace -locale C "s|LDFLAGS=  |LDFLAGS= -headerpad_max_install_names |" ${worksrcpath}/mythtv/external/FFmpeg/config.mak
240
241    ui_info "Build Myth AppleScript helper apps"
242    # Compile applescrips
243    foreach {applescript} ${applescripts} {
244        system "osacompile -x -o ${worksrcpath}/macports/${applescript}.app ${worksrcpath}/macports/${applescript}.applescript"
245    }
246    # Myth custom icon for a couple of the applets
247    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Frontend.app/Contents/Resources/applet.icns
248    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${worksrcpath}/macports/Myth_Stop_Start.app/Contents/Resources/applet.icns
249}
250
251# All tests fail with messages like:
252# dyld: Library not loaded: @rpath//opt/local/lib/libmythbase-0.27.0.dylib
253#   Referenced from: /opt/local/var/macports/build/_Users_craigtreleaven_MacPortsTemp_mythtv-core-devel/mythtv-core.27/work/mythtv-8b542e20/mythtv/libs/././libmyth/test/test_audioconvert/test_audioconvert
254#   Reason: image not found
255# ../programs/scripts/unittests.sh: line 15: 41587 Trace/BPT trap          ./$RUNNABLE
256# Need to investigate why rpath not working under MacPorts...
257
258# test.run            yes
259
260destroot.destdir    INSTALL_ROOT=${destroot}
261
262post-destroot {
263# make some directories myth will need
264    xinstall -d -m 755 ${destroot}${mythtvhomedir}
265    xinstall -d -m 777 ${destroot}${mythtvlogdir}
266    xinstall -d -m 777 ${destroot}${mythtvlogdir}/old
267    xinstall -d -m 755 ${destroot}${prefix}/etc/logrotate.d
268    xinstall -d -m 744 ${destroot}${mythtvrundir}
269
270    destroot.keepdirs \
271        ${destroot}${mythtvhomedir} \
272        ${destroot}${mythtvlogdir} \
273        ${destroot}${mythtvlogdir}/old \
274        ${destroot}${mythtvrundir}
275
276# install logrotate.mythtv
277    xinstall -m 400 ${worksrcpath}/macports/logrotate.mythtv ${destroot}${prefix}/etc/logrotate.d
278
279# install the launchd plist for the backend
280    ui_info "Installing startupitem/launchd plist..."
281    xinstall -d -m 0755 ${destroot}${plistdir}
282    xinstall ${worksrcpath}/macports/${plistfile} ${destroot}${plistdir}
283
284# install scripts we want in share/contrib
285    ui_info "Installing share/$name/contrib scripts..."
286
287    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/database
288    xinstall -d -m 755 ${destroot}${prefix}/share/${nick}/contrib
289
290    xinstall -m 755 \
291        ${configure.dir}/database/mc.sql \
292        ${worksrcpath}/macports/mythconverg_init.sql \
293        ${worksrcpath}/macports/my.cnf \
294        ${destroot}${prefix}/share/${nick}/database
295    xinstall -m 755 \
296        ${configure.dir}/contrib/maintenance/optimize_mythdb.pl \
297        ${configure.dir}/contrib/user_jobs/mythlink.pl \
298        ${destroot}${prefix}/share/${nick}/contrib
299
300# install some simple Applescripts to launch common myth apps
301    ui_info "Installing Applescript helpers..."
302    # compile the Applescripts
303    xinstall -m 755 -d ${destroot}${applications_dir}/MythTV
304
305    foreach {applescript} ${applescripts} {
306        copy ${worksrcpath}/macports/${applescript}.app ${destroot}${applications_dir}/MythTV/${applescript}.app
307    }
308
309# Myth custom icon for a couple of the applets
310    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Frontend.app/Contents/Resources/applet.icns
311    copy -force ${configure.dir}/programs/mythfrontend/mythfrontend.icns ${destroot}${applications_dir}/MythTV/Myth_Stop_Start.app/Contents/Resources/applet.icns
312
313# Fix up library entries in dylibs and executables ...
314# need to loop on arch's if/when build universal ?!?
315    set libdir ${prefix}/lib
316
317    ui_info "Correcting library entries in dylibs..."
318
319    foreach {dylib} [glob -types f -tails -directory ${destroot}${libdir} *.dylib] {
320        # glob gives us both files and links to files
321        if { [file type ${destroot}${libdir}/${dylib}] == "file" } {
322            ui_debug "... for ${dylib}"
323            system "install_name_tool -id ${libdir}/${dylib} ${destroot}${libdir}/${dylib}"
324
325            set otool [lrange [split [exec otool -L ${destroot}${libdir}/${dylib}] \n] 1 end]
326
327            foreach {otoolentry} ${otool} {
328                # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
329                # assume anything without a leading slash needs fixing
330                set firstchar [string range [string trimleft ${otoolentry}] 0 0]
331                if  { ${firstchar} != "/" }  {
332                    set lib [lindex ${otoolentry} 0]
333                    ui_debug "      Change ${lib}  to  ${libdir}/[file tail ${lib}]"
334                    system "install_name_tool -change \
335                        ${lib} \
336                        ${libdir}/[file tail ${lib}] \
337                        ${destroot}${libdir}/${dylib}"
338                }
339            }
340        }
341    }
342    set bindir ${prefix}/bin
343    ui_info "Correcting library entries in executables..."
344
345    foreach {prog} [glob -types f -tails -directory ${destroot}${bindir} *] {
346        # glob gives us files and links to files but should be no links in bin dir
347        ui_debug "... for ${prog}"
348
349        set otool [lrange [split [exec otool -L ${destroot}${bindir}/${prog}] \n] 1 end]
350
351        foreach {otoolentry} ${otool} {
352            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
353            # assume anything without a leading slash needs fixing
354            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
355            if  { ${firstchar} != "/" }  {
356                set lib [lindex ${otoolentry} 0]
357                ui_debug "      Change ${lib} to ${libdir}/[file tail ${lib}]"
358                system "install_name_tool -change \
359                    ${lib} \
360                    ${libdir}/[file tail ${lib}] \
361                    ${destroot}${bindir}/${prog}"
362            }
363        }
364    }
365
366# fix lib entries in filters
367    set fltdir ${prefix}/lib/mythtv/filters
368    set liblist [glob -types f -tails -directory ${destroot}${libdir} -- *.dylib]
369    ui_info "Correcting library entries in plugins..."
370
371    foreach {flt} [glob -types f -tails -directory ${destroot}${fltdir} *] {
372        # glob gives us files and links to files but should be no links in filters dir
373        ui_debug "... for ${flt}"
374
375        set otool [lrange [split [exec otool -L ${destroot}${fltdir}/${flt}] \n] 1 end]
376
377        foreach {otoolentry} ${otool} {
378            # fix entries like "libmythswscale.dylib" to "${prefix}/lib/libmythswscale.dylib"
379            # assume anything without a leading slash needs fixing
380            set firstchar [string range [string trimleft ${otoolentry}] 0 0]
381            if  { ${firstchar} != "/" }  {
382                set lib [lindex ${otoolentry} 0]
383                if { [ lsearch $liblist ${lib} ] > 0 } {
384                    set goodprefix ${libdir}
385                } else {
386                    set goodprefix ${fltdir}
387                }
388                ui_debug "      Change ${lib} to ${goodprefix}/[file tail ${lib}]"
389                system "install_name_tool -change \
390                    ${lib} \
391                    ${goodprefix}/[file tail ${lib}] \
392                    ${destroot}${fltdir}/${flt}"
393            }
394        }
395    }
396}
397
398universal_variant           no
399
400post-activate {
401    # make logrotate ready to go
402    if {![file exists ${prefix}/etc/logrotate.conf]} {
403        file copy ${destroot}logrotate.conf ${prefix}/etc/logrotate.conf
404    }
405    # delete leftover file, if any
406    if [file exists /Library/LaunchDaemons/${plistfile}] {
407        file delete -force /Library/LaunchDaemons/${plistfile}
408    }
409    # The startupitem.install keyword does not exist in MacPorts < 2.1.
410    if {![info exists startupitem.install]} {
411        set startupitem.install yes
412    }
413    # If "startupitem.install" is set to "no" in macports.conf then do not link.
414    if {${startupitem.install} != "no"} {
415        ln -s ${plistdir}/${plistfile} /Library/LaunchDaemons
416    }
417}
418
419pre-deactivate {
420     file delete -force ${plistdir}/${plistfile}
421}
422
423notes "############################################################################
424#
425# See http://www.mythtv.org/wiki/Myth_for_Mac_with_MacPorts for information
426# essential to finishing the initial installation of MythTV!
427#
428# NB -
429# For troubleshooting, all Myth-related logs are stored in
430# ${mythtvlogdir}
431#
432# Upgrading after October 16, 2014?  Myth's database has changed from MySQL
433# v5.1 to MariaDB v5.5.  You should backup your old database and restore
434# it to the new version.  See the web page above for full details.
435#
436############################################################################"
437
438livecheck.version       ${majorversion}${minorversion}
439livecheck.regex         "archive/v(0.27\[\\.\\d\]?)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.