File 0018-lzo-Build-with-host-gcc.patch of Package syslinux

From 31c73bd13f6962fa4db9041e4a7b992ceae9a6f3 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Sun, 22 Oct 2023 17:34:24 +0200
Subject: [PATCH 18/22] lzo: Build with host gcc

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 lzo/Makefile     |  4 ++--
 mk/build-host.mk | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 mk/build-host.mk

diff --git a/lzo/Makefile b/lzo/Makefile
index 4e22b4cd..68eaef4b 100644
--- a/lzo/Makefile
+++ b/lzo/Makefile
@@ -11,7 +11,7 @@
 ## -----------------------------------------------------------------------
 
 VPATH = $(SRC)
-include $(MAKEDIR)/build.mk
+include $(MAKEDIR)/build-host.mk
 
 INCLUDES += -I$(SRC)/include
 
@@ -32,7 +32,7 @@ $(LIB) : $(LIBOBJS)
 	$(RANLIB) $@
 
 prepcore : prepcore.o $(LIB)
-	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+	$(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 tidy dist clean spotless:
 	rm -f $(BINS)
diff --git a/mk/build-host.mk b/mk/build-host.mk
new file mode 100644
index 00000000..dab5de60
--- /dev/null
+++ b/mk/build-host.mk
@@ -0,0 +1,35 @@
+## -*- makefile -*- ------------------------------------------------------
+##
+##   Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
+##
+##   This program is free software; you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+##   Boston MA 02111-1307, USA; either version 2 of the License, or
+##   (at your option) any later version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+##
+## Right now we don't distinguish between "build" system and the "host"
+## system, although we really should...
+##
+include $(MAKEDIR)/syslinux.mk
+
+CC_FOR_BUILD ?= $(CC)
+
+OPTFLAGS   = -g -Os
+INCLUDES   =
+CFLAGS     = $(WARNFLAGS) -D_FILE_OFFSET_BITS=64 \
+             $(OPTFLAGS) $(INCLUDES)
+LDFLAGS    =
+LIBS	   =
+
+.SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
+
+%.o: %.c
+	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+%.i: %.c
+	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
+%.s: %.c
+	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
-- 
2.42.0

openSUSE Build Service is sponsored by