From 836aecb10dd2b3713433235fd9a843684dc04bc5 Mon Sep 17 00:00:00 2001 From: shizhenghui Date: Tue, 16 Jul 2024 11:28:41 +0800 Subject: [PATCH] videoutils/x264: clone from github if no x264 source Signed-off-by: shizhenghui --- videoutils/x264/Makefile | 17 ++++++++- .../0001-x264-fix-UNUSED-redefined.patch | 38 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 videoutils/x264/patch/0001-x264-fix-UNUSED-redefined.patch diff --git a/videoutils/x264/Makefile b/videoutils/x264/Makefile index ded9f6bbf..7fe775cc7 100644 --- a/videoutils/x264/Makefile +++ b/videoutils/x264/Makefile @@ -48,7 +48,9 @@ else endif # suppress -Wundef -Wno-format -CFLAGS += -Wno-undef -Wno-format -fno-var-tracking-assignments -Wno-unused-but-set-variable -Wno-cpp +CFLAGS += -Wno-undef -Wno-format -fno-var-tracking-assignments \ + -Wno-unused-but-set-variable -Wno-cpp \ + -Wno-dangling-pointer -Wno-array-bounds SRCS = common/osdep.c common/base.c common/cpu.c common/tables.c \ encoder/api.c @@ -239,7 +241,7 @@ ifneq ($(CONFIG_UTILS_X264),) CSRCS += $(addprefix $(SRCPATH)$(DELIM), $(SRCCLI) $(SRCCLI_X)) endif -$(DST_PATH)/config.mak: +$(DST_PATH)/config.mak: x264 $(Q)echo "X264 configure... $(CONFIG_ARCH)" $(Q)cd $(DST_PATH) && $(X264_CONFIG_SCRIPT) --disable-cli --enable-static \ --disable-bashcompletion --disable-opencl \ @@ -262,5 +264,16 @@ distclean:: $(DST_PATH)/config.log $(DST_PATH)/x264.pc $(DST_PATH)/x264.def \ $(DST_PATH)/config.h +# Download x264 if no x264/.git found +x264: + $(Q)git clone https://github.com/mirror/x264.git x264 + $(Q)cd x264 && git apply ../patch/0001-x264-fix-UNUSED-redefined.patch + +ifeq ($(wildcard x264/.git),) +context:: x264 +distclean:: + $(call DELDIR, x264) +endif + include $(APPDIR)/Application.mk diff --git a/videoutils/x264/patch/0001-x264-fix-UNUSED-redefined.patch b/videoutils/x264/patch/0001-x264-fix-UNUSED-redefined.patch new file mode 100644 index 000000000..6a7fae3d6 --- /dev/null +++ b/videoutils/x264/patch/0001-x264-fix-UNUSED-redefined.patch @@ -0,0 +1,38 @@ +From 2a966aab25b6a20176b0f87f1eb8010432edc655 Mon Sep 17 00:00:00 2001 +From: zhangchendong1 +Date: Wed, 6 Sep 2023 12:37:19 +0800 +Subject: [PATCH] x264: fix "UNUSED" redefined + +CC: x264/common/frame.c In file included from x264/common/base.h:43, + from x264/common/common.h:30, + from x264/common/dct.c:28: +x264/common/osdep.h:347: warning: "UNUSED" redefined + 347 | #define UNUSED __attribute__((unused)) + | +In file included from /ssd1t/nuttx-github/nuttx/include/sys/types.h:29, + from /ssd1t/nuttx-github/nuttx/include/stdio.h:30, + from x264/common/osdep.h:33: +/ssd1t/nuttx-github/nuttx/include/nuttx/compiler.h:481: note: this is the location of the previous definition + 481 | # define UNUSED(a) ((void)(1 || &(a))) + +Signed-off-by: zhangchendong1 +Signed-off-by: shizhenghui +--- + common/osdep.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/common/osdep.h b/common/osdep.h +index 22301212..db5855d2 100644 +--- a/common/osdep.h ++++ b/common/osdep.h +@@ -343,6 +343,7 @@ static inline int x264_is_regular_file( FILE *filehandle ) + #endif + + #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) ++#undef UNUSED + #define UNUSED __attribute__((unused)) + #define ALWAYS_INLINE __attribute__((always_inline)) inline + #define NOINLINE __attribute__((noinline)) +-- +2.43.0 +