Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove native nasm #6263

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
19 changes: 1 addition & 18 deletions cross/dav1d/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = dav1d
PKG_VERS = 1.4.2
PKG_VERS = 1.4.3
PKG_EXT = tar.xz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://download.videolan.org/pub/videolan/dav1d/$(PKG_VERS)
Expand All @@ -18,21 +18,4 @@ CONFIGURE_ARGS += -Denable_examples=false
CONFIGURE_ARGS += -Denable_docs=false
ADDITIONAL_CFLAGS = -O

include ../../mk/spksrc.archs.mk

# Define x86asm
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
BUILD_DEPENDS = native/nasm
NASM_PATH = $(abspath $(PWD)/../../native/nasm/work-native/install/usr/local/bin)
ENV += AS=$(NASM_PATH)/nasm
ENV += PATH=$(NASM_PATH):$$PATH
CONFIGURE_ARGS += -Denable_asm=true

# Allow ASM on aarch64, disable on all others
else ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
CONFIGURE_ARGS += -Denable_asm=true
else
CONFIGURE_ARGS += -Denable_asm=false
Comment on lines -29 to -35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nasm is only used for x86/x86_64, while for aarch64 it uses the gcc assembler (as). Considering the code above, you should have kept something such as:

ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS) $(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
CONFIGURE_ARGS += -Denable_asm=true
else
CONFIGURE_ARGS += -Denable_asm=false
endif

While it probably builds ok, I recall code to fail on armv7 in multiple cases which led to enable assembly optimizations only on aarch64 and x86 archs. I would suggest keeping this ifeq else usecase (and maybe elsewhere, haven't looked at all the code changes).

EDIT: On another comment I realized that issues with as on armv7 related to gcc <= 4.9, rather suggesting:

include ../../mk/spksrc.common.mk

ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS) $(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
CONFIGURE_ARGS += -Denable_asm=true

# only enable `asm` on armv7 when using gcc > 4.9.* (i.e. DSM7+)
else if ($(findstring $(ARCH),$(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH))
ifeq ($(call version_lt, ${TC_GCC}, 5),1)
CONFIGURE_ARGS += -Denable_asm=true
endif
else
CONFIGURE_ARGS += -Denable_asm=false
endif

endif

include ../../mk/spksrc.cross-meson.mk
6 changes: 3 additions & 3 deletions cross/dav1d/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dav1d-1.4.2.tar.xz SHA1 6137672cb64714ab192fed167b852127eb45a2f8
dav1d-1.4.2.tar.xz SHA256 7392cf4c432734eebb383319b5e05e994bffdcdfe66f82287c38873601a4ef0b
dav1d-1.4.2.tar.xz MD5 cdfa07cb6641caad509ac8e46ae7aa2a
dav1d-1.4.3.tar.xz SHA1 daf40121d16d5f580c42b4e8374c91d34efd9835
dav1d-1.4.3.tar.xz SHA256 42fe524bcc82ea3a830057178faace22923a79bad3d819a4962d8cfc54c36f19
dav1d-1.4.3.tar.xz MD5 c84c685c76e51b98e998db0995bd365c
12 changes: 6 additions & 6 deletions cross/ffmpeg4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ CONFIGURE_ARGS += --extra-cflags=-Wno-deprecated-declarations

include ../../mk/spksrc.common.mk

OPTIONAL_DEPENDS = native/nasm
OPTIONAL_DEPENDS += cross/chromaprint-fftw
OPTIONAL_DEPENDS = cross/chromaprint-fftw
OPTIONAL_DEPENDS += cross/dav1d
OPTIONAL_DEPENDS += cross/frei0r
OPTIONAL_DEPENDS += cross/libass
Expand All @@ -59,10 +58,11 @@ OPTIONAL_DEPENDS += cross/shine

# Define x86asm
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
BUILD_DEPENDS = native/nasm
NASM_PATH = $(abspath $(PWD)/../../native/nasm/work-native/install/usr/local/bin)
ENV += AS=$(NASM_PATH)/nasm
ENV += PATH=$(NASM_PATH):$$PATH
NASM_BINARY = $(shell which nasm)
ifeq ($(NASM_BINARY),)
$(error nasm not found. Please intall NASM assembler)
endif
ENV += AS=$(NASM_BINARY)
Comment on lines +61 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that test even needed? I did not bother with that for ffmpeg5-6-7, maybe worth either using it everywhere or I would suggest not at all.

CONFIGURE_ARGS += --x86asmexe=nasm

# Allow ASM on aarch64, disable on all others
Expand Down
12 changes: 6 additions & 6 deletions cross/lame/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ PKG_NAME = lame
PKG_VERS = 3.100
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://downloads.sourceforge.net/project/lame/$(PKG_NAME)/$(PKG_VERS)
PKG_DIST_SITE = https://downloads.sourceforge.net/project/lame/lame/$(PKG_VERS)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =
OPTIONAL_DEPENDS = native/nasm

HOMEPAGE = https://lame.sourceforge.net/
COMMENT = High quality MPEG Audio Layer III encoder.
Expand All @@ -17,9 +16,10 @@ GNU_CONFIGURE = 1
include ../../mk/spksrc.cross-cc.mk

ifeq ($(findstring $(ARCH),$(x64_ARCHS) $(i686_ARCHS)),$(ARCH))
BUILD_DEPENDS = native/nasm
NASM_PATH = $(realpath $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin)
ENV += AS=$(NASM_PATH)/nasm
ENV += PATH=$(NASM_PATH):$$PATH
NASM_BINARY = $(shell which nasm)
ifeq ($(NASM_BINARY),)
$(error nasm not found. Please install NASM assembler)
endif
ENV += AS=$(NASM_BINARY)
CONFIGURE_ARGS += --enable-nasm
endif
4 changes: 1 addition & 3 deletions cross/libaom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ DEPENDS =

HOMEPAGE = https://aomedia.googlesource.com/aom/
COMMENT = AOMedia Video 1 (AV1) is an open, royalty-free video coding format designed for video transmissions over the Internet.
LICENSE = Royalty-free
LICENSE = 2-Clause BSD and Alliance for Open Media Patent License 1.0

UNSUPPORTED_ARCHS = $(ARMv5_ARCHS) $(OLD_PPC_ARCHS)

# Set working directory
PKG_WORK_DIR = $(WORK_DIR)/$(PKG_NAME)_$(PKG_VERS)-build

CMAKE_USE_NASM = 1

# libaom specific cmake options
CMAKE_ARGS += -DCONFIG_AV1_ENCODER=1

Expand Down
25 changes: 10 additions & 15 deletions cross/libvpx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =
OPTIONAL_DEPENDS = native/nasm

UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

Expand All @@ -17,7 +16,10 @@ LICENSE = https://raw.githubusercontent.com/webmproject/libvpx/master/LICENSE

INSTALL_TARGET = libvpx_install

CONFIGURE_ARGS += --disable-static --enable-shared --prefix=$(INSTALL_PREFIX)
# configure does not work with GNU_CONFIGURE = 1 (Unknown option "--host=x86_64-pc-linux-gnu")
CONFIGURE_ARGS = --prefix=$(INSTALL_PREFIX)

CONFIGURE_ARGS += --disable-static --enable-shared
CONFIGURE_ARGS += --enable-vp8 --enable-vp9 --disable-examples --disable-docs --disable-unit_tests
CONFIGURE_ARGS += --enable-postproc --enable-vp9-postproc --enable-pic
CONFIGURE_ARGS += --enable-vp9-highbitdepth --enable-better-hw-compatibility
Expand All @@ -28,40 +30,33 @@ include ../../mk/spksrc.archs.mk

ifeq ($(findstring $(ARCH),$(ARMv5_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=generic-gnu
ADDITIONAL_CPPFLAGS = -std=c++0x
ADDITIONAL_CXXFLAGS = -std=c++0x
endif

ifeq ($(findstring $(ARCH),$(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=armv7-linux-gcc
CONFIGURE_ARGS += --disable-neon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling of neon was done in this PR #5620
This was the comit: 6ad7f5f

So from the commit log it states disabling neon (i.e. which includes as optimizations) on armv7 when using a compiler <= 4.9, basically on dsm6. I suggest the following change:

include ../../mk/spksrc.common.mk

ifeq ($(findstring $(ARCH),$(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=armv7-linux-gcc
ifeq ($(call version_lt, ${TC_GCC}, 5),1)
CONFIGURE_ARGS += --disable-neon
endif
endif

endif

ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=generic-gnu
endif

# neon_asm does not work under armv8/arm64
ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=armv8-linux-gcc
endif

# Define x86asm
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
BUILD_DEPENDS = native/nasm
NASM_PATH = $(abspath $(PWD)/../../native/nasm/work-native/install/usr/local/bin)
ENV += AS=$(NASM_PATH)/nasm
ENV += PATH=$(NASM_PATH):$$PATH
CONFIGURE_ARGS += --as=nasm
CONFIGURE_ARGS += --disable-sse4_1
endif

ifeq ($(findstring $(ARCH),$(i686_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=x86-linux-gcc
# --as=auto: prefers yasm over nasm
CONFIGURE_ARGS += --as=auto
CONFIGURE_ARGS += --disable-sse4_1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@th0ma7 can you remember why you disabled sse4_1 for intel archs?
it builds just fine without disabling it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change comes from this PR: #6148
Specifically from this commit: c4c0d44

But I haven't left any descriptions as to why I disabled it? Maybe it failed on DSM6, again using gcc <= 4.9.x for that specific libvpx version (i.e 1.14.1)?

Looking a bit further this may have been a mistake from my part as SSE4.1 (Streaming SIMD Extensions 4.1) has nothing to do with newer AVX extensions and may have mixed them somehow. A bit more reading on it makes it that pretty much all "recent" intel based nas from synology (i.e. less than 10-12 years old) should support this extension...

I believe it is safe to remove that.

endif

ifeq ($(findstring $(ARCH),$(x64_ARCHS)),$(ARCH))
CONFIGURE_ARGS += --target=x86_64-linux-gcc
# --as=auto: prefers yasm over nasm
CONFIGURE_ARGS += --as=auto
CONFIGURE_ARGS += --disable-sse4_1
endif

include ../../mk/spksrc.cross-cc.mk
Expand Down
13 changes: 0 additions & 13 deletions cross/libvpx/patches/DSM-5.2/001-gcc-over-ld-configure-fix.patch

This file was deleted.

12 changes: 4 additions & 8 deletions cross/openh264/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PKG_NAME = openh264
PKG_VERS = 2.4.1
PKG_EXT = tar.gz
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/cisco/openh264/archive/refs/tags
PKG_DIST_SITE = https://github.com/cisco/openh264/archive
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =
DEPENDS =

HOMEPAGE = http://www.openh264.org/
COMMENT = OpenH264 is a codec library which supports H.264 encoding and decoding. It is suitable for use in real time applications such as WebRTC.
Expand All @@ -15,14 +15,10 @@ LICENSE = BSD
UNSUPPORTED_ARCHS = $(PPC_ARCHS)

CONFIGURE_ARGS += -Dtests=disabled
ADDITIONAL_CPPFLAGS = -O
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? is it to diable optimizations (i.e. -O0)


POST_INSTALL_TARGET = openh264-post_install

BUILD_DEPENDS = native/nasm
NASM_PATH = $(realpath $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin)
ENV += PATH=$(NASM_PATH):$$PATH
ENV += AS=$(NASM_PATH)/nasm

include ../../mk/spksrc.cross-meson.mk

.PHONY: openh264-post_install
Expand Down
2 changes: 0 additions & 2 deletions cross/svt-av1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ LICENSE = SPDX short identifier: BSD-2-Clause-Patent

UNSUPPORTED_ARCHS = $(ARMv5_ARCHS) $(PPC_ARCHS)

CMAKE_USE_NASM = 1

include ../../mk/spksrc.cross-cmake.mk

ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
Expand Down
2 changes: 0 additions & 2 deletions cross/svt-hevc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ LICENSE = SPDX short identifier: BSD-2-Clause-Patent
# SVT-HEVC is only supported on x86_64 Intel platforms
UNSUPPORTED_ARCHS = $(ARM_ARCHS) $(PPC_ARCHS) $(i686_ARCHS)

CMAKE_USE_NASM = 1

include ../../mk/spksrc.cross-cmake.mk
44 changes: 20 additions & 24 deletions cross/x264/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,52 @@ PKG_VERS = 20240512-stable
PKG_EXT = tar.gz
PKG_GIT_HASH = 4613ac3c15fd75cebc4b9f65b7fb95e70a3acce1
PKG_DIST_NAME = $(PKG_NAME)-master.$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_GIT_HASH).$(PKG_EXT)
PKG_DIST_SITE = https://code.videolan.org/videolan/x264/-/archive/$(PKG_GIT_HASH)
PKG_DIST_FILE = $(PKG_NAME)-git$(PKG_GIT_HASH).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-$(PKG_GIT_HASH)

DEPENDS =
OPTIONAL_DEPENDS = native/nasm

# configure fails in "endian test"
UNSUPPORTED_ARCHS = $(OLD_PPC_ARCHS)

HOMEPAGE = https://www.videolan.org/developers/x264.html
COMMENT = x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC forma
LICENSE = GPLv2

GNU_CONFIGURE = 1

CONFIGURE_ARGS = --enable-shared
CONFIGURE_ARGS += --enable-pic
# configure with "GNU_CONFIGURE = 1" complains: "Unknown option --build=i686-pc-linux, ignored"
CONFIGURE_ARGS = --prefix=$(INSTALL_PREFIX)
CONFIGURE_ARGS += --enable-shared
CONFIGURE_ARGS += --disable-opencl
CONFIGURE_ARGS += --prefix=$(INSTALL_PREFIX)
CONFIGURE_ARGS += --cross-prefix=$(TC_PATH)$(TC_PREFIX)

include ../../mk/spksrc.cross-cc.mk

ifeq ($(findstring $(ARCH),$(ARMv5_ARCHS) $(ARMv7_ARCHS) $(ARMv7L_ARCHS)),$(ARCH))
ENV += x264_ARCH=ARM
CONFIGURE_ARGS += --disable-asm
endif
CONFIGURE_ARGS += --host=$(TC_TARGET)

ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
ENV += x264_ARCH=ARM
CONFIGURE_ARGS += --host=aarch64-linux
# Define x86asm or use gcc as assembler
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
NASM_BINARY = $(shell which nasm)
ifeq ($(NASM_BINARY),)
$(error nasm not found. Please install NASM assembler)
endif
ENV += AS=$(NASM_BINARY)
else
Comment on lines +28 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to ffmpeg, isn't this too much as nasm is always installed?
If anything, I'd rather have that test being done outside from individual cross but within the framework to avoid code duplication if feasible.

# Expects to be assembled with a C compiler as frontend
# .s is raw assembly passed to as
# .S is assembly which expects to be preprocessed by a cpp then fed to assembler
# More info: https://code.videolan.org/videolan/x264/-/issues/61
ENV += AS=$(abspath $(PWD)/../../toolchain/syno-$(ARCH)-$(TCVERSION)/work/$(TC_TARGET)/bin/$(TC_PREFIX)gcc)
ENV += AS=$(TC_PATH)$(TC_PREFIX)gcc
endif

ifeq ($(findstring $(ARCH),$(ARM_ARCHS)),$(ARCH))
ENV += x264_ARCH=ARM
endif

ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH))
ENV += x264_ARCH=PPC
CONFIGURE_ARGS += --disable-asm
endif

# Define x86asm
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
BUILD_DEPENDS = native/nasm
NASM_PATH = $(abspath $(PWD)/../../native/nasm/work-native/install/usr/local/bin)
ENV += AS=$(NASM_PATH)/nasm
ENV += PATH=$(NASM_PATH):$$PATH
endif

ifeq ($(findstring $(ARCH),$(x64_ARCHS)),$(ARCH))
ENV += x264_ARCH=X86_64
endif
Expand Down
9 changes: 0 additions & 9 deletions cross/x265/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ PKG_DIST_NAME = $(PKG_NAME)_$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://bitbucket.org/multicoreware/x265_git/downloads
PKG_DIR = $(PKG_NAME)_$(PKG_VERS)

OPTIONAL_DEPENDS = native/nasm

HOMEPAGE = http://x265.org/
COMMENT = x265 is an open source HEVC encoder.
LICENSE = GPL

PRE_CONFIGURE_TARGET = x265_pre_configure
PRE_COMPILE_TARGET = x265_pre_compile

CMAKE_USE_NASM = 1
CMAKE_SOURCE_DIR = source

# Build directories for default, 12 and 10 bit depth
Expand Down Expand Up @@ -63,12 +60,6 @@ ifeq ($(call version_ge, $(TCVERSION), 7.0),1)
CMAKE_ARGS += -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_C99_MATH
endif

# For ppc853x-4.3, disable atomics
ifeq ($(ARCH)-$(TCVERSION), ppc853x-4.3)
CMAKE_ARGS += -DNO_ATOMICS=ON
CMAKE_ARGS += -DCMAKE_CXX_FLAGS="-DSPKSRC_FIX_PPC853X_4_3"
endif

.PHONY: x265_pre_configure
x265_pre_configure: $(CMAKE_TOOLCHAIN_PKG)
@$(MSG) Configure 12BIT libraries
Expand Down
29 changes: 0 additions & 29 deletions mk/spksrc.cross-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,6 @@ ifeq ($(strip $(CMAKE_USE_NINJA)),1)
CMAKE_ARGS += -G Ninja
endif

# Set default X86ASM build environment
# At toolchain step variables are not yet evaluated
# resulting in inability to set in toolchain file
#
# ARM architecture may expect to be assembled with a C compiler as frontend:
# .s is raw assembly passed to as
# .S is assembly which expects to be preprocessed by a cpp then fed to assembler
# Setting the following for ARM may help:
# ENV += AS=$(abspath $(CURDIR)/../../toolchain/syno-$(ARCH)-$(TCVERSION)/work/$(TC_TARGET)/bin/$(TC_PREFIX)gcc)
ifeq ($(strip $(CMAKE_USE_NASM)),1)
# Define x86asm
ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH))
HOST_NASM = $(shell command -v nasm 2>/dev/null)
ENABLE_ASSEMBLY = ON
ifneq ($(HOST_NASM),)
ENV += AS=$(HOST_NASM)
CMAKE_ASM_COMPILER = $(HOST_NASM)
else
DEPENDS += native/nasm
NASM_PATH = $(abspath $(CURDIR)/../../native/nasm/work-native/install/usr/local/bin)
ENV += PATH=$(NASM_PATH):$$PATH
ENV += AS=$(NASM_PATH)/nasm
CMAKE_ASM_COMPILER = $(NASM_PATH)/nasm
endif
endif
else
CMAKE_USE_NASM = 0
endif

# set default use destdir
ifeq ($(strip $(CMAKE_USE_DESTDIR)),)
CMAKE_USE_DESTDIR = 1
Expand Down
Loading
Loading