commit:     b30c38e658ce7b899ae8160523af4fd6d780cd7f
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Thu Dec 18 16:40:10 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 22 11:44:20 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b30c38e6

media-libs/quirc: allow sdl'less build

Bug: https://bugs.gentoo.org/941260
Fixes: a628990882113048762734368940f0c98682b8b1
See-Also: 8b5c597a0b9d6b174264227f1d7a4b54fc5551e2
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45075
Closes: https://github.com/gentoo/gentoo/pull/45075
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/quirc-1.2-allow-sdl-less-build.patch     | 51 ++++++++++++++++++++++
 media-libs/quirc/quirc-1.2-r3.ebuild               |  4 ++
 media-libs/quirc/quirc-9999.ebuild                 |  4 ++
 3 files changed, 59 insertions(+)

diff --git a/media-libs/quirc/files/quirc-1.2-allow-sdl-less-build.patch 
b/media-libs/quirc/files/quirc-1.2-allow-sdl-less-build.patch
new file mode 100644
index 000000000000..7c32134cd6ab
--- /dev/null
+++ b/media-libs/quirc/files/quirc-1.2-allow-sdl-less-build.patch
@@ -0,0 +1,51 @@
+https://bugs.gentoo.org/941260
+https://github.com/dlbeer/quirc/pull/149
+
+Note: This will mask errors for pkg-config sdl.
+
+From 39a51ffb71173803f158a9f91234b40ea0d43269 Mon Sep 17 00:00:00 2001
+From: YAMAMOTO Takashi <[email protected]>
+Date: Sun, 2 Feb 2025 11:09:19 +0900
+Subject: [PATCH] Ignore pkg-config error messages
+
+To avoid errors like the following:
+
+```
+cc -Ilib -O3 -Wall -fPIC Package sdl was not found in the pkg-config search 
path. Perhaps you should add the directory containing `sdl.pc' to the 
PKG_CONFIG_PATH environment variable Package 'sdl' not found -o lib/decode.o -c 
lib/decode.c
+/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
+/bin/sh: -c: line 1: syntax error: unexpected end of file
+gmake: *** [Makefile:90: lib/decode.o] Error 2
+```
+
+This (at least the SDL part) was neccessary on my environment:
+
+* macOS 15.2
+* Xcode 16.2
+* pkg-config 2.3.0 (homebrew)
+* GNU make 4.4.1 (homebrew)
+* opencv 4.11.0 (homebrew)
+* no SDL installed
+--- a/Makefile
++++ b/Makefile
+@@ -15,8 +15,8 @@
+ 
+ CC ?= gcc
+ PREFIX ?= /usr/local
+-SDL_CFLAGS := $(shell pkg-config --cflags sdl 2>&1)
+-SDL_LIBS = $(shell pkg-config --libs sdl)
++SDL_CFLAGS := $(shell pkg-config --cflags sdl 2> /dev/null)
++SDL_LIBS = $(shell pkg-config --libs sdl 2> /dev/null)
+ 
+ LIB_VERSION = 1.2
+ 
+@@ -43,8 +43,8 @@ DEMO_UTIL_OBJ = \
+     demo/dthash.o \
+     demo/demoutil.o
+ 
+-OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2>&1)
+-OPENCV_LIBS = $(shell pkg-config --libs opencv4)
++OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2> /dev/null)
++OPENCV_LIBS = $(shell pkg-config --libs opencv4 2> /dev/null)
+ QUIRC_CXXFLAGS = $(QUIRC_CFLAGS) $(OPENCV_CFLAGS) --std=c++17
+ 
+ .PHONY: all v4l sdl opencv install uninstall clean

diff --git a/media-libs/quirc/quirc-1.2-r3.ebuild 
b/media-libs/quirc/quirc-1.2-r3.ebuild
index 5b2e89ed68b6..50509df75b04 100644
--- a/media-libs/quirc/quirc-1.2-r3.ebuild
+++ b/media-libs/quirc/quirc-1.2-r3.ebuild
@@ -47,6 +47,10 @@ SLOT="0/${PV}"
 
 IUSE="opencv sdl tools v4l"
 
+PATCHES=(
+       "${FILESDIR}/quirc-1.2-allow-sdl-less-build.patch"
+)
+
 src_prepare() {
        read -r LIB_VERSION <<< "$(grep '^LIB_VERSION = ' "${S}/Makefile" | cut 
-d ' ' -f 3 || die)"
        export LIB_VERSION

diff --git a/media-libs/quirc/quirc-9999.ebuild 
b/media-libs/quirc/quirc-9999.ebuild
index 6999186dcea6..c6a89e9fd422 100644
--- a/media-libs/quirc/quirc-9999.ebuild
+++ b/media-libs/quirc/quirc-9999.ebuild
@@ -47,6 +47,10 @@ SLOT="0/${PV}"
 
 IUSE="opencv sdl tools v4l"
 
+PATCHES=(
+       "${FILESDIR}/quirc-1.2-allow-sdl-less-build.patch"
+)
+
 src_prepare() {
        read -r LIB_VERSION <<< "$(grep '^LIB_VERSION = ' "${S}/Makefile" | cut 
-d ' ' -f 3 || die)"
        export LIB_VERSION

Reply via email to