Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/zimg: add zimg package
@ 2026-01-06 18:57 Michael Cullen via buildroot
  2026-01-06 20:43 ` Thomas Petazzoni via buildroot
  2026-01-25 12:20 ` [Buildroot] [PATCH v2] " Michael Cullen via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Cullen via buildroot @ 2026-01-06 18:57 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Cullen, Thomas Petazzoni

This commit adds an image transformation library called zimg.

There are a number of patches applied. One is from upstream and supports
building on GCC-15, the others are autotools patches to allow installing
various components useful for verifying the library is working on the
target, which are not usually installed by the upstream project.

Note that while this version of zimg claims to support C++11 upwards,
upstream is moving towards only supporting C++17 upwards in the master
branch.

This has been tested on a Raspberry Pi 4 and a Raspberry Pi 5, and on
x86_64 (run in a chroot).

Signed-off-by: Michael Cullen <michael@michaelcullen.name>
---
 DEVELOPERS                                    |   3 +
 package/Config.in                             |   1 +
 package/zimg/0001-Fix-build-with-GCC-15.patch |  34 +++++
 package/zimg/0002-Install-test-app.patch      |  55 +++++++++
 package/zimg/0003-install-examples.patch      |  79 ++++++++++++
 .../0004-Add-option-to-install-tests.patch    | 116 ++++++++++++++++++
 package/zimg/Config.in                        |  27 ++++
 package/zimg/zimg.mk                          |  33 +++++
 8 files changed, 348 insertions(+)
 create mode 100644 package/zimg/0001-Fix-build-with-GCC-15.patch
 create mode 100644 package/zimg/0002-Install-test-app.patch
 create mode 100644 package/zimg/0003-install-examples.patch
 create mode 100644 package/zimg/0004-Add-option-to-install-tests.patch
 create mode 100644 package/zimg/Config.in
 create mode 100644 package/zimg/zimg.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index f982e3123a..940b621d8f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2427,6 +2427,9 @@ N:	Meena Murthy <meena.murthy@amarulasolutions.com>
 F:	board/engicam/px30core/
 F:	configs/engicam_px30_core_defconfig
 
+N:	Michael Cullen <michael@michaelcullen.name>
+F:	package/zimg/
+
 N:	Michael Durrant <mdurrant@arcturusnetworks.com>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
diff --git a/package/Config.in b/package/Config.in
index 352fd626e0..f5d1c79008 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1809,6 +1809,7 @@ menu "Graphics"
 	source "package/wpebackend-fdo/Config.in"
 	source "package/wpewebkit/Config.in"
 	source "package/zbar/Config.in"
+	source "package/zimg/Config.in"
 	source "package/zxing-cpp/Config.in"
 endmenu
 
