Skip to content

Commit

Permalink
libvpx: use newer commit to support arm64
Browse files Browse the repository at this point in the history
rework universal building to current MP standards
  • Loading branch information
kencu committed Feb 5, 2021
1 parent d78818b commit 66dece4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 99 deletions.
129 changes: 60 additions & 69 deletions multimedia/libvpx/Portfile
Expand Up @@ -31,30 +31,21 @@ fetch.type git
git.url https://chromium.googlesource.com/webm/${name}
git.branch v${version}

# support for non-intel archs removed in version 1.5.0
supported_archs x86_64 i386 arm64
# on BigSur or newer, use a recent 20210203 commit with the arm64 fixes in it
# because we also need to support +universal, do this for all builds for now

depends_build-append port:yasm

patchfiles patch-build-make-configure.sh.diff \
patch-Makefile.diff
if {${os.platform} eq "darwin" && ${os.major} >= 20} {
git.branch 5a4cfa95630ee3ebb5d74cd6c21336492e8707a4
version 1.9.0-20210203
}

# clang 425.0.28 with libvpx-1.4.0:
# vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c:77:16: error: assigning to '__m256i' from incompatible type 'int'
# filtersReg32 = MM256_BROADCASTSI128_SI256(filtersReg);
# ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# apple gcc-4.2 with libvpx-1.6.0:
# vp9/encoder/x86/vp9_frame_scale_ssse3.c: In function ‘eight_tap_row_ssse3’:
# vp9/encoder/x86/vp9_frame_scale_ssse3.c:93: internal compiler error: Segmentation fault
# {standard input}:unknown:Undefined local symbol LC2
# support for non-intel archs removed in version 1.5.0
supported_archs x86_64 i386 arm64

compiler.blacklist *gcc-3.* *gcc-4.* {clang < 800} macports-clang-3.3 macports-clang-3.4 macports-clang-3.7
# Make sure that mp-clang-5.0 is picked if all compilers were blacklisted.
# Especially important for 10.6 on libc++, since the fallback list contains macports-clang-3.7
# as the first, and thus selected, fallback option (even though it has been blacklisted earlier).
compiler.fallback-append macports-clang-5.0 macports-clang-6.0 macports-clang-7.0 macports-clang-8.0
patchfiles patch-Makefile.diff

license_noconflict clang-5.0 clang-6.0 clang-7.0
# uses newer assembly features on Intel
compiler.blacklist-append {*gcc-[3-4].*} {clang < 800} {macports-clang-3.*}

# As of 1.7.0: builds both static and shared libraries
# doesn't install docs or examples correctly, so disable them.
Expand All @@ -64,73 +55,73 @@ configure.args --enable-vp8 \
--enable-pic \
--enable-postproc \
--enable-multithread \
--enable-runtime-cpu-detect \
--enable-experimental \
--enable-shared \
--disable-install-docs \
--disable-debug-libs \
--disable-examples \
--disable-unit-tests

# libvpx does not yet support runtime detection of NEON features on macOS/iOS.
# For arm64 builds (and universal builds targeting arm) we disable this feature,
# meaning NEON support is determined at compile time.
# For x86* architectures in universal builds, this feature is re-enabled below.
if { ${build_arch} eq "arm64" || [variant_isset universal] } {
configure.args-delete --enable-runtime-cpu-detect
build.target
build.args verbose=1
destroot.args verbose=1

if {![info exists universal_possible]} {
set universal_possible [expr {${os.universal_supported} && [llength ${configure.universal_archs}] >= 2}]
}

configure.env LD=${configure.cc}
if {${universal_possible} && [variant_isset universal]} {

# add in when docs are installed correctly
#variant docs description {Build documentation} {
# depends_build-append path:bin/php:php5 port:doxygen
# configure.args-delete --disable-install-docs
# configure.args-append --enable-install-docs
#}
# universal build using muniversal portgroup

build.target
build.args verbose=1
foreach my_arch {i386 x86_64 arm64} {

destroot.args verbose=1
# strip the automatic setting of host
set merger_host(${my_arch}) ""

# Build fix for MacPorts clang-3.5 and later:
#
# This is an intentional change to Clang. It now parses the assembly output by default even when emitting assembly so that the diagnostics are consistent between "clang -c" and "clang -S".
# The solution is either to pass -fno-integrated-as to the compiler, or change the assembly produced (& probably the script that processes it) so that it's valid. Note that commenting out the line won't work: comments get stripped by the same process.
# Current Xcode versions of clang > 602 corresponding to Xcode 6.3 or greater also need this fix.

if {[string match {macports-clang-3.[5-9]} ${configure.compiler}] ||
[string match {macports-clang-[4-9].*} ${configure.compiler}] ||
[string match {macports-clang-[1-9][0-9].*} ${configure.compiler}] ||
(${configure.compiler} eq "clang" && [compiler.command_line_tools_version ${configure.compiler}] > 602)} {
build.args-append CFLAGS_S=-fno-integrated-as
}
# force the target
set merger_configure_args(${my_arch}) --force-target=${my_arch}-${os.platform}${os.major}-gcc

# set LD
set merger_configure_env(${my_arch}) LD=${configure.cc}
}

configure.universal_args-delete --disable-dependency-tracking
if {"x86_64" in ${configure.universal_archs} || "i386" in ${configure.universal_archs}} {
depends_build-append port:yasm
depends_skip_archcheck-append yasm

# As of 1.5.0 ppc build targets are no longer supported
# for Intel archs, allow runtime cpu detection
lappend merger_configure_args(i386) --enable-runtime-cpu-detect
lappend merger_configure_args(x86_64) --enable-runtime-cpu-detect

set my_targets(i386) x86
set my_targets(x86_64) x86_64
# parses the assembly output by default even when emitting assembly
if {[string match {*clang*} ${configure.compiler}]} {
lappend merger_build_args(i386) CFLAGS_S=-fno-integrated-as
lappend merger_build_args(x86_64) CFLAGS_S=-fno-integrated-as
}

# We must specify the target, otherwise the configure script will guess,
# and that may not match what the user requested in macports.conf.
foreach my_arch {i386 x86_64} {
set merger_host(${my_arch}) ""
if {[info exists my_targets(${my_arch})]} {
set merger_configure_args(${my_arch}) --force-target=$my_targets(${my_arch})-${os.platform}-gcc
}
lappend merger_configure_args(${my_arch}) --enable-runtime-cpu-detect
}
if {![info exists universal_possible]} {
set universal_possible [expr {${os.universal_supported} && [llength ${configure.universal_archs}] >= 2}]
}
if {!${universal_possible} || ![variant_isset universal]} {
if {[info exists merger_configure_args(${build_arch})]} {
configure.args-append $merger_configure_args(${build_arch})
} else {
configure.args-append --force-target=${os.arch}-${os.platform}-gcc

} else {

# normal build

# force the target
configure.args-append --force-target=${configure.build_arch}-${os.platform}${os.major}-gcc

# set LD
configure.env-append LD=${configure.cc}

if {${configure.build_arch} in {i386 x86_64}} {
depends_build-append port:yasm
depends_skip_archcheck-append yasm

configure.args-append --enable-runtime-cpu-detect

# parses the assembly output by default even when emitting assembly
if {[string match {*clang*} ${configure.compiler}]} {
build.args-append CFLAGS_S=-fno-integrated-as
}
}
}

Expand Down
30 changes: 0 additions & 30 deletions multimedia/libvpx/files/patch-build-make-configure.sh.diff

This file was deleted.

0 comments on commit 66dece4

Please sign in to comment.