From 94cade78f646ecf19a2807a670aecc72faf2c209 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 25 Oct 2020 21:13:45 +0100 Subject: [PATCH 1/8] build: make: add tool probe for cargo --- make/configure.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/make/configure.py b/make/configure.py index 95dd182ccbec..458c5e6c761e 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1591,6 +1591,7 @@ def infof( self, format, *args ): arch_gcc = None cross = None xcode_opts = { 'disabled': False, 'config': None } + rav1e_enabled = False for i in range(len(sys.argv)): if re.compile( '^--arch=(.+)$' ).match( sys.argv[i] ): arch_gcc = sys.argv[i][7:] @@ -1619,6 +1620,9 @@ def infof( self, format, *args ): elif re.compile( '^--disable-xcode$' ).match( sys.argv[i] ): xcode_opts['disabled'] = True continue + elif re.compile( '^--enable-rav1e$' ).match( sys.argv[i] ): + rav1e_enabled = True + continue ## create tools in a scope class Tools: @@ -1653,6 +1657,7 @@ class Tools: meson = ToolProbe( 'MESON.exe', 'meson', 'meson', abort=True, minversion=[0,47,0] ) nasm = ToolProbe( 'NASM.exe', 'asm', 'nasm', abort=True, minversion=[2,13,0] ) ninja = ToolProbe( 'NINJA.exe', 'ninja', 'ninja-build', 'ninja', abort=True ) + cargo = ToolProbe( 'CARGO.exe', 'cargo', 'cargo', abort=rav1e_enabled ) xcodebuild = ToolProbe( 'XCODEBUILD.exe', 'xcodebuild', 'xcodebuild', abort=(True if (not xcode_opts['disabled'] and (build_tuple.match('*-*-darwin*') and cross is None)) else False), versionopt='-version', minversion=[10,3,0] ) From 4bae94eece052a0331ec946e6b1024c4b26060ba Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 25 Oct 2020 22:51:04 +0100 Subject: [PATCH 2/8] contrib: add cargo-c --- contrib/cargo-c/module.defs | 31 +++++++++++++++++++++++++++++++ contrib/cargo-c/module.rules | 2 ++ make/configure.py | 5 +++++ make/include/main.defs | 4 ++++ 4 files changed, 42 insertions(+) create mode 100644 contrib/cargo-c/module.defs create mode 100644 contrib/cargo-c/module.rules diff --git a/contrib/cargo-c/module.defs b/contrib/cargo-c/module.defs new file mode 100644 index 000000000000..5adffabc3523 --- /dev/null +++ b/contrib/cargo-c/module.defs @@ -0,0 +1,31 @@ +$(eval $(call import.MODULE.defs,CARGOC,cargo-c)) +$(eval $(call import.CONTRIB.defs,CARGOC)) + +CARGOC.FETCH.url = https://github.com/lu-zero/cargo-c/archive/v0.7.3.tar.gz +CARGOC.FETCH.sha256 = 533c65d555330e86b91415753efc140ffdb900abd59b5b6403352c4264941a99 +CARGOC.FETCH.basename = cargo-c-0.7.3.tar.gz + +define CARGOC.CONFIGURE + $(CARGO.exe) fetch --manifest-path=$(CARGOC.EXTRACT.dir/)Cargo.toml + $(TOUCH.exe) $@ +endef + +CARGOC.BUILD.make = $(CARGO.exe) build +CARGOC.BUILD.extra = --offline --release --features=cargo/vendored-openssl +CARGOC.BUILD.args.dir = --manifest-path=$(CARGOC.EXTRACT.dir/)Cargo.toml + +define CARGOC.INSTALL + $(MKDIR.exe) -p $(CONTRIB.build/)bin/ + $(CP.exe) $(CARGOC.EXTRACT.dir/)target/release/cargo-cbuild $(CONTRIB.build/)bin/ + $(CP.exe) $(CARGOC.EXTRACT.dir/)target/release/cargo-cinstall $(CONTRIB.build/)bin/ + $(TOUCH.exe) $@ +endef + +define CARGOC.UNINSTALL + $(RM.exe) -f $(CONTRIB.build/)bin/cargo-cbuild $(CONTRIB.build/)bin/cargo-cinstall + $(RM.exe) -f $(CARGOC.INSTALL.target) +endef + +CARGOC.CLEAN.make = $(CARGO.exe) clean +CARGOC.CLEAN.args.dir = --manifest-path=$(CARGOC.EXTRACT.dir/)Cargo.toml +CARGOC.CLEAN.ntargets = diff --git a/contrib/cargo-c/module.rules b/contrib/cargo-c/module.rules new file mode 100644 index 000000000000..15ea0be0d540 --- /dev/null +++ b/contrib/cargo-c/module.rules @@ -0,0 +1,2 @@ +$(eval $(call import.MODULE.rules,CARGOC)) +$(eval $(call import.CONTRIB.rules,CARGOC)) diff --git a/make/configure.py b/make/configure.py index 458c5e6c761e..47eb1a70901e 100644 --- a/make/configure.py +++ b/make/configure.py @@ -1446,6 +1446,10 @@ def createCLI( cross = None ): grp.add_argument( '--enable-vce', dest="enable_vce", default=IfHost(True, '*-*-mingw*', none=False).value, action='store_true', help=(( 'enable %s' %h ) if h != argparse.SUPPRESS else h) ) grp.add_argument( '--disable-vce', dest="enable_vce", action='store_false', help=(( 'disable %s' %h ) if h != argparse.SUPPRESS else h) ) + h = IfHost( 'FFmpeg rav1e video encoder', '*-*-*', none=argparse.SUPPRESS ).value + grp.add_argument( '--enable-ffmpeg-rav1e', dest="enable_rav1e", default=True, action='store_true', help=(( 'enable %s' %h ) if h != argparse.SUPPRESS else h) ) + grp.add_argument( '--disable-ffmpeg-rav1e', dest="enable_rav1e", action='store_false', help=(( 'disable %s' %h ) if h != argparse.SUPPRESS else h) ) + cli.add_argument_group( grp ) ## add launch options @@ -2055,6 +2059,7 @@ class Tools: doc.add( 'FEATURE.vce', int( options.enable_vce )) doc.add( 'FEATURE.x265', int( options.enable_x265 )) doc.add( 'FEATURE.numa', int( options.enable_numa )) + doc.add( 'FEATURE.rav1e', int( options.enable_rav1e )) if build_tuple.match( '*-*-darwin*' ) and options.cross is None: doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode) )) diff --git a/make/include/main.defs b/make/include/main.defs index 40be197b0b81..6b73e60f3f87 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -47,6 +47,10 @@ ifeq (1,$(FEATURE.x265)) MODULES += contrib/x265_12bit endif +ifeq (1,$(FEATURE.rav1e)) + MODULES += contrib/cargo-c +endif + MODULES += contrib/libdav1d MODULES += contrib/ffmpeg MODULES += contrib/libdvdread From 05c65a50abe7d986174959e6d79745b02c04ee53 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 25 Oct 2020 22:51:52 +0100 Subject: [PATCH 3/8] contrib: add rav1e --- contrib/librav1e/module.defs | 23 +++++++++++++++++++++++ contrib/librav1e/module.rules | 2 ++ make/include/main.defs | 1 + 3 files changed, 26 insertions(+) create mode 100644 contrib/librav1e/module.defs create mode 100644 contrib/librav1e/module.rules diff --git a/contrib/librav1e/module.defs b/contrib/librav1e/module.defs new file mode 100644 index 000000000000..fb6df32593a3 --- /dev/null +++ b/contrib/librav1e/module.defs @@ -0,0 +1,23 @@ +$(eval $(call import.MODULE.defs,LIBRAV1E,librav1e,CARGOC)) +$(eval $(call import.CONTRIB.defs,LIBRAV1E)) + +LIBRAV1E.FETCH.url = https://github.com/xiph/rav1e/archive/v0.3.4.tar.gz +LIBRAV1E.FETCH.sha256 = 797699359d594c929636ddd54474c99fe0577b545a21384514f864d68f67b98f +LIBRAV1E.FETCH.basename = rav1e-0.3.4.tar.gz + +define LIBRAV1E.CONFIGURE + $(CARGO.exe) fetch --manifest-path=$(LIBRAV1E.EXTRACT.dir/)Cargo.toml + $(TOUCH.exe) $@ +endef + +LIBRAV1E.BUILD.make = $(CONTRIB.build/)bin/cargo-cbuild cbuild +LIBRAV1E.BUILD.extra = --offline --release --library-type staticlib --prefix $(LIBRAV1E.CONFIGURE.prefix) +LIBRAV1E.BUILD.args.dir = --manifest-path=$(LIBRAV1E.EXTRACT.dir/)Cargo.toml + +LIBRAV1E.INSTALL.make = $(CONTRIB.build/)bin/cargo-cinstall cinstall +LIBRAV1E.INSTALL.extra = --offline --release --library-type staticlib --prefix $(LIBRAV1E.CONFIGURE.prefix) +LIBRAV1E.INSTALL.args.dir = --manifest-path=$(LIBRAV1E.EXTRACT.dir/)Cargo.toml + +LIBRAV1E.CLEAN.make = $(CARGO.exe) clean +LIBRAV1E.CLEAN.args.dir = --manifest-path=$(LIBRAV1E.EXTRACT.dir/)Cargo.toml +LIBRAV1E.CLEAN.ntargets = diff --git a/contrib/librav1e/module.rules b/contrib/librav1e/module.rules new file mode 100644 index 000000000000..27d3551ad4a7 --- /dev/null +++ b/contrib/librav1e/module.rules @@ -0,0 +1,2 @@ +$(eval $(call import.MODULE.rules,LIBRAV1E)) +$(eval $(call import.CONTRIB.rules,LIBRAV1E)) diff --git a/make/include/main.defs b/make/include/main.defs index 6b73e60f3f87..9d4bcbd8aa84 100644 --- a/make/include/main.defs +++ b/make/include/main.defs @@ -49,6 +49,7 @@ endif ifeq (1,$(FEATURE.rav1e)) MODULES += contrib/cargo-c + MODULES += contrib/librav1e endif MODULES += contrib/libdav1d From 4974ee372f8fe9badd26bcfc5518fab5634f9385 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 25 Oct 2020 22:52:48 +0100 Subject: [PATCH 4/8] contrib: ffmpeg: use rav1e if enabled --- contrib/ffmpeg/module.defs | 9 +++++++++ libhb/module.defs | 4 ++++ test/module.defs | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index ebddcf19a043..3a6d631365ee 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -8,6 +8,9 @@ endif ifeq (1,$(FEATURE.nvenc)) __deps__ += NVENC endif +ifeq (1,$(FEATURE.rav1e)) +__deps__ += LIBRAV1E +endif $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,$(__deps__))) $(eval $(call import.CONTRIB.defs,FFMPEG)) @@ -79,6 +82,12 @@ FFMPEG.CONFIGURE.extra += \ --enable-encoder=libfdk_aac endif +ifeq (1,$(FEATURE.rav1e)) +FFMPEG.CONFIGURE.extra += \ + --enable-librav1e \ + --enable-encoder=librav1e +endif + FFMPEG.CONFIGURE.extra += \ --enable-muxer=matroska \ --enable-muxer=webm \ diff --git a/libhb/module.defs b/libhb/module.defs index a6aec9702514..baeae0e76400 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -129,6 +129,10 @@ ifeq (1,$(FEATURE.x265)) LIBHB.dll.libs += $(CONTRIB.build/)lib/libx265.a endif +ifeq (1,$(FEATURE.rav1e)) +LIBHB.dll.libs += $(CONTRIB.build/)lib/librav1e.a +endif + ifneq ($(HAS.iconv),1) LIBHB.dll.libs += $(CONTRIB.build/)lib/libiconv.a else diff --git a/test/module.defs b/test/module.defs index 33bee3111aac..34dfc0feeec8 100644 --- a/test/module.defs +++ b/test/module.defs @@ -34,6 +34,10 @@ ifeq (1,$(FEATURE.flatpak)) TEST.GCC.l += glib-2.0 endif +ifeq (1,$(FEATURE.rav1e)) + TEST.GCC.l += rav1e +endif + TEST.GCC.l += $(foreach m,$(MODULES.NAMES),$($m.OSL.libs)) TEST.install.exe = $(DESTDIR)$(PREFIX/)bin/$(notdir $(TEST.exe)) From d8eaab3ac36e33e5176cbbdc0f081bad75a32c3f Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Mon, 26 Oct 2020 14:36:07 +0100 Subject: [PATCH 5/8] contrib: cargo-c: add patch fixing openssl fetching --- .../A00-add-explicit-openssl-vendor.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 contrib/cargo-c/A00-add-explicit-openssl-vendor.patch diff --git a/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch b/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch new file mode 100644 index 000000000000..c20593b8b5a8 --- /dev/null +++ b/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch @@ -0,0 +1,21 @@ +From 39a7021f96bc49d03fb5b84d1daf31074878f98d Mon Sep 17 00:00:00 2001 +From: Luca Barbato +Date: Mon, 26 Oct 2020 14:20:00 +0100 +Subject: [PATCH] Add an explicit feature to vendor openssl + +--- + Cargo.toml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Cargo.toml b/Cargo.toml +index 454c31b..742bf7b 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -33,3 +33,7 @@ toml = "0.5" + serde = "1.0" + serde_derive = "1.0" + anyhow = "1.0" ++ ++ ++[features] ++vendored-openssl = ["cargo/vendored-openssl"] From da9586b9d230dfe11eed2628ad57648a8f565cfa Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 1 Nov 2020 12:19:13 +0100 Subject: [PATCH 6/8] contrib: ffmpeg: do not overwrite env The common contrib.defs already add the env.LOCAL_PATH to the final env, so this seems unnecessary and breaks adding the right PKG_CONFIG_PATH for contribs to ffmpeg. --- contrib/ffmpeg/module.defs | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 3a6d631365ee..fbffbd49237f 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -23,7 +23,6 @@ FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.host = FFMPEG.CONFIGURE.build = FFMPEG.CONFIGURE.env.LOCAL_PATH = PATH="$(call fn.ABSOLUTE,$(CONTRIB.build/)bin):$(PATH)" -FFMPEG.BUILD.env = PATH="$(call fn.ABSOLUTE,$(CONTRIB.build/)bin):$(PATH)" ifneq (,$(filter $(HOST.system),freebsd netbsd)) FFMPEG.CONFIGURE.env += CFLAGS=-I$(LOCALBASE)/include From 2395f7e58c5750aa68bf076b4695e5d392418199 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 22 Nov 2020 00:23:40 +0100 Subject: [PATCH 7/8] contrib: ffmpeg: Print log on configure failure --- make/include/contrib.defs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/include/contrib.defs b/make/include/contrib.defs index f249f48f8851..ce86143a310d 100644 --- a/make/include/contrib.defs +++ b/make/include/contrib.defs @@ -132,7 +132,7 @@ define import.CONTRIB.defs $(1).CONFIGURE.target = $$($(1).build/).stamp.$$($(1).name).configure define $(1).CONFIGURE - $$(call fn.ARGS,$(1).CONFIGURE,$$($(1).CONFIGURE.args)) + $$(call fn.ARGS,$(1).CONFIGURE,$$($(1).CONFIGURE.args)) || (cat ./ffbuild/config.log; exit 1) $$(TOUCH.exe) $$@ endef From 0cc610967b41dd2f2f0ba2da7ee513d7abe32f54 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Wed, 10 Mar 2021 21:48:03 +0100 Subject: [PATCH 8/8] Revert "contrib: cargo-c: add patch fixing openssl fetching" This reverts commit 6e2c8a8b6f9c805a7f2900918c3e919b56b871fc. --- .../A00-add-explicit-openssl-vendor.patch | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 contrib/cargo-c/A00-add-explicit-openssl-vendor.patch diff --git a/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch b/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch deleted file mode 100644 index c20593b8b5a8..000000000000 --- a/contrib/cargo-c/A00-add-explicit-openssl-vendor.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 39a7021f96bc49d03fb5b84d1daf31074878f98d Mon Sep 17 00:00:00 2001 -From: Luca Barbato -Date: Mon, 26 Oct 2020 14:20:00 +0100 -Subject: [PATCH] Add an explicit feature to vendor openssl - ---- - Cargo.toml | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/Cargo.toml b/Cargo.toml -index 454c31b..742bf7b 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -33,3 +33,7 @@ toml = "0.5" - serde = "1.0" - serde_derive = "1.0" - anyhow = "1.0" -+ -+ -+[features] -+vendored-openssl = ["cargo/vendored-openssl"]