summaryrefslogtreecommitdiff
path: root/meta-raspberrypi/recipes-devtools/wiringPi
diff options
context:
space:
mode:
Diffstat (limited to 'meta-raspberrypi/recipes-devtools/wiringPi')
-rw-r--r--meta-raspberrypi/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch413
-rw-r--r--meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb33
2 files changed, 446 insertions, 0 deletions
diff --git a/meta-raspberrypi/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch b/meta-raspberrypi/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch
new file mode 100644
index 000000000..01e054634
--- /dev/null
+++ b/meta-raspberrypi/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch
@@ -0,0 +1,413 @@
+From ca25788e2563bad0d554deb9f4300d1e7d062825 Mon Sep 17 00:00:00 2001
+From: Aurelian Zanoschi <aurelian17@gmail.com>
+Date: Mon, 31 Jul 2017 20:25:15 +0300
+Subject: [PATCH] Add initial cross compile support
+
+---
+ devLib/Makefile | 54 +++++++++++++++++++++++++--------------------
+ examples/Gertboard/Makefile | 22 +++++++++++-------
+ examples/Makefile | 22 +++++++++++-------
+ examples/PiFace/Makefile | 22 +++++++++++-------
+ examples/PiGlow/Makefile | 4 ++--
+ examples/q2w/Makefile | 4 ++--
+ gpio/Makefile | 29 ++++++++++++------------
+ wiringPi/Makefile | 52 ++++++++++++++++++++++++-------------------
+ 8 files changed, 120 insertions(+), 89 deletions(-)
+
+diff --git a/devLib/Makefile b/devLib/Makefile
+index cf665d6..040c03a 100644
+--- a/devLib/Makefile
++++ b/devLib/Makefile
+@@ -31,15 +31,19 @@ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-STATIC=libwiringPiDev.a
+-DYNAMIC=libwiringPiDev.so.$(VERSION)
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
+
+-#DEBUG = -g -O0
+-DEBUG = -O2
+-CC = gcc
+-INCLUDE = -I.
+-DEFS = -D_GNU_SOURCE
+-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
++BASE_NAME=libwiringPiDev
++STATIC=$(BASE_NAME).a
++DYNAMIC=$(BASE_NAME).so.$(VERSION)
++
++#DEBUG ?= -g -O0
++DEBUG ?= -O2
++CC ?= gcc
++INCLUDE ?= -I.
++DEFS ?= -D_GNU_SOURCE
++CFLAGS ?= $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
+
+ LIBS =
+
+@@ -68,16 +72,16 @@ $(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 $(CC) -shared $(LDFLAGS) -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ)
+
+ .c.o:
+ $Q echo [Compile] $<
+- $Q $(CC) -c $(CFLAGS) $< -o $@
++ $Q $(CC) -c $(CFLAGS) -fPIC $< -o $@
+
+ .PHONY: clean
+ clean:
+ $Q echo "[Clean]"
+- $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*
++ $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a
+
+ .PHONY: tags
+ tags: $(SRC)
+@@ -88,22 +92,22 @@ tags: $(SRC)
+ .PHONY: install
+ install: $(DYNAMIC)
+ $Q echo "[Install Headers]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
+- $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
++ $Q install -m 0755 -d $(INCLUDE_DIR)
++ $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR)
+ $Q echo "[Install Dynamic Lib]"
+- $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 $(LDCONFIG)
++ $Q install -m 0755 -d $(LIB_DIR)
++ $Q install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC)
++ $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so
++ $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
+
+ .PHONY: install-static
+ install-static: $(STATIC)
+ $Q echo "[Install Headers]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
+- $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
++ $Q install -m 0755 -d $(INCLUDE_DIR)
++ $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR)
+ $Q echo "[Install Static Lib]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
+- $Q install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib
++ $Q install -m 0755 -d $(LIB_DIR)
++ $Q install -m 0755 $(STATIC) $(LIB_DIR)
+
+ .PHONY: install-deb
+ install-deb: $(DYNAMIC)
+@@ -118,9 +122,11 @@ install-deb: $(DYNAMIC)
+ .PHONY: uninstall
+ uninstall:
+ $Q echo "[UnInstall]"
+- $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
+- $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
+- $Q $(LDCONFIG)
++ $Q cd $(INCLUDE_DIR) && rm -f $(HEADERS)
++ $Q rm -f $(LIB_DIR)/$(STATIC)
++ $Q rm -f $(LIB_DIR)/$(DYNAMIC)
++ $Q rm -f $(LIB_DIR)/$(BASE_NAME).so
++ $Q rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
+
+
+ .PHONY: depend
+diff --git a/examples/Gertboard/Makefile b/examples/Gertboard/Makefile
+index 1939ad6..98d1415 100644
+--- a/examples/Gertboard/Makefile
++++ b/examples/Gertboard/Makefile
+@@ -9,14 +9,20 @@ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-#DEBUG = -g -O0
+-DEBUG = -O3
+-CC = gcc
+-INCLUDE = -I/usr/local/include
+-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+-
+-LDFLAGS = -L/usr/local/lib
+-LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
++DESTDIR?=/usr
++PREFIX?=/local
++
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
++
++#DEBUG ?= -g -O0
++DEBUG ?= -O3
++CC ?= gcc
++INCLUDE ?= -I$(INCLUDE_DIR)
++CFLAGS ?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
++
++LDFLAGS ?= -L$(LIB_DIR)
++LDLIBS ?= -lwiringPi -lwiringPiDev -lpthread -lm
+
+ # Should not alter anything below this line
+ ###############################################################################
+diff --git a/examples/Makefile b/examples/Makefile
+index 6d87885..8623816 100644
+--- a/examples/Makefile
++++ b/examples/Makefile
+@@ -26,14 +26,20 @@ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-#DEBUG = -g -O0
+-DEBUG = -O3
+-CC = gcc
+-INCLUDE = -I/usr/local/include
+-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+-
+-LDFLAGS = -L/usr/local/lib
+-LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
++DESTDIR?=/usr
++PREFIX?=/local
++
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
++
++#DEBUG ?= -g -O0
++DEBUG ?= -O3
++CC ?= gcc
++INCLUDE ?= -I$(INCLUDE_DIR)
++CFLAGS ?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
++
++LDFLAGS ?= -L$(LIB_DIR)
++LDLIBS ?= -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
+
+ # Should not alter anything below this line
+ ###############################################################################
+diff --git a/examples/PiFace/Makefile b/examples/PiFace/Makefile
+index f937c14..ad030b3 100644
+--- a/examples/PiFace/Makefile
++++ b/examples/PiFace/Makefile
+@@ -26,14 +26,20 @@ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-#DEBUG = -g -O0
+-DEBUG = -O3
+-CC = gcc
+-INCLUDE = -I/usr/local/include
+-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+-
+-LDFLAGS = -L/usr/local/lib
+-LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
++DESTDIR?=/usr
++PREFIX?=/local
++
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
++
++#DEBUG ?= -g -O0
++DEBUG ?= -O3
++CC ?= gcc
++INCLUDE ?= -I$(INCLUDE_DIR)
++CFLAGS ?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
++
++LDFLAGS ?= -L$(LIB_DIR)
++LDLIBS ?= -lwiringPi -lwiringPiDev -lpthread -lm
+
+ # Should not alter anything below this line
+ ###############################################################################
+diff --git a/examples/PiGlow/Makefile b/examples/PiGlow/Makefile
+index f182db7..d1ea74f 100644
+--- a/examples/PiGlow/Makefile
++++ b/examples/PiGlow/Makefile
+@@ -29,10 +29,10 @@ endif
+ #DEBUG = -g -O0
+ DEBUG = -O3
+ CC = gcc
+-INCLUDE = -I/usr/local/include
++INCLUDE = -I../wiringPi -I../wiringPiDev
+ CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+
+-LDFLAGS = -L/usr/local/lib
++LDFLAGS = -L../wiringPi -L../wiringPiDev
+ LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
+
+ # Should not alter anything below this line
+diff --git a/examples/q2w/Makefile b/examples/q2w/Makefile
+index 8f773bf..14aa6e4 100644
+--- a/examples/q2w/Makefile
++++ b/examples/q2w/Makefile
+@@ -29,10 +29,10 @@ endif
+ #DEBUG = -g -O0
+ DEBUG = -O3
+ CC = gcc
+-INCLUDE = -I/usr/local/include
++INCLUDE = -I../wiringPi -I../devLib
+ CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+
+-LDFLAGS = -L/usr/local/lib
++LDFLAGS = -L../wiringPi -L../devLib
+ LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
+
+ ###############################################################################
+diff --git a/gpio/Makefile b/gpio/Makefile
+index f41a005..22753ee 100644
+--- a/gpio/Makefile
++++ b/gpio/Makefile
+@@ -30,13 +30,17 @@ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-#DEBUG = -g -O0
+-DEBUG = -O2
+-CC = gcc
+-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
+-CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
++BIN_DIR?=$(DESTDIR)$(PREFIX)/bin
+
+-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
++#DEBUG ?= -g -O0
++DEBUG ?= -O2
++CC ?= gcc
++INCLUDE ?= -I$(INCLUDE_DIR)
++CFLAGS ?= $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
++
++LDFLAGS ?= -L$(LIB_DIR)
+ LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
+
+ # May not need to alter anything below this line
+@@ -72,13 +76,10 @@ tags: $(SRC)
+ .PHONY: install
+ install: gpio
+ $Q echo "[Install]"
+- $Q cp gpio $(DESTDIR)$(PREFIX)/bin
+-ifneq ($(WIRINGPI_SUID),0)
+- $Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
+- $Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio
+-endif
+- $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man1
+- $Q cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1
++ $Q install -d $(BIN_DIR)
++ $Q install -m 4755 -o root -g root gpio $(BIN_DIR)
++ $Q install -d $(DESTDIR)$(PREFIX)/share/man/man1
++ $Q install -m 644 -o root -g root gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1
+
+ .PHONY: install-deb
+ install-deb: gpio
+@@ -91,7 +92,7 @@ install-deb: gpio
+ .PHONY: uninstall
+ uninstall:
+ $Q echo "[UnInstall]"
+- $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
++ $Q rm -f $(BIN_DIR)/gpio
+ $Q rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
+
+ .PHONY: depend
+diff --git a/wiringPi/Makefile b/wiringPi/Makefile
+index e1868b9..750d290 100644
+--- a/wiringPi/Makefile
++++ b/wiringPi/Makefile
+@@ -25,21 +25,25 @@ VERSION=$(shell cat ../VERSION)
+ DESTDIR?=/usr
+ PREFIX?=/local
+
++INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include
++LIB_DIR?=$(DESTDIR)$(PREFIX)/lib
++
+ LDCONFIG?=ldconfig
+
+ ifneq ($V,1)
+ Q ?= @
+ endif
+
+-STATIC=libwiringPi.a
+-DYNAMIC=libwiringPi.so.$(VERSION)
++BASE_NAME=libwiringPi
++STATIC=$(BASE_NAME).a
++DYNAMIC=$(BASE_NAME).so.$(VERSION)
+
+-#DEBUG = -g -O0
+-DEBUG = -O2
+-CC = gcc
+-INCLUDE = -I.
++#DEBUG ?= -g -O0
++DEBUG ?= -O2
++CC ?= gcc
++INCLUDE ?= -I.
+ DEFS = -D_GNU_SOURCE
+-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
++CFLAGS = $(DEBUG) $(DEFS) $(INCLUDE) -Wformat=2 -Wall -Wextra -Winline -pipe -fPIC
+
+ LIBS = -lm -lpthread -lrt -lcrypt
+
+@@ -78,17 +82,17 @@ $(STATIC): $(OBJ)
+
+ $(DYNAMIC): $(OBJ)
+ $Q echo "[Link (Dynamic)]"
+- $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
++ $Q $(CC) $(LDFLAGS) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so $(OBJ) $(LIBS)
+
+ .c.o:
+ $Q echo [Compile] $<
+- $Q $(CC) -c $(CFLAGS) $< -o $@
++ $Q $(CC) $(CFLAGS) $(LIBS) -c $< -o $@
+
+
+ .PHONY: clean
+ clean:
+ $Q echo "[Clean]"
+- $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.*
++ $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a
+
+ .PHONY: tags
+ tags: $(SRC)
+@@ -99,22 +103,22 @@ tags: $(SRC)
+ .PHONY: install
+ install: $(DYNAMIC)
+ $Q echo "[Install Headers]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
+- $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
++ $Q install -m 0755 -d $(INCLUDE_DIR)
++ $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR)
+ $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 $(LDCONFIG)
++ $Q install -m 0755 -d $(LIB_DIR)
++ $Q install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC)
++ $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so
++ $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
+
+ .PHONY: install-static
+ install-static: $(STATIC)
+ $Q echo "[Install Headers]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
+- $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
++ $Q install -m 0755 -d $(INCLUDE_DIR)
++ $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR)
+ $Q echo "[Install Static Lib]"
+- $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
+- $Q install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
++ $Q install -m 0755 -d $(LIB_DIR)
++ $Q install -m 0755 $(STATIC) $(LIB_DIR)
+
+ .PHONY: install-deb
+ install-deb: $(DYNAMIC)
+@@ -129,9 +133,11 @@ install-deb: $(DYNAMIC)
+ .PHONY: uninstall
+ uninstall:
+ $Q echo "[UnInstall]"
+- $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
+- $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
+- $Q $(LDCONFIG)
++ $Q cd $(INCLUDE_DIR) && rm -f $(HEADERS)
++ $Q rm -f $(LIB_DIR)/$(STATIC)
++ $Q rm -f $(LIB_DIR)/$(DYNAMIC)
++ $Q rm -f $(LIB_DIR)/$(BASE_NAME).so
++ $Q rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
+
+
+ .PHONY: depend
+--
+2.7.4
+
diff --git a/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb b/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
new file mode 100644
index 000000000..f1b01dbe5
--- /dev/null
+++ b/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "A library to control Raspberry Pi GPIO channels"
+HOMEPAGE = "https://projects.drogon.net/raspberry-pi/wiringpi/"
+SECTION = "devel/libs"
+LICENSE = "LGPLv3+"
+LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=e6a600fd5e1d9cbde2d983680233ad02"
+
+# tag 2.44
+SRCREV = "96344ff7125182989f98d3be8d111952a8f74e15"
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://git.drogon.net/wiringPi \
+ file://0001-Add-initial-cross-compile-support.patch \
+ "
+
+COMPATIBLE_MACHINE = "^rpi$"
+
+CFLAGS_prepend = "-I${S}/wiringPi -I${S}/devLib "
+
+EXTRA_OEMAKE += "'INCLUDE_DIR=${D}${includedir}' 'LIB_DIR=${D}${libdir}'"
+EXTRA_OEMAKE += "'DESTDIR=${D}/usr' 'PREFIX=""'"
+
+do_compile() {
+ oe_runmake -C devLib
+ oe_runmake -C wiringPi
+ oe_runmake -C gpio 'LDFLAGS=${LDFLAGS} -L${S}/wiringPi -L${S}/devLib'
+}
+
+do_install() {
+ oe_runmake -C devLib install
+ oe_runmake -C wiringPi install
+ oe_runmake -C gpio install
+}