diff --git a/package/zimg/0001-Fix-build-with-GCC-15.patch b/package/zimg/0001-Fix-build-with-GCC-15.patch
new file mode 100644
index 0000000000..d4f10d3a2b
--- /dev/null
+++ b/package/zimg/0001-Fix-build-with-GCC-15.patch
@@ -0,0 +1,34 @@
+From 03e6c1e5a6f8420404cb035e975738db96628eb2 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Tue, 18 Mar 2025 17:11:00 -0400
+Subject: [PATCH] Fix build with GCC 15
+
+```
+src/testcommon/mmap.cpp: In member function 'void MemoryMappedFile::impl::map_file(const char*, int, int, int)':
+src/testcommon/mmap.cpp:273:62: error: 'PTRDIFF_MAX' was not declared in this scope
+  273 |                 if ((file_size = posix::get_file_size(fd)) > PTRDIFF_MAX)
+      |                                                              ^~~~~~~~~~~
+src/testcommon/mmap.cpp:22:1: note: 'PTRDIFF_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
+```
+
+Upstream: https://github.com/sekrit-twc/zimg/commit/b013c7b006e6bee05b7964162f3a00402168e77f
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ src/testcommon/mmap.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/testcommon/mmap.cpp b/src/testcommon/mmap.cpp
+index b6ba709..0310fa9 100644
+--- a/src/testcommon/mmap.cpp
++++ b/src/testcommon/mmap.cpp
+@@ -10,6 +10,7 @@
+   #include <Windows.h>
+ #else
+   #include <cerrno>
++  #include <cstdint>
+ 
+   #include <fcntl.h>
+   #include <unistd.h>
+-- 
+2.52.0
+
diff --git a/package/zimg/0002-Install-test-app.patch b/package/zimg/0002-Install-test-app.patch
new file mode 100644
index 0000000000..cbafd0bd51
--- /dev/null
+++ b/package/zimg/0002-Install-test-app.patch
@@ -0,0 +1,55 @@
+From d4da533bec77c7f11aef08bed4888a82e1af8cba Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 10:35:15 +0100
+Subject: [PATCH] Install test app
+
+To make sure zimg is working, it would be useful to be able to run the
+test app on the target. Currently, however, it is not installed.
+
+This patch renames it and installs it.
+
+Upstream: N/A - running test app on the target only applies to cross-compilation situations
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 8727ca4..6900c0d 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -39,6 +39,7 @@ dist_examplemisc_DATA = \
+ 	src/testcommon/win32_bitmap.h
+ 
+ 
++bin_PROGRAMS =
+ noinst_PROGRAMS =
+ lib_LTLIBRARIES = libzimg.la
+ noinst_LTLIBRARIES = libzimg_internal.la
+@@ -292,11 +293,11 @@ endif # EXAMPLES
+ 
+ 
+ if TESTAPP
+-noinst_PROGRAMS += testapp
++bin_PROGRAMS += zimg_testapp
+ noinst_LTLIBRARIES += libtestcommon.la
+-testapp_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg -I$(srcdir)/src/testcommon
++zimg_testapp_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg -I$(srcdir)/src/testcommon
+ 
+-testapp_SOURCES = \
++zimg_testapp_SOURCES = \
+ 	src/testapp/apps.h \
+ 	src/testapp/colorspaceapp.cpp \
+ 	src/testapp/cpuinfoapp.cpp \
+@@ -314,7 +315,7 @@ testapp_SOURCES = \
+ 	src/testapp/utils.cpp \
+ 	src/testapp/utils.h
+ 
+-testapp_LDADD = libtestcommon.la libzimg_internal.la
++zimg_testapp_LDADD = libtestcommon.la libzimg_internal.la
+ endif # TESTAPP
+ 
+ 
+-- 
+2.52.0
+
diff --git a/package/zimg/0003-install-examples.patch b/package/zimg/0003-install-examples.patch
new file mode 100644
index 0000000000..c14a8f3e59
--- /dev/null
+++ b/package/zimg/0003-install-examples.patch
@@ -0,0 +1,79 @@
+From abc90707967cf4e2da2348d395d5842dc799ae53 Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 10:39:06 +0100
+Subject: [PATCH] install examples
+
+Like the previous patch that installs the test app, this commit renames
+and installs the examples so they can be tested on the target.
+
+Upstream: N/A - running examples on the target only applies to cross-compilation situations
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am | 42 +++++++++++++++++++++---------------------
+ 1 file changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 6900c0d..0694b50 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -259,36 +259,36 @@ libtestcommon_la_SOURCES = \
+ 
+ 
+ if EXAMPLES
+-noinst_PROGRAMS += \
+-	doc/example/api_example \
+-	doc/example/api_example_c \
+-	doc/example/hdr_example \
+-	doc/example/interlace_example \
+-	doc/example/tile_example
++bin_PROGRAMS += \
++	doc/example/zimg_api_example \
++	doc/example/zimg_api_example_c \
++	doc/example/zimg_hdr_example \
++	doc/example/zimg_interlace_example \
++	doc/example/zimg_tile_example
+ noinst_LTLIBRARIES += libtestcommon.la
+ 
+ EXAMPLE_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg/api -I$(srcdir)/src/testcommon
+ EXAMPLE_LDADD = libtestcommon.la libzimg.la
+ 
+-doc_example_api_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_api_example_SOURCES = doc/example/api_example.cpp
+-doc_example_api_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_api_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_api_example_SOURCES = doc/example/api_example.cpp
++doc_example_zimg_api_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_api_example_c_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_api_example_c_SOURCES = doc/example/api_example_c.c dummy.cpp
+-doc_example_api_example_c_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_api_example_c_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_api_example_c_SOURCES = doc/example/api_example_c.c dummy.cpp
++doc_example_zimg_api_example_c_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_hdr_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_hdr_example_SOURCES = doc/example/hdr_example.cpp
+-doc_example_hdr_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_hdr_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_hdr_example_SOURCES = doc/example/hdr_example.cpp
++doc_example_zimg_hdr_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_interlace_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_interlace_example_SOURCES = doc/example/interlace_example.cpp
+-doc_example_interlace_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_interlace_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_interlace_example_SOURCES = doc/example/interlace_example.cpp
++doc_example_zimg_interlace_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_tile_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_tile_example_SOURCES = doc/example/tile_example.cpp
+-doc_example_tile_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_tile_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_tile_example_SOURCES = doc/example/tile_example.cpp
++doc_example_zimg_tile_example_LDADD = $(EXAMPLE_LDADD)
+ endif # EXAMPLES
+ 
+ 
+-- 
+2.52.0
+
diff --git a/package/zimg/0004-Add-option-to-install-tests.patch b/package/zimg/0004-Add-option-to-install-tests.patch
new file mode 100644
index 0000000000..a52fbd8c46
--- /dev/null
+++ b/package/zimg/0004-Add-option-to-install-tests.patch
@@ -0,0 +1,116 @@
+From 9a04431e7d5d6545b27a946600253eac9b5ee2ef Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 12:26:32 +0100
+Subject: [PATCH] Add option to install tests
+
+When cross compiling, it may be useful to install the tests rather than
+run them. This gives an option to do that.
+
+Upstream: N/A - running tests on the target only applies to cross-compilation situations
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am  | 21 +++++++++++++--------
+ configure.ac |  2 ++
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 0694b50..4cbd97b 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -320,10 +320,10 @@ endif # TESTAPP
+ 
+ 
+ if UNIT_TEST
+-TESTS = test/unit_test
++TESTS = test/zimg_unit_test
+ 
+ check_LTLIBRARIES = test/libmusl_m.la
+-check_PROGRAMS = test/unit_test
++check_PROGRAMS = test/zimg_unit_test
+ 
+ test_libmusl_m_la_CFLAGS = $(AM_CFLAGS) -std=c99 -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable
+ 
+@@ -353,14 +353,14 @@ test_libmusl_m_la_SOURCES = \
+ 	test/extra/musl-libm/powf_data.h \
+ 	test/extra/musl-libm/sin.c
+ 
+-test_unit_test_CPPFLAGS = \
++test_zimg_unit_test_CPPFLAGS = \
+ 	$(AM_CPPFLAGS) \
+ 	-I$(srcdir)/src/zimg \
+ 	-I$(srcdir)/test \
+ 	-I$(srcdir)/test/extra \
+ 	-I$(srcdir)/test/extra/googletest/googletest/include
+ 
+-test_unit_test_SOURCES = \
++test_zimg_unit_test_SOURCES = \
+ 	test/main.cpp \
+ 	test/api/api_test.cpp \
+ 	test/colorspace/colorspace_test.cpp \
+@@ -382,7 +382,7 @@ test_unit_test_SOURCES = \
+ 	test/resize/resize_impl_test.cpp
+ 
+ if ARMSIMD
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/arm/colorspace_neon_test.cpp \
+ 	test/depth/arm/depth_convert_neon_test.cpp \
+ 	test/depth/arm/dither_neon_test.cpp \
+@@ -391,7 +391,7 @@ test_unit_test_SOURCES += \
+ endif # ARMSIMD
+ 
+ if X86SIMD
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/x86/colorspace_avx_test.cpp \
+ 	test/colorspace/x86/colorspace_avx2_test.cpp \
+ 	test/colorspace/x86/colorspace_sse_test.cpp \
+@@ -411,7 +411,7 @@ test_unit_test_SOURCES += \
+ endif # X86SIMD
+ 
+ if X86SIMD_AVX512
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/x86/colorspace_avx512_test.cpp \
+ 	test/colorspace/x86/gamma_constants_avx512_test.cpp \
+ 	test/depth/x86/depth_convert_avx512_test.cpp \
+@@ -425,10 +425,15 @@ test/extra/googletest/build/lib/libgtest.a: .FAKE
+ 
+ .FAKE:
+ 
+-test_unit_test_LDADD = \
++test_zimg_unit_test_LDADD = \
+ 	test/extra/googletest/build/lib/libgtest.a \
+ 	test/libmusl_m.la \
+ 	libzimg_internal.la
++
++if INSTALL_TESTS
++bin_PROGRAMS += test/zimg_unit_test
++endif # INSTALL_TESTS
++
+ endif # UNIT_TEST
+ 
+ clean-local:
+diff --git a/configure.ac b/configure.ac
+index 8402df6..49b5228 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,6 +17,7 @@ AC_CANONICAL_HOST
+ AC_ARG_ENABLE([testapp],   AS_HELP_STRING([--enable-testapp],   [Compile the test application. (default=no)]))
+ AC_ARG_ENABLE([example],   AS_HELP_STRING([--enable-example],   [Compile example programs. (default=no)]))
+ AC_ARG_ENABLE([unit-test], AS_HELP_STRING([--enable-unit-test], [Compile unit tests. May result in slower code. (default=no)]))
++AC_ARG_ENABLE([install-tests], AC_HELP_STRING([--enable-install-tests], [Install tests (default=no)]))
+ AC_ARG_ENABLE([debug],     AS_HELP_STRING([--enable-debug],     [Enable compilation options required for debugging. (default=no)]))
+ AC_ARG_ENABLE([simd],      AS_HELP_STRING([--disable-simd],     [Disable SIMD code. (default=no)]))
+ 
+@@ -114,6 +115,7 @@ int main()
+ AM_CONDITIONAL([TESTAPP],        [test "x$enable_testapp" = "xyes"])
+ AM_CONDITIONAL([EXAMPLES],       [test "x$enable_example" = "xyes"])
+ AM_CONDITIONAL([UNIT_TEST],      [test "x$enable_unit_test" = "xyes"])
++AM_CONDITIONAL([INSTALL_TESTS],  [test "x$enable_install_tests" = "xyes"])
+ AM_CONDITIONAL([ARMSIMD],        [test "x$enable_arm_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD],        [test "x$enable_x86_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD_AVX512], [test "x$enable_x86_simd_avx512" = "xyes"])
+-- 
+2.52.0
+
diff --git a/package/zimg/Config.in b/package/zimg/Config.in
new file mode 100644
index 0000000000..3fbac545dc
--- /dev/null
+++ b/package/zimg/Config.in
@@ -0,0 +1,27 @@
+config BR2_PACKAGE_ZIMG
+	bool "zimg"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+	help
+	  Scaling, colorspace conversion, and dithering library
+
+	  https://github.com/sekrit-twc/zimg
+
+if BR2_PACKAGE_ZIMG
+
+config BR2_PACKAGE_ZIMG_TESTAPP
+	bool "zimg test app"
+
+config BR2_PACKAGE_ZIMG_EXAMPLES
+	bool "zimg examples"
+
+config BR2_PACKAGE_ZIMG_UNIT_TESTS
+	bool "zimg unit tests"
+
+config BR2_PACKAGE_ZIMG_DISABLE_SIMD
+	bool "Disable SIMD in zimg"
+
+endif
+
+comment "zimg needs a toolchain w/ C++11 support"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
diff --git a/package/zimg/zimg.mk b/package/zimg/zimg.mk
new file mode 100644
index 0000000000..0dc314c765
--- /dev/null
+++ b/package/zimg/zimg.mk
@@ -0,0 +1,33 @@
+################################################################################
+#
+# zimg
+#
+################################################################################
+
+ZIMG_VERSION = release-3.0.6
+# This project uses submodules so the tarballs aren't really useful
+ZIMG_SITE_METHOD = git
+ZIMG_GIT_SUBMODULES = yes
+ZIMG_SITE = https://github.com/sekrit-twc/zimg.git
+ZIMG_LICENSE = WTFPL
+ZIMG_LICENSE_FILES = COPYING
+ZIMG_INSTALL_STAGING = YES
+ZIMG_AUTORECONF = YES
+
+ifeq ($(BR2_PACKAGE_ZIMG_TESTAPP),y)
+ZIMG_CONF_OPTS += --enable-testapp
+endif
+
+ifeq ($(BR2_PACKAGE_ZIMG_EXAMPLES),y)
+ZIMG_CONF_OPTS += --enable-example
+endif
+
+ifeq ($(BR2_PACKAGE_ZIMG_UNIT_TESTS),y)
+ZIMG_CONF_OPTS += --enable-unit-test --enable-install-tests
+endif
+
+ifeq ($(BR2_PACKAGE_ZIMG_DISABLE_SIMD),y)
+ZIMG_CONF_OPTS += --disable-simd
+endif
+
+$(eval $(autotools-package))
-- 
2.52.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] package/zimg: add zimg package
  2026-01-06 18:57 [Buildroot] [PATCH] package/zimg: add zimg package Michael Cullen via buildroot
