Created attachment 248984 [details] Patch for opus * Switch to Meson, builds much faster than Autotools and integrates with ports framework better [1] * Add option for NEON instructions on ARMv6 and ARMv7 * Import upstream PR https://github.com/xiph/opus/pull/286 with minor cosmetic adjustment * Add runtime detection patches for ARMv6, ARMv7 and Aarch64 by fuz@ (planned to be upstreamed) 1: https://gitlab.xiph.org/xiph/opus/-/blob/v1.5.1/meson/README.md Compile and runtime tested on FreeBSD 14.0-RELEASE (aarch64) (make, make check-plist, make test) Compile and runtime tested on FreeBSD 14.0-RELEASE (amd64) (make, make check-plist, make test) Tested on ARM 32-bit by fuz@ Poudriere testport OK 13.2-RELEASE (amd64) Poudriere testport OK 14.0-RELEASE (amd64) Tested with following users in Poudriere (13.2-RELEASE, amd64): audio/audacity audio/easytag audio/gogglesmm audio/gstreamer1-plugins-opus audio/jack audio/jack-example-tools audio/kwave audio/libopusenc audio/libsndfile audio/mixxx audio/mumble audio/musicpd audio/opus-tools audio/opusfile cad/opencascade comms/svxlink deskutils/spice-gtk devel/electron25 devel/electron26 devel/electron27 devel/electron28 devel/libspice-server devel/py-aiortc editors/vscode emulators/yuzu games/DDNet games/easyrpg-player games/iortcw games/moonlight-embedded games/moonlight-qt games/openage games/warzone2100 multimedia/audacious-plugins multimedia/butt multimedia/emby-server multimedia/emby-server-devel multimedia/ffmpeg multimedia/ffmpeg4 multimedia/handbrake multimedia/kew multimedia/pipewire multimedia/qmmp-qt5 multimedia/qmmp-qt6 multimedia/snapcast multimedia/vlc net/asterisk18 net/freeswitch net/mediastreamer net/pjsip net/sems net/wireshark net/xrdp net/xrdp-devel net-im/py-toxcore-c net-im/qTox net-im/signal-desktop net-im/telegram-desktop net-im/tg_owt net-im/tox net-im/tox_extension_messages net-im/toxext net-im/uTox www/chromium - Fails to build (unrelated) www/dpp www/iridium www/janus www/qt5-webengine www/qt6-webengine www/ungoogled-chromium
Created attachment 248985 [details] Patch for opus v2 Remove unnecessary NEON option
Created attachment 249040 [details] Patch for opus v3 USES=python:env --> USES=python:build While meson itself pulls in Python it wont necessarily be the case in the future so do the correct thing and define it as a build dep as python scripts are being called during build.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=ff3ca68472c8562c0008b68c9244b523c7543619 commit ff3ca68472c8562c0008b68c9244b523c7543619 Author: Christian Weisgerber <naddy@FreeBSD.org> AuthorDate: 2024-03-10 16:10:50 +0000 Commit: Christian Weisgerber <naddy@FreeBSD.org> CommitDate: 2024-03-10 16:18:34 +0000 audio/opus: update to 1.5.1 This update enables the new machine learning features: https://opus-codec.org/demo/opus-1.5/ Runtime detection patches for ARMv6, ARMv7 and Aarch64 by fuz@ PR: 277537 audio/opus/Makefile | 5 ++- audio/opus/distinfo | 6 +-- audio/opus/files/patch-celt_arm_armcpu.c (new) | 57 ++++++++++++++++++++++++++ audio/opus/files/patch-configure (gone) | 11 ----- audio/opus/pkg-plist | 2 +- 5 files changed, 65 insertions(+), 16 deletions(-)
I've submitted the patch upsteam. Thanks for the commit, @naddy!
Upstream PR: https://gitlab.xiph.org/xiph/opus/-/merge_requests/111
Is there a reason why we can't move to Meson like other distros such as Gentoo, Arch, Alpine which also benefits us? Commit is incorrect? github.com no longer hosts a release archive patch-dnn_vec__neon.h is missing Should we really have WIP code enabled by default? https://gitlab.xiph.org/xiph/opus/-/tree/v1.5.1/dnn Fast float approximations only works on some platforms, should be disabled for consistency between archs?
Current version fails on armv7 in tree, fuz@ just verified.
(In reply to Daniel Engberg from comment #6) > Is there a reason why we can't move to Meson like other distros such as Gentoo, > Arch, Alpine which also benefits us? I'm comfortable with an autotools-based build. I also use it for the OpenBSD port. > github.com no longer hosts a release archive I'll ask upstream if that is intentional or an accidental omission. > patch-dnn_vec__neon.h is missing What is that supposed to do? -#if defined(__arm__) && !defined(__aarch64__) +#if __ARM_ARCH < 8 Since aarch64 is ARMv8, those look perfectly equivalent. > Should we really have WIP code enabled by default? Now that is an interesting question. As the release article https://opus-codec.org/demo/opus-1.5/ points out, those features need to be explicitly enabled at runtime, so having them doesn't hurt overall. > Fast float approximations only works on some platforms, should be disabled for > consistency between archs? I trust upstream on this.
(In reply to Daniel Engberg from comment #7) If somebody lets me know the details, I'm sure a fix can be found.
(In reply to Christian Weisgerber from comment #8) Hi Christian, The patch patch-dnn_vec__neon.h is required to build the port on armv7 FreeBSD 15. That's why I added it. > -#if defined(__arm__) && !defined(__aarch64__) > +#if __ARM_ARCH < 8 > Since aarch64 is ARMv8, those look perfectly equivalent. They are not. AArch64 is one operation mode of the ARMv8 architecture. ARMv8 additionally provides extensions to the AArch32 execution state, which can be used when an ARMv8 capable CPU runs armv7 FreeBSD. Clang supports these extensions and consequently defines the intrinsics this header tries to emulate, even in armv7 mode, if appropriate compiler flags are defined (which is the case here; the code is however only used if ARMv8 support is detected at runtime). Therefore, the check had to be adapted to check for architecture revision instead of operation mode. Please check in the patch. As you only committed one of the two patches needed to fix the build, the port is still broken.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=a1c197fb10cb282953644a53f46288358fe99a47 commit a1c197fb10cb282953644a53f46288358fe99a47 Author: Christian Weisgerber <naddy@FreeBSD.org> AuthorDate: 2024-03-12 15:48:02 +0000 Commit: Christian Weisgerber <naddy@FreeBSD.org> CommitDate: 2024-03-12 15:54:39 +0000 audio/opus: fix build on arm * fix the build on 32-bit arm[1] * GitHub does not have a release tarball for this release[2] PR: 277537 Obtained from: fuz [1] Reported by: diizzy [2] audio/opus/Makefile | 3 +-- audio/opus/files/patch-dnn_vec__neon.h (new) | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-)