dmidecode/dmidecode-allow-overriding-build-settings-from-env.patch
Jean Delvare 84e0754eb1 Accepting request 796018 from home:jdelvare:branches:Base:System
3 recommended fixes from upstream:
- dmidecode-print-type-33-name-unconditionally.patch: Print type 33
  name unconditionally.
- dmidecode-dont-choke-on-invalid-processor-voltage.patch: Don't
  choke on invalid processor voltage.
- dmidecode-fix-the-alignment-of-type-25-name.patch: Fix the
  alignment of type 25 name.
Build fix:
- dmidecode-allow-overriding-build-settings-from-env.patch: Fix the
  build system so that the compilation flags passed by OBS are
  added to the ones dmidecode needs, instead of overriding them
  entirely.
- dmidecode.spec: Pass the CFLAGS through the environment, instead
  of as a parameter.

OBS-URL: https://build.opensuse.org/request/show/796018
OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=56
2020-04-21 10:36:12 +00:00

52 lines
1.4 KiB
Diff

From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 17 Apr 2020 17:14:15 +0200
Subject: Allow overriding build settings from the environment
Git-commit: 5b3c8e9950262fc941bb5b3b3a1275720d47d62d
Patch-mainline: yes
Let packagers pass their own CC, CFLAGS and LDFLAGS settings. The
settings which are specific to dmidecode are appended later so that
they are applied no matter what.
This should fix bug #55805:
https://savannah.nongnu.org/bugs/?55805
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Makefile | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,13 @@
# (at your option) any later version.
#
-CC = gcc
-CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
+CC ?= gcc
+# Base CFLAGS can be overridden by environment
+CFLAGS ?= -O2
+# When debugging, disable -O2 and enable -g
+#CFLAGS ?= -g
+
+CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
# Let lseek and mmap support 64-bit wide offsets
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
#CFLAGS += -DBIGENDIAN
#CFLAGS += -DALIGNMENT_WORKAROUND
-# When debugging, disable -O2 and enable -g.
-CFLAGS += -O2
-#CFLAGS += -g
-
-# Pass linker flags here
-LDFLAGS =
+# Pass linker flags here (can be set from environment too)
+LDFLAGS ?=
DESTDIR =
prefix = /usr/local