@ 2026-01-06 20:43 ` Thomas Petazzoni via buildroot
  2026-01-25 12:20 ` [Buildroot] [PATCH v2] " Michael Cullen via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-01-06 20:43 UTC (permalink / raw)
  To: Michael Cullen; +Cc: buildroot

Hello Michael,

On Tue,  6 Jan 2026 19:57:26 +0100
Michael Cullen <michael@michaelcullen.name> wrote:

> This commit adds an image transformation library called zimg.
> 
> There are a number of patches applied. One is from upstream and supports
> building on GCC-15, the others are autotools patches to allow installing
> various components useful for verifying the library is working on the
> target, which are not usually installed by the upstream project.
> 
> Note that while this version of zimg claims to support C++11 upwards,
> upstream is moving towards only supporting C++17 upwards in the master
> branch.
> 
> This has been tested on a Raspberry Pi 4 and a Raspberry Pi 5, and on
> x86_64 (run in a chroot).
> 
> Signed-off-by: Michael Cullen <michael@michaelcullen.name>

Thanks for this patch! It overall looks good, and I only have a few
comments see below.


> diff --git a/package/zimg/0002-Install-test-app.patch b/package/zimg/0002-Install-test-app.patch
> new file mode 100644
> index 0000000000..cbafd0bd51
> --- /dev/null
> +++ b/package/zimg/0002-Install-test-app.patch
> @@ -0,0 +1,55 @@
> +From d4da533bec77c7f11aef08bed4888a82e1af8cba Mon Sep 17 00:00:00 2001
> +From: Michael Cullen <michael@michaelcullen.name>
> +Date: Tue, 6 Jan 2026 10:35:15 +0100
> +Subject: [PATCH] Install test app
> +
> +To make sure zimg is working, it would be useful to be able to run the
> +test app on the target. Currently, however, it is not installed.
> +
> +This patch renames it and installs it.
> +
> +Upstream: N/A - running test app on the target only applies to cross-compilation situations

