1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2024-12-28 01:30:59 +01:00
OpenVoiceOS/buildroot-external/package/wiringpi2/0001-Buildroot-support.patch
2021-04-15 22:14:18 +02:00

110 lines
3.7 KiB
Diff

From a2c15b71bfa8d3aea5cd07c0c1a93dbf69ea0324 Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Thu, 15 Apr 2021 22:10:54 +0200
Subject: [PATCH 1/1] Buildroot support
---
devLib/Makefile | 6 ++++--
gpio/Makefile | 12 ++++++++----
wiringPi/Makefile | 5 +++--
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/devLib/Makefile b/devLib/Makefile
index 55f8a64..24434ab 100644
--- a/devLib/Makefile
+++ b/devLib/Makefile
@@ -37,9 +37,9 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
#DEBUG = -g -O0
DEBUG = -O2
CC ?= gcc
-INCLUDE = -I.
+INCLUDE = -I../wiringPi
DEFS = -D_GNU_SOURCE
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
LIBS =
@@ -69,6 +69,7 @@ $(STATIC): $(OBJ)
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
+ $Q ln -sf libwiringPiDev.so.$(VERSION) libwiringPiDev.so
.c.o:
$Q echo [Compile] $<
@@ -94,6 +95,7 @@ install: $(DYNAMIC)
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
$Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
+ $Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
$Q $(LDCONFIG)
.PHONY: install-static
diff --git a/gpio/Makefile b/gpio/Makefile
index 6b8f838..dd976d0 100644
--- a/gpio/Makefile
+++ b/gpio/Makefile
@@ -33,10 +33,10 @@ endif
#DEBUG = -g -O0
DEBUG = -O2
CC ?= gcc
-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
-CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)
+INCLUDE = -I../wiringPi -I../devLib
+CFLAGS += $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe $(EXTRA_CFLAGS)
-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
+LDFLAGS = -L../wiringPi -L../devLib
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
# May not need to alter anything below this line
@@ -52,9 +52,13 @@ version.h: ../VERSION
$Q echo Need to run newVersion above.
gpio: $(OBJ)
- $Q echo [Link]
+ $Q echo "[Link (Dynamic)]"
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
+gpio-static: $(OBJ)
+ $Q echo "[Link (Static)]"
+ $Q $(CC) -static -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
+
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
diff --git a/wiringPi/Makefile b/wiringPi/Makefile
index 2405574..3b57cb8 100644
--- a/wiringPi/Makefile
+++ b/wiringPi/Makefile
@@ -39,7 +39,7 @@ DEBUG = -O2
CC ?= gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC $(EXTRA_CFLAGS)
#CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC
LIBS = -lm -lpthread -lrt -lcrypt
@@ -76,6 +76,7 @@ static:
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
+ $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
.c.o:
$Q echo [Compile] $<
@@ -101,7 +102,7 @@ install: $(DYNAMIC)
$Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
- $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
+ $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
$Q $(LDCONFIG)
.PHONY: check-deb-destdir
--
2.20.1