forked from flathub/net.pcsx2.PCSX2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix-build-flags.patch
82 lines (68 loc) · 2.63 KB
/
fix-build-flags.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: Honour user build flags
CPPFLAGS, CFLAGS and LDFLAGS are user flags, which we need to preserve, any
required flag that the build system needs, has to be set in some other flag
so that the build will succeed even of the user flags are passed.
Author: Guillem Jover <[email protected]>
Origin: vendor
Forwarded: no
Last-Update: 2014-10-09
---
harness/Makefile | 7 +++++--
src/Makefile | 18 +++++++++---------
2 files changed, 14 insertions(+), 11 deletions(-)
--- a/harness/Makefile
+++ b/harness/Makefile
@@ -6,8 +6,11 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
HARNESS_SRCS:=main.c
# io_queue.c
-CFLAGS+=-Wall -Werror -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE)
+MK_CPPFLAGS := -I../src $(CPPFLAGS)
+CFLAGS = -Wall -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE) -fno-stack-protector
#-lpthread -lrt
+MK_CFLAGS = $(CFLAGS)
+MK_LDFLAGS = main.c $(LIBAIO) -lpthread $(LDFLAGS)
# Change this on the build line to run tests against the installed libraries:
# make LIBAIO=-laio partcheck
@@ -16,7 +19,7 @@ LIBAIO?=../src/libaio.a
all: $(PROGS)
$(PROGS): %.p: %.t $(HARNESS_SRCS)
- $(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c ../src/libaio.a -lpthread
+ $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS)
clean:
rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,12 +4,12 @@ includedir=$(prefix)/include
libdir=$(prefix)/lib32
libdevdir=$(libdir)
-CFLAGS ?= -g -fomit-frame-pointer -O2
-CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
-SO_CFLAGS=-shared $(CFLAGS)
-L_CFLAGS=$(CFLAGS)
-LINK_FLAGS=-Wl,--as-needed -lgcc -lc
-LINK_FLAGS+=$(LDFLAGS)
+MK_CPPFLAGS = -I.
+MK_CFLAGS = -fPIC $(CFLAGS)
+CFLAGS = -nostdlib -nostartfiles -Wall -g -fomit-frame-pointer -O2 -fno-stack-protector
+SO_CFLAGS = -shared $(MK_CFLAGS)
+L_CFLAGS = $(MK_CFLAGS)
+MK_LDFLAGS = $(LDFLAGS)
ENABLE_SHARED ?= 1
soname=libaio.so.1
@@ -44,10 +44,10 @@ libaio_sobjs := $(patsubst %.c,%.os,$(li
$(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h
%.os: %.c
- $(CC) $(SO_CFLAGS) -c -o $@ $<
+ $(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
%.ol: %.c
- $(CC) $(L_CFLAGS) -c -o $@ $<
+ $(CC) $(MK_CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
AR ?= ar
RANLIB ?= ranlib
@@ -57,7 +57,7 @@ libaio.a: $(libaio_objs)
$(RANLIB) libaio.a
$(libname): $(libaio_sobjs) libaio.map
- $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
+ $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(MK_LDFLAGS)
install: $(all_targets)
install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h