For this one, and the other 2 patches that you marked as not
upstreamable, could you take the same approach as your patch
0004-Add-option-to-install-tests.patch, which is to add a ./configure
option to enable/disable installation of the test application, of the
examples. And then it makes that upstreamable. You keep the default as
disabled, so nothing changes, but you allow people like you/Buildroot
who need those features to actually enable them. There's nothing "not
upstreamable" in those changes IMO, and it would anyway not be nice to
integrate a brand new package in Buildroot that has so many
non-upstream patches.

> diff --git a/package/zimg/Config.in b/package/zimg/Config.in
> new file mode 100644
> index 0000000000..3fbac545dc
> --- /dev/null
> +++ b/package/zimg/Config.in
> @@ -0,0 +1,27 @@
> +config BR2_PACKAGE_ZIMG
> +	bool "zimg"
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
> +	help
> +	  Scaling, colorspace conversion, and dithering library
> +
> +	  https://github.com/sekrit-twc/zimg
> +
> +if BR2_PACKAGE_ZIMG
> +
> +config BR2_PACKAGE_ZIMG_TESTAPP
> +	bool "zimg test app"
> +
> +config BR2_PACKAGE_ZIMG_EXAMPLES
> +	bool "zimg examples"
> +
> +config BR2_PACKAGE_ZIMG_UNIT_TESTS
> +	bool "zimg unit tests"
> +
> +config BR2_PACKAGE_ZIMG_DISABLE_SIMD
> +	bool "Disable SIMD in zimg"
> +
> +endif
> +
> +comment "zimg needs a toolchain w/ C++11 support"

This should be:

comment "zime needs a toolchain w/ C++, gcc >= 4.9"

> +	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
> diff --git a/package/zimg/zimg.mk b/package/zimg/zimg.mk
> new file mode 100644
> index 0000000000..0dc314c765
> --- /dev/null
> +++ b/package/zimg/zimg.mk
> @@ -0,0 +1,33 @@
> +################################################################################
> +#
> +# zimg
> +#
> +################################################################################
> +
> +ZIMG_VERSION = release-3.0.6
> +# This project uses submodules so the tarballs aren't really useful
> +ZIMG_SITE_METHOD = git
> +ZIMG_GIT_SUBMODULES = yes
> +ZIMG_SITE = https://github.com/sekrit-twc/zimg.git
> +ZIMG_LICENSE = WTFPL
> +ZIMG_LICENSE_FILES = COPYING
> +ZIMG_INSTALL_STAGING = YES
> +ZIMG_AUTORECONF = YES
> +
> +ifeq ($(BR2_PACKAGE_ZIMG_TESTAPP),y)
> +ZIMG_CONF_OPTS += --enable-testapp
> +endif
> +
> +ifeq ($(BR2_PACKAGE_ZIMG_EXAMPLES),y)
> +ZIMG_CONF_OPTS += --enable-example
> +endif
> +
> +ifeq ($(BR2_PACKAGE_ZIMG_UNIT_TESTS),y)
> +ZIMG_CONF_OPTS += --enable-unit-test --enable-install-tests
> +endif

Please add explicit disable in "else" clauses:

ifeq (...)
FOO_CONF_OPTS += --enable-bar
else
FOO_CONF_OPTS += --disable-bar
endif

> +
> +ifeq ($(BR2_PACKAGE_ZIMG_DISABLE_SIMD),y)

Meh, can we instead rely on existing architecture options, like MMX,
SSE, AVX, NEON, etc. to decide whether to enable SIMD or not?

> +ZIMG_CONF_OPTS += --disable-simd
> +endif
> +
> +$(eval $(autotools-package))

Aside from those comments, looks good. Could you rework a bit, and
submit a v2?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v2] package/zimg: add zimg package
  2026-01-06 18:57 [Buildroot] [PATCH] package/zimg: add zimg package Michael Cullen via buildroot
  2026-01-06 20:43 ` Thomas Petazzoni via buildroot
@ 2026-01-25 12:20 ` Michael Cullen via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Cullen via buildroot @ 2026-01-25 12:20 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Cullen, Thomas Petazzoni

This commit adds an image transformation library called zimg.

There are a number of patches applied. One is from upstream and supports
building on GCC-15, the others are autotools patches to allow installing
various components useful for verifying the library is working on the
target, which are not usually installed by the upstream project.

Note that while this version of zimg claims to support C++11 upwards,
upstream is moving towards only supporting C++17 upwards in the master
branch.

This has been tested on a Raspberry Pi 4 and a Raspberry Pi 5, and on
x86_64 (run in a chroot).

Signed-off-by: Michael Cullen <michael@michaelcullen.name>
---
Changes V1 -> V2:
  - Submitted PR upstream with patches
  - Changed help text to reference "gcc >= 4.9" rather than just "C++11"
  - Added explicit "--disable-..." configure options
  - Removed "disable SIMD" option as requested. This option was only there
      because the upstream configure script supports it so I decided to expose
      it. It probably isn't very useful in normal situations though
---
 DEVELOPERS                                    |   3 +
 package/Config.in                             |   1 +
 package/zimg/0001-Fix-build-with-GCC-15.patch |  34 +++++
 .../0002-Add-option-to-install-test-app.patch |  83 +++++++++++++
 .../0003-Add-option-to-install-examples.patch | 107 ++++++++++++++++
 .../0004-Add-option-to-install-tests.patch    | 116 ++++++++++++++++++
 package/zimg/Config.in                        |  28 +++++
 package/zimg/zimg.mk                          |  35 ++++++
 8 files changed, 407 insertions(+)
 create mode 100644 package/zimg/0001-Fix-build-with-GCC-15.patch
 create mode 100644 package/zimg/0002-Add-option-to-install-test-app.patch
 create mode 100644 package/zimg/0003-Add-option-to-install-examples.patch
 create mode 100644 package/zimg/0004-Add-option-to-install-tests.patch
 create mode 100644 package/zimg/Config.in
 create mode 100644 package/zimg/zimg.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 08c98ec53b..975caf7035 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2412,6 +2412,9 @@ N:	Meena Murthy <meena.murthy@amarulasolutions.com>
 F:	board/engicam/px30core/
 F:	configs/engicam_px30_core_defconfig
 
+N:	Michael Cullen <michael@michaelcullen.name>
+F:	package/zimg/
+
 N:	Michael Durrant <mdurrant@arcturusnetworks.com>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
diff --git a/package/Config.in b/package/Config.in
index 94ea56b297..6c603f7de0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1804,6 +1804,7 @@ menu "Graphics"
 	source "package/wpebackend-fdo/Config.in"
 	source "package/wpewebkit/Config.in"
 	source "package/zbar/Config.in"
+	source "package/zimg/Config.in"
 	source "package/zxing-cpp/Config.in"
 endmenu
 
diff --git a/package/zimg/0001-Fix-build-with-GCC-15.patch b/package/zimg/0001-Fix-build-with-GCC-15.patch
new file mode 100644
index 0000000000..d4f10d3a2b
--- /dev/null
+++ b/package/zimg/0001-Fix-build-with-GCC-15.patch
@@ -0,0 +1,34 @@
+From 03e6c1e5a6f8420404cb035e975738db96628eb2 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Tue, 18 Mar 2025 17:11:00 -0400
+Subject: [PATCH] Fix build with GCC 15
+
+```
+src/testcommon/mmap.cpp: In member function 'void MemoryMappedFile::impl::map_file(const char*, int, int, int)':
+src/testcommon/mmap.cpp:273:62: error: 'PTRDIFF_MAX' was not declared in this scope
+  273 |                 if ((file_size = posix::get_file_size(fd)) > PTRDIFF_MAX)
+      |                                                              ^~~~~~~~~~~
+src/testcommon/mmap.cpp:22:1: note: 'PTRDIFF_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
+```
+
+Upstream: https://github.com/sekrit-twc/zimg/commit/b013c7b006e6bee05b7964162f3a00402168e77f
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ src/testcommon/mmap.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/testcommon/mmap.cpp b/src/testcommon/mmap.cpp
+index b6ba709..0310fa9 100644
+--- a/src/testcommon/mmap.cpp
++++ b/src/testcommon/mmap.cpp
+@@ -10,6 +10,7 @@
+   #include <Windows.h>
+ #else
+   #include <cerrno>
++  #include <cstdint>
+ 
+   #include <fcntl.h>
+   #include <unistd.h>
+-- 
+2.52.0
+
diff --git a/package/zimg/0002-Add-option-to-install-test-app.patch b/package/zimg/0002-Add-option-to-install-test-app.patch
new file mode 100644
index 0000000000..94ec319c5b
--- /dev/null
+++ b/package/zimg/0002-Add-option-to-install-test-app.patch
@@ -0,0 +1,83 @@
+From b8f6ab33354702c52d996c74261242542610dfc3 Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 10:35:15 +0100
+Subject: [PATCH] Add option to install test app
+
+To make sure zimg is working, it would be useful to be able to run the
+test app on the target. Currently, however, it is not installed.
+
+This patch renames it and adds an option to install it.
+
+Upstream: https://github.com/sekrit-twc/zimg/pull/233
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am  | 16 ++++++++++++----
+ configure.ac |  2 ++
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 8727ca4..7f83427 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -39,6 +39,7 @@ dist_examplemisc_DATA = \
+ 	src/testcommon/win32_bitmap.h
+ 
+ 
++bin_PROGRAMS =
+ noinst_PROGRAMS =
+ lib_LTLIBRARIES = libzimg.la
+ noinst_LTLIBRARIES = libzimg_internal.la
+@@ -292,11 +293,18 @@ endif # EXAMPLES
+ 
+ 
+ if TESTAPP
+-noinst_PROGRAMS += testapp
++testapp_progs = zimg_testapp
++
++if INSTALL_TESTAPP
++bin_PROGRAMS += $(testapp_progs)
++else # INSTALL_TESTAPP
++noinst_PROGRAMS += $(testapp_progs)
++endif # INSTALL_TESTAPP
++
+ noinst_LTLIBRARIES += libtestcommon.la
+-testapp_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg -I$(srcdir)/src/testcommon
++zimg_testapp_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg -I$(srcdir)/src/testcommon $(graphengineflags)
+ 
+-testapp_SOURCES = \
++zimg_testapp_SOURCES = \
+ 	src/testapp/apps.h \
+ 	src/testapp/colorspaceapp.cpp \
+ 	src/testapp/cpuinfoapp.cpp \
+@@ -314,7 +322,7 @@ testapp_SOURCES = \
+ 	src/testapp/utils.cpp \
+ 	src/testapp/utils.h
+ 
+-testapp_LDADD = libtestcommon.la libzimg_internal.la
++zimg_testapp_LDADD = libtestcommon.la libzimg_internal.la
+ endif # TESTAPP
+ 
+ 
+diff --git a/configure.ac b/configure.ac
+index 8402df6..d7d0ea2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,6 +17,7 @@ AC_CANONICAL_HOST
+ AC_ARG_ENABLE([testapp],   AS_HELP_STRING([--enable-testapp],   [Compile the test application. (default=no)]))
+ AC_ARG_ENABLE([example],   AS_HELP_STRING([--enable-example],   [Compile example programs. (default=no)]))
+ AC_ARG_ENABLE([unit-test], AS_HELP_STRING([--enable-unit-test], [Compile unit tests. May result in slower code. (default=no)]))
++AC_ARG_ENABLE([install-testapp], AS_HELP_STRING([--enable-install-testapp], [Install test app (default=no)]))
+ AC_ARG_ENABLE([debug],     AS_HELP_STRING([--enable-debug],     [Enable compilation options required for debugging. (default=no)]))
+ AC_ARG_ENABLE([simd],      AS_HELP_STRING([--disable-simd],     [Disable SIMD code. (default=no)]))
+ 
+@@ -114,6 +115,7 @@ int main()
+ AM_CONDITIONAL([TESTAPP],        [test "x$enable_testapp" = "xyes"])
+ AM_CONDITIONAL([EXAMPLES],       [test "x$enable_example" = "xyes"])
+ AM_CONDITIONAL([UNIT_TEST],      [test "x$enable_unit_test" = "xyes"])
++AM_CONDITIONAL([INSTALL_TESTAPP], [test "x$enable_install_testapp" = "xyes"])
+ AM_CONDITIONAL([ARMSIMD],        [test "x$enable_arm_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD],        [test "x$enable_x86_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD_AVX512], [test "x$enable_x86_simd_avx512" = "xyes"])
+-- 
+2.52.0
+
diff --git a/package/zimg/0003-Add-option-to-install-examples.patch b/package/zimg/0003-Add-option-to-install-examples.patch
new file mode 100644
index 0000000000..b0687b842c
--- /dev/null
+++ b/package/zimg/0003-Add-option-to-install-examples.patch
@@ -0,0 +1,107 @@
+From 6bb35899f3720be6830af30eeed3dafbf028b6ed Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 10:39:06 +0100
+Subject: [PATCH] Add option to install examples
+
+Like the previous patch that installs the test app, this commit renames
+and gives an option to install the examples so they can be tested on the target.
+
+Upstream: https://github.com/sekrit-twc/zimg/pull/233
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am  | 49 ++++++++++++++++++++++++++++---------------------
+ configure.ac |  2 ++
+ 2 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 7f83427..7ef374c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -259,36 +259,43 @@ libtestcommon_la_SOURCES = \
+ 
+ 
+ if EXAMPLES
+-noinst_PROGRAMS += \
+-	doc/example/api_example \
+-	doc/example/api_example_c \
+-	doc/example/hdr_example \
+-	doc/example/interlace_example \
+-	doc/example/tile_example
++example_progs = \
++	doc/example/zimg_api_example \
++	doc/example/zimg_api_example_c \
++	doc/example/zimg_hdr_example \
++	doc/example/zimg_interlace_example \
++	doc/example/zimg_tile_example
++
++if INSTALL_EXAMPLES
++bin_PROGRAMS += $(example_progs)
++else # INSTALL_EXAMPLES
++noinst_PROGRAMS += $(example_progs)
++endif # INSTALL_EXAMPLES
++
+ noinst_LTLIBRARIES += libtestcommon.la
+ 
+ EXAMPLE_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg/api -I$(srcdir)/src/testcommon
+ EXAMPLE_LDADD = libtestcommon.la libzimg.la
+ 
+-doc_example_api_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_api_example_SOURCES = doc/example/api_example.cpp
+-doc_example_api_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_api_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_api_example_SOURCES = doc/example/api_example.cpp
++doc_example_zimg_api_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_api_example_c_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_api_example_c_SOURCES = doc/example/api_example_c.c dummy.cpp
+-doc_example_api_example_c_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_api_example_c_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_api_example_c_SOURCES = doc/example/api_example_c.c dummy.cpp
++doc_example_zimg_api_example_c_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_hdr_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_hdr_example_SOURCES = doc/example/hdr_example.cpp
+-doc_example_hdr_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_hdr_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_hdr_example_SOURCES = doc/example/hdr_example.cpp
++doc_example_zimg_hdr_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_interlace_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_interlace_example_SOURCES = doc/example/interlace_example.cpp
+-doc_example_interlace_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_interlace_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_interlace_example_SOURCES = doc/example/interlace_example.cpp
++doc_example_zimg_interlace_example_LDADD = $(EXAMPLE_LDADD)
+ 
+-doc_example_tile_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
+-doc_example_tile_example_SOURCES = doc/example/tile_example.cpp
+-doc_example_tile_example_LDADD = $(EXAMPLE_LDADD)
++doc_example_zimg_tile_example_CPPFLAGS = $(EXAMPLE_CPPFLAGS)
++doc_example_zimg_tile_example_SOURCES = doc/example/tile_example.cpp
++doc_example_zimg_tile_example_LDADD = $(EXAMPLE_LDADD)
+ endif # EXAMPLES
+ 
+ 
+diff --git a/configure.ac b/configure.ac
+index d7d0ea2..26a0627 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -18,6 +18,7 @@ AC_ARG_ENABLE([testapp],   AS_HELP_STRING([--enable-testapp],   [Compile the tes
+ AC_ARG_ENABLE([example],   AS_HELP_STRING([--enable-example],   [Compile example programs. (default=no)]))
+ AC_ARG_ENABLE([unit-test], AS_HELP_STRING([--enable-unit-test], [Compile unit tests. May result in slower code. (default=no)]))
+ AC_ARG_ENABLE([install-testapp], AS_HELP_STRING([--enable-install-testapp], [Install test app (default=no)]))
++AC_ARG_ENABLE([install-examples], AS_HELP_STRING([--enable-install-examples], [Install example programs (default=no)]))
+ AC_ARG_ENABLE([debug],     AS_HELP_STRING([--enable-debug],     [Enable compilation options required for debugging. (default=no)]))
+ AC_ARG_ENABLE([simd],      AS_HELP_STRING([--disable-simd],     [Disable SIMD code. (default=no)]))
+ 
+@@ -116,6 +117,7 @@ AM_CONDITIONAL([TESTAPP],        [test "x$enable_testapp" = "xyes"])
+ AM_CONDITIONAL([EXAMPLES],       [test "x$enable_example" = "xyes"])
+ AM_CONDITIONAL([UNIT_TEST],      [test "x$enable_unit_test" = "xyes"])
+ AM_CONDITIONAL([INSTALL_TESTAPP], [test "x$enable_install_testapp" = "xyes"])
++AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_install_examples" = "xyes"])
+ AM_CONDITIONAL([ARMSIMD],        [test "x$enable_arm_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD],        [test "x$enable_x86_simd" = "xyes"])
+ AM_CONDITIONAL([X86SIMD_AVX512], [test "x$enable_x86_simd_avx512" = "xyes"])
+-- 
+2.52.0
+
diff --git a/package/zimg/0004-Add-option-to-install-tests.patch b/package/zimg/0004-Add-option-to-install-tests.patch
new file mode 100644
index 0000000000..a38dad4c86
--- /dev/null
+++ b/package/zimg/0004-Add-option-to-install-tests.patch
@@ -0,0 +1,116 @@
+From ca6948e68a5e3e0ce4d6483bb7a93f6781862ed4 Mon Sep 17 00:00:00 2001
+From: Michael Cullen <michael@michaelcullen.name>
+Date: Tue, 6 Jan 2026 12:26:32 +0100
+Subject: [PATCH] Add option to install tests
+
+When cross compiling, it may be useful to install the tests rather than
+run them. This gives an option to do that.
+
+Upstream: https://github.com/sekrit-twc/zimg/pull/233
+Signed-off-by: Michael Cullen <michael@michaelcullen.name>
+---
+ Makefile.am  | 21 +++++++++++++--------
+ configure.ac |  2 ++
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 7ef374c..3441f72 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -334,10 +334,10 @@ endif # TESTAPP
+ 
+ 
+ if UNIT_TEST
+-TESTS = test/unit_test
++TESTS = test/zimg_unit_test
+ 
+ check_LTLIBRARIES = test/libmusl_m.la
+-check_PROGRAMS = test/unit_test
++check_PROGRAMS = test/zimg_unit_test
+ 
+ test_libmusl_m_la_CFLAGS = $(AM_CFLAGS) -std=c99 -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable
+ 
+@@ -367,14 +367,14 @@ test_libmusl_m_la_SOURCES = \
+ 	test/extra/musl-libm/powf_data.h \
+ 	test/extra/musl-libm/sin.c
+ 
+-test_unit_test_CPPFLAGS = \
++test_zimg_unit_test_CPPFLAGS = \
+ 	$(AM_CPPFLAGS) \
+ 	-I$(srcdir)/src/zimg \
+ 	-I$(srcdir)/test \
+ 	-I$(srcdir)/test/extra \
+ 	-I$(srcdir)/test/extra/googletest/googletest/include
+ 
+-test_unit_test_SOURCES = \
++test_zimg_unit_test_SOURCES = \
+ 	test/main.cpp \
+ 	test/api/api_test.cpp \
+ 	test/colorspace/colorspace_test.cpp \
+@@ -396,7 +396,7 @@ test_unit_test_SOURCES = \
+ 	test/resize/resize_impl_test.cpp
+ 
+ if ARMSIMD
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/arm/colorspace_neon_test.cpp \
+ 	test/depth/arm/depth_convert_neon_test.cpp \
+ 	test/depth/arm/dither_neon_test.cpp \
+@@ -405,7 +405,7 @@ test_unit_test_SOURCES += \
+ endif # ARMSIMD
+ 
+ if X86SIMD
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/x86/colorspace_avx_test.cpp \
+ 	test/colorspace/x86/colorspace_avx2_test.cpp \
+ 	test/colorspace/x86/colorspace_sse_test.cpp \
+@@ -425,7 +425,7 @@ test_unit_test_SOURCES += \
+ endif # X86SIMD
+ 
+ if X86SIMD_AVX512
+-test_unit_test_SOURCES += \
++test_zimg_unit_test_SOURCES += \
+ 	test/colorspace/x86/colorspace_avx512_test.cpp \
+ 	test/colorspace/x86/gamma_constants_avx512_test.cpp \
+ 	test/depth/x86/depth_convert_avx512_test.cpp \
+@@ -439,10 +439,15 @@ test/extra/googletest/build/lib/libgtest.a: .FAKE
+ 
+ .FAKE:
+ 
+-test_unit_test_LDADD = \
++test_zimg_unit_test_LDADD = \
+ 	test/extra/googletest/build/lib/libgtest.a \
+ 	test/libmusl_m.la \
+ 	libzimg_internal.la
++
++if INSTALL_TESTS
++bin_PROGRAMS += test/zimg_unit_test
++endif # INSTALL_TESTS
++
+ endif # UNIT_TEST
+ 
+ clean-local:
+diff --git a/configure.ac b/configure.ac
+index 26a0627..cc125da 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,6 +17,7 @@ AC_CANONICAL_HOST
+ AC_ARG_ENABLE([testapp],   AS_HELP_STRING([--enable-testapp],   [Compile the test application. (default=no)]))
+ AC_ARG_ENABLE([example],   AS_HELP_STRING([--enable-example],   [Compile example programs. (default=no)]))
+ AC_ARG_ENABLE([unit-test], AS_HELP_STRING([--enable-unit-test], [Compile unit tests. May result in slower code. (default=no)]))
++AC_ARG_ENABLE([install-tests], AS_HELP_STRING([--enable-install-tests], [Install tests (default=no)]))
+ AC_ARG_ENABLE([install-testapp], AS_HELP_STRING([--enable-install-testapp], [Install test app (default=no)]))
+ AC_ARG_ENABLE([install-examples], AS_HELP_STRING([--enable-install-examples], [Install example programs (default=no)]))
+ AC_ARG_ENABLE([debug],     AS_HELP_STRING([--enable-debug],     [Enable compilation options required for debugging. (default=no)]))
+@@ -116,6 +117,7 @@ int main()
+ AM_CONDITIONAL([TESTAPP],        [test "x$enable_testapp" = "xyes"])
+ AM_CONDITIONAL([EXAMPLES],       [test "x$enable_example" = "xyes"])
+ AM_CONDITIONAL([UNIT_TEST],      [test "x$enable_unit_test" = "xyes"])
++AM_CONDITIONAL([INSTALL_TESTS],  [test "x$enable_install_tests" = "xyes"])
+ AM_CONDITIONAL([INSTALL_TESTAPP], [test "x$enable_install_testapp" = "xyes"])
+ AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_install_examples" = "xyes"])
+ AM_CONDITIONAL([ARMSIMD],        [test "x$enable_arm_simd" = "xyes"])
+-- 
+2.52.0
+
diff --git a/package/zimg/Config.in b/package/zimg/Config.in
new file mode 100644
index 0000000000..2046f1426f
--- /dev/null
+++ b/package/zimg/Config.in
@@ -0,0 +1,28 @@
+config BR2_PACKAGE_ZIMG
+	bool "zimg"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+	help
+	  Scaling, colorspace conversion, and dithering library
+
+	  https://github.com/sekrit-twc/zimg
+
+if BR2_PACKAGE_ZIMG
+
+config BR2_PACKAGE_ZIMG_TESTAPP
+	bool "zimg test app"
+
+config BR2_PACKAGE_ZIMG_EXAMPLES
+	bool "zimg examples"
+
+config BR2_PACKAGE_ZIMG_UNIT_TESTS
+	bool "zimg unit tests"
+	help
+	  Build the Zimg unit tests. Note: building these enables some
+	  compilation options to improve repeatability, but these may
+	  reduce performance
+
+endif
+
+comment "zimg needs a toolchain w/ C++, gcc >= 4.9"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
diff --git a/package/zimg/zimg.mk b/package/zimg/zimg.mk
new file mode 100644
index 0000000000..3029b3e7b9
--- /dev/null
+++ b/package/zimg/zimg.mk
@@ -0,0 +1,35 @@
+################################################################################
+#
+# zimg
+#
+################################################################################
+
+ZIMG_VERSION = release-3.0.6
+# This project uses submodules so the tarballs aren't really useful
+ZIMG_SITE_METHOD = git
+ZIMG_GIT_SUBMODULES = yes
+ZIMG_SITE = https://github.com/sekrit-twc/zimg.git
+ZIMG_LICENSE = WTFPL
+ZIMG_LICENSE_FILES = COPYING
+ZIMG_INSTALL_STAGING = YES
+ZIMG_AUTORECONF = YES
+
+ifeq ($(BR2_PACKAGE_ZIMG_TESTAPP),y)
+ZIMG_CONF_OPTS += --enable-testapp --enable-install-testapp
+else
+ZIMG_CONF_OPTS += --disable-testapp --disable-install-testapp
+endif
+
+ifeq ($(BR2_PACKAGE_ZIMG_EXAMPLES),y)
+ZIMG_CONF_OPTS += --enable-example --enable-install-examples
+else
+ZIMG_CONF_OPTS += --disable-example --disable-install-examples
+endif
+
+ifeq ($(BR2_PACKAGE_ZIMG_UNIT_TESTS),y)
+ZIMG_CONF_OPTS += --enable-unit-test --enable-install-tests
+else
+ZIMG_CONF_OPTS += --disable-unit-test --disable-install-tests
+endif
+
+$(eval $(autotools-package))
-- 
2.52.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-25 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 18:57 [Buildroot] [PATCH] package/zimg: add zimg package Michael Cullen via buildroot
2026-01-06 20:43 ` Thomas Petazzoni via buildroot
2026-01-25 12:20 ` [Buildroot] [PATCH v2] " Michael Cullen via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox