toolchain: bump Codescape IMG MIPS version to 2016.05-06
[buildroot-gz.git] / package / wiringpi / 0001-Adjust-for-buildroot-build.patch
blob4add46e216e29e626f69f6d386dcc00e5e46bf1b
1 From a16012bf4ea63f714468d80ebe101481c917e4b8 Mon Sep 17 00:00:00 2001
2 From: Peter Seiderer <ps.report@gmx.net>
3 Date: Wed, 2 Dec 2015 00:22:26 +0100
4 Subject: [PATCH] Adjust for buildroot build.
6 - enable CC override
7 - fix devLib/gpio include path for local build (without installing first)
8 - change CFLAGS from '=' to '+=' to honour buildroot given flags
9 - add linker name link for libwiringPiDev and libwiringPi for local linking
10 (without installing first)
11 - fix install linker name link (do not link with absolute path)
12 - add gpio-static linking target
14 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
15 ---
16 devLib/Makefile | 9 +++++----
17 gpio/Makefile | 12 ++++++++----
18 wiringPi/Makefile | 7 ++++---
19 3 files changed, 17 insertions(+), 11 deletions(-)
21 diff --git a/devLib/Makefile b/devLib/Makefile
22 index 0fb0033..3117479 100644
23 --- a/devLib/Makefile
24 +++ b/devLib/Makefile
25 @@ -36,10 +36,10 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
27 #DEBUG = -g -O0
28 DEBUG = -O2
29 -CC = gcc
30 -INCLUDE = -I.
31 +CC ?= gcc
32 +INCLUDE = -I../wiringPi
33 DEFS = -D_GNU_SOURCE
34 -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
35 +CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
37 LIBS =
39 @@ -67,6 +67,7 @@ $(STATIC): $(OBJ)
40 $(DYNAMIC): $(OBJ)
41 $Q echo "[Link (Dynamic)]"
42 $Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
43 + $Q ln -sf libwiringPiDev.so.$(VERSION) libwiringPiDev.so
45 .c.o:
46 $Q echo [Compile] $<
47 @@ -91,7 +92,7 @@ install: $(DYNAMIC)
48 $Q echo "[Install Dynamic Lib]"
49 $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
50 $Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
51 - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
52 + $Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
53 $Q $(LDCONFIG)
55 .PHONY: install-static
56 diff --git a/gpio/Makefile b/gpio/Makefile
57 index 7dcd090..e8e43f9 100644
58 --- a/gpio/Makefile
59 +++ b/gpio/Makefile
60 @@ -32,11 +32,11 @@ endif
62 #DEBUG = -g -O0
63 DEBUG = -O2
64 -CC = gcc
65 -INCLUDE = -I$(DESTDIR)$(PREFIX)/include
66 -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
67 +CC ?= gcc
68 +INCLUDE = -I../wiringPi -I../devLib
69 +CFLAGS += $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
71 -LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
72 +LDFLAGS = -L../wiringPi -L../devLib
73 LIBS = -lwiringPi -lwiringPiDev -lpthread
75 # May not need to alter anything below this line
76 @@ -55,6 +55,10 @@ gpio: $(OBJ)
77 $Q echo [Link]
78 $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
80 +gpio-static: $(OBJ)
81 + $Q echo [Link]
82 + $Q $(CC) -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
84 .c.o:
85 $Q echo [Compile] $<
86 $Q $(CC) -c $(CFLAGS) $< -o $@
87 diff --git a/wiringPi/Makefile b/wiringPi/Makefile
88 index 6bbcc5d..e0ccc52 100644
89 --- a/wiringPi/Makefile
90 +++ b/wiringPi/Makefile
91 @@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)
93 #DEBUG = -g -O0
94 DEBUG = -O2
95 -CC = gcc
96 +CC ?= gcc
97 INCLUDE = -I.
98 DEFS = -D_GNU_SOURCE
99 -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
100 +CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
102 LIBS =
104 @@ -90,6 +90,7 @@ $(STATIC): $(OBJ)
105 $(DYNAMIC): $(OBJ)
106 $Q echo "[Link (Dynamic)]"
107 $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
108 + $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
110 .c.o:
111 $Q echo [Compile] $<
112 @@ -115,7 +116,7 @@ install: $(DYNAMIC)
113 $Q echo "[Install Dynamic Lib]"
114 $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
115 $Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
116 - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
117 + $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
118 $Q $(LDCONFIG)
120 .PHONY: install-static
122 2.1.4