media-libs/libbpg: respect LD, CXX and CFLAGS from the user enviroment

Closes: https://bugs.gentoo.org/787683
Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
Lucio Sauer 2023-09-17 23:41:31 +02:00
parent 1c99f90388
commit f764b3ff11
No known key found for this signature in database
GPG Key ID: 5568A2DDA60CA297
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,42 @@
Honor {C{,XX},LD}FLAGS from the user environment. Strip debugging flag -g
preemtively to avoid "... adds uncommon flags" bugs such as
https://bugs.gentoo.org/914187
Author: Lucio Sauer <watermanpaint@posteo.net>
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,9 @@ EMCC=emcc
PWD:=$(shell pwd)
+GENTOO_CFLAGS:=${CFLAGS}
+GENTOO_CXXFLAGS:=${CXXFLAGS}
+
CFLAGS:=-Os -Wall -MMD -fno-asynchronous-unwind-tables -fdata-sections -ffunction-sections -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer
CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT
CFLAGS+=-I.
@@ -54,14 +57,12 @@ EMLDFLAGS+=-s NO_FILESYSTEM=1 -s NO_BROWSER=1
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 0 --pre-js pre.js --post-js post.js
EMCFLAGS:=$(CFLAGS)
-LDFLAGS=-g
ifdef CONFIG_APPLE
LDFLAGS+=-Wl,-dead_strip
else
-LDFLAGS+=-Wl,--gc-sections
+LDFLAGS:=-Wl,--gc-sections ${LDFLAGS}
endif
-CFLAGS+=-g
-CXXFLAGS=$(CFLAGS)
+CXXFLAGS=$(CFLAGS) ${GENTOO_CXXFLAGS}
PROGS=bpgdec$(EXE) bpgenc$(EXE)
ifdef USE_BPGVIEW
@@ -225,7 +226,7 @@ clean: x265_clean
$(addsuffix /*.a, $(CLEAN_DIRS))
%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) ${GENTOO_CFLAGS} -c -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

View File

@ -40,6 +40,7 @@ PATCHES=(
"${FILESDIR}"/${P}-dont-strip-bins.patch
"${FILESDIR}"/${P}-remove-forced-options.patch
"${FILESDIR}"/${P}-remove-unused-cmake-var.patch
"${FILESDIR}"/${P}-respect-user-flags.patch
)
# Libnuma is a dependency of the default (x265) encoder.