Ticket #50703: ffmpeg.diff

File ffmpeg.diff, 6.0 KB (added by RJVB (René Bertin), 8 years ago)
  • multimedia/ffmpeg/Portfile

    old new  
    1111conflicts           ffmpeg-devel
    1212epoch               1
    1313version             2.8.6
     14# the actual compat_version would be something like 24 but that looks weird and
     15# the first ABI change after v2.4.0 came at v3.0.0 so we can just use "2"
     16set compat_version  2
    1417revision            1
    1518license             LGPL-2.1+
    1619categories          multimedia
     
    6063                    port:gmake \
    6164                    port:texinfo
    6265
     66# subport ffmpeg-${compat_version} {
     67#     description-append \
     68#                     This is a legacy port that with the latest version of the FFMpeg 2.4 - 2.8.6 ABI
     69#     long_description-append \
     70#                     This is a legacy port that with the latest version of the FFMpeg 2.4 - 2.8.6 ABI
     71#     # the tricky bit is that this subport conflicts with port:ffmpeg as long as that one still contains
     72#     # the same ABI (v 2.8.6) and is installed using the same "-24" suffices.
     73#     # that's why this subport is commented for now.
     74# }
     75
    6376# libvpx is static only so can be considered a build dependency (#47934)
    6477
    6578depends_build-append \
     
    107120default_variants-append +gpl2
    108121
    109122configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
    110 configure.args      --enable-swscale \
     123configure.args      --progs-suffix="-${compat_version}" --build-suffix="-${compat_version}" \
     124                    --incdir=${prefix}/include/ffmpeg-${compat_version} \
     125                    --datadir=${prefix}/share/ffmpeg-${compat_version} \
     126                    --docdir=${prefix}/share/doc/ffmpeg-${compat_version} \
     127                    --mandir=${prefix}/share/doc/ffmpeg-${compat_version}/man \
     128                    --enable-swscale \
    111129                    --enable-avfilter \
    112130                    --enable-avresample \
    113131                    --enable-libmp3lame \
     
    134152                    --disable-outdev=xv \
    135153                    --disable-vda \
    136154                    --disable-videotoolbox \
    137                     --mandir=${prefix}/share/man \
    138155                    --enable-shared --enable-pthreads \
    139156                    --cc=${configure.cc}
    140157
     
    183200#
    184201
    185202post-destroot {
    186     file mkdir ${destroot}${prefix}/share/doc/ffmpeg
    187     file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg
     203    xinstall -m 755 -d ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
     204    file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
    188205    foreach f [glob ${worksrcpath}/doc/*.txt] {
    189         file copy $f ${destroot}${prefix}/share/doc/ffmpeg
     206        file copy $f ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}
     207    }
     208    # install suffix-less symlinks to the suffixed shared libraries,
     209    # unwanted symlinks will be cleaned up below
     210    foreach f [glob -nocomplain ${destroot}${prefix}/lib/lib*-${compat_version}*.dylib] {
     211        set dst [file tail ${f}]
     212        set lf [strsed ${dst} "s/-${compat_version}//"]
     213        ln -s ${dst} ${destroot}${prefix}/lib/${lf}
     214    }
     215    if {${subport} ne "${name}-${compat_version}"} {
     216        # if we're not installing as a legacy port, install symlinks that hide the fact that we're using
     217        # a suffix
     218        foreach m [glob -nocomplain ${destroot}${prefix}/share/doc/ffmpeg-${compat_version}/man/*] {
     219            set md [file tail ${m}]
     220            foreach f [glob -nocomplain ${m}/*] {
     221                set dst [file tail ${f}]
     222                file delete -force ${destroot}${prefix}/share/man/${md}/${dst}
     223                ln -s ../../doc/ffmpeg-${compat_version}/man/${md}/${dst} ${destroot}${prefix}/share/man/${md}/${dst}
     224            }
     225        }
     226        foreach f [glob -nocomplain ${destroot}${prefix}/bin/*-${compat_version}] {
     227            set dst [file tail ${f}]
     228            set lf [strsed ${dst} "s/-${compat_version}//"]
     229            ln -s ${dst} ${destroot}${prefix}/bin/${lf}
     230        }
     231        foreach f [glob -nocomplain ${destroot}${prefix}/lib/pkgconfig/*-${compat_version}.pc] {
     232            set dst [file tail ${f}]
     233            set lf [strsed ${dst} "s/-${compat_version}//"]
     234            ln -s ${dst} ${destroot}${prefix}/lib/pkgconfig/${lf}
     235        }
     236        foreach f [glob -nocomplain ${destroot}${prefix}/lib/lib*-${compat_version}*.a] {
     237            set dst [file tail ${f}]
     238            set lf [strsed ${dst} "s/-${compat_version}//"]
     239            ln -s ${dst} ${destroot}${prefix}/lib/${lf}
     240        }
     241    } else {
     242        # legacy mode: remove symlinked shared libraries that shouldn't be there (= only leave the runtime libraries)
     243        foreach f {libavcodec libavdevice libavfilter libavformat libavresample libavutil libpostproc libswresample libswscale} {
     244            set lf ${destroot}${prefix}/lib/${f}
     245            if {[file exists ${lf}]} {
     246                file delete -force ${lf}
     247            }
     248        }
    190249    }
    191250}
    192251
     
    268327# make libx265 support optional via +libx265 variant
    269328# only define variant for non-universal builds on 10.6 or greater
    270329
    271 platform darwin {
    272     if {${os.major} > 8 && [variant_isset gpl2] && ![variant_isset universal]} {
    273         variant libx265 description {Build with support for encoding HEVC video using libx265} {
    274             configure.args-append   --enable-libx265
    275             depends_lib-append      port:x265
    276         }
     330# there is either no need to check for darwin before considering supporting a libx265 variant
     331# or else one should test for "!darwin OR os.major > 8".
     332# platform darwin {
     333if { (${os.platform} ne "darwin" || ${os.major} > 8) && [variant_isset gpl2] && ![variant_isset universal]} {
     334    variant libx265 description {Build with support for encoding HEVC video using libx265} {
     335        configure.args-append   --enable-libx265
     336        depends_lib-append      port:x265
    277337    }
    278338}
     339# }
    279340
    280341variant high10 requires gpl2 description {Build using libx264 with 10-bit output} {}
    281342