All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Seiderer via buildroot <buildroot@buildroot.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v1] package/wiringpi: re-add and bump version to 3.4
Date: Mon, 13 May 2024 23:48:32 +0200	[thread overview]
Message-ID: <20240513214832.18094-1-ps.report@gmx.net> (raw)

- revert commit 90dd780391 ("package/wiringpi: remove")
- bump version to 3.4
- change download URL to github
- change home page URL to github
- rebased 0001-Adjust-for-buildroot-build.patch
- add optional libxcrypt dependency, fix build failure since bump of glibc
  to version 2.39
- needs kernel headers >= 5.5 for GPIOLINE_FLAG_BIAS_PULL_UP,
  GPIOLINE_FLAG_BIAS_PULL_DOWN and GPIOLINE_FLAG_BIAS_DISABLE usage

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 Config.in.legacy                              |   9 --
 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 package/squeezelite/squeezelite.mk            |   5 +
 .../0001-Adjust-for-buildroot-build.patch     | 126 ++++++++++++++++++
 ...erial-fix-compile-for-missing-baud-d.patch |  47 +++++++
 package/wiringpi/Config.in                    |  16 +++
 package/wiringpi/wiringpi.hash                |   3 +
 package/wiringpi/wiringpi.mk                  |  36 +++++
 9 files changed, 235 insertions(+), 9 deletions(-)
 create mode 100644 package/wiringpi/0001-Adjust-for-buildroot-build.patch
 create mode 100644 package/wiringpi/0002-wiringPi-wiringSerial-fix-compile-for-missing-baud-d.patch
 create mode 100644 package/wiringpi/Config.in
 create mode 100644 package/wiringpi/wiringpi.hash
 create mode 100644 package/wiringpi/wiringpi.mk

diff --git a/Config.in.legacy b/Config.in.legacy
index 46f7a304cb..8d4f488dbd 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -1938,15 +1938,6 @@ config BR2_PACKAGE_KODI_PERIPHERAL_STEAMCONTROLLER
 
 comment "Legacy options removed in 2020.05"
 
-config BR2_PACKAGE_WIRINGPI
-	bool "wiringpi package removed"
-	select BR2_LEGACY
-	help
-	  The author of wiringpi has deprecated the package, and
-	  completely removed the git tree that was serving the
-	  sources, with this message:
-	  Please look for alternatives for wiringPi
-
 config BR2_PACKAGE_PYTHON_PYCRYPTO
 	bool "python-pycrypto package removed"
 	select BR2_LEGACY
diff --git a/DEVELOPERS b/DEVELOPERS
index d653648718..9f7bade097 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2546,6 +2546,7 @@ F:	package/fft-eval/
 F:	package/python-blinker/
 F:	package/qt5/qt5speech/
 F:	package/speechd/
+F:	package/wiringpi/
 
 N:	Peter Thompson <peter.macleod.thompson@gmail.com>
 F:	package/sdl2_gfx/
diff --git a/package/Config.in b/package/Config.in
index c29b4a5101..ffb6c69562 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1805,6 +1805,7 @@ menu "Hardware handling"
 	source "package/tslib/Config.in"
 	source "package/uhd/Config.in"
 	source "package/urg/Config.in"
+	source "package/wiringpi/Config.in"
 endmenu
 
 menu "Javascript"
diff --git a/package/squeezelite/squeezelite.mk b/package/squeezelite/squeezelite.mk
index b0347c4df9..2ed3d8b769 100644
--- a/package/squeezelite/squeezelite.mk
+++ b/package/squeezelite/squeezelite.mk
@@ -40,6 +40,11 @@ ifeq ($(BR2_PACKAGE_SQUEEZELITE_VISEXPORT),y)
 SQUEEZELITE_MAKE_OPTS += -DVISEXPORT
 endif
 
+ifeq ($(BR2_PACKAGE_WIRINGPI),y)
+SQUEEZELITE_DEPENDENCIES += wiringpi
+SQUEEZELITE_MAKE_OPTS += -DRPI
+endif
+
 define SQUEEZELITE_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
 		OPTS="$(SQUEEZELITE_MAKE_OPTS)" -C $(@D) all
diff --git a/package/wiringpi/0001-Adjust-for-buildroot-build.patch b/package/wiringpi/0001-Adjust-for-buildroot-build.patch
new file mode 100644
index 0000000000..2720c502c1
--- /dev/null
+++ b/package/wiringpi/0001-Adjust-for-buildroot-build.patch
@@ -0,0 +1,126 @@
+From ebfa5527467ba175cca84afeae244c06e265a508 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Wed, 2 Dec 2015 00:22:26 +0100
+Subject: [PATCH] Adjust for buildroot build.
+
+ - enable CC override
+ - fix devLib/gpio include path for local build (without installing first)
+ - change CFLAGS from '=' to '+=' to honour buildroot given flags
+ - add linker name link for libwiringPiDev and libwiringPi for local linking
+   (without installing first)
+ - fix install linker name link (do not link with absolute path)
+ - add gpio-static linking target
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+
+ - Rebased for wiringpi-8d188fa0e00bb8c6ff6eddd07bf92857e9bd533a
+
+Signed-off-by: Atanas Palavrov <palavrov@gmail.com>
+
+ - Rebased for wiringpi-3.4
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ devLib/Makefile   |  7 ++++---
+ gpio/Makefile     | 12 ++++++++----
+ wiringPi/Makefile |  5 +++--
+ 3 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/devLib/Makefile b/devLib/Makefile
+index 611e423..d0c70d0 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] $<
+@@ -93,7 +94,7 @@ install:	$(DYNAMIC)
+ 	$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 ln -sf libwiringPiDev.so.$(VERSION)				$(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
+ 	$Q $(LDCONFIG)
+ 
+ .PHONY:	install-static
+diff --git a/gpio/Makefile b/gpio/Makefile
+index 249bb24..3aa24b7 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 88fc48e..082bfaf 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
+@@ -77,6 +77,7 @@ static:
+ $(DYNAMIC):	$(OBJ)
+ 	$Q echo "[Link (Dynamic)]"
+ 	$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(OBJ) $(LIBS)
++	$Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
+ 
+ .c.o:
+ 	$Q echo [Compile] $<
+@@ -102,7 +103,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.45.0
+
diff --git a/package/wiringpi/0002-wiringPi-wiringSerial-fix-compile-for-missing-baud-d.patch b/package/wiringpi/0002-wiringPi-wiringSerial-fix-compile-for-missing-baud-d.patch
new file mode 100644
index 0000000000..c9c4385d48
--- /dev/null
+++ b/package/wiringpi/0002-wiringPi-wiringSerial-fix-compile-for-missing-baud-d.patch
@@ -0,0 +1,47 @@
+From 1e7a7a625ca20633062406ce525b19d168c356af Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Mon, 20 Mar 2017 20:51:20 +0100
+Subject: [PATCH] wiringPi/wiringSerial: fix compile for missing baud defines
+
+For sparc-buildroot-linux-uclibc/sysroot/usr/include/asm/termbits.h
+containing:
+
+  /* These have totally bogus values and nobody uses them
+     so far. Later on we'd have to use say 0x10000x and
+     adjust CBAUD constant and drivers accordingly.
+  #define B2500000  0x00001010
+  #define B3000000  0x00001011
+  #define B3500000  0x00001012
+  #define B4000000  0x00001013  */
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ wiringPi/wiringSerial.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/wiringPi/wiringSerial.c b/wiringPi/wiringSerial.c
+index e1587ad..4ac8d1e 100644
+--- a/wiringPi/wiringSerial.c
++++ b/wiringPi/wiringSerial.c
+@@ -75,10 +75,18 @@ int serialOpen (const char *device, const int baud)
+     case 1152000:	myBaud = B1152000 ; break ;
+     case 1500000:	myBaud = B1500000 ; break ;
+     case 2000000:	myBaud = B2000000 ; break ;
++#if defined(B2500000)
+     case 2500000:	myBaud = B2500000 ; break ;
++#endif
++#if defined(B3000000)
+     case 3000000:	myBaud = B3000000 ; break ;
++#endif
++#if defined(B3500000)
+     case 3500000:	myBaud = B3500000 ; break ;
++#endif
++#if defined(B4000000)
+     case 4000000:	myBaud = B4000000 ; break ;
++#endif
+ 
+     default:
+       return -2 ;
+-- 
+2.11.0
+
diff --git a/package/wiringpi/Config.in b/package/wiringpi/Config.in
new file mode 100644
index 0000000000..11ef9825a1
--- /dev/null
+++ b/package/wiringpi/Config.in
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_WIRINGPI
+	bool "wiringpi"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_5
+	select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  wiringPi libraries (and gpio command)
+
+	  https://github.com/WiringPi/WiringPi
+
+comment "wiringpi needs a toolchain w/ threads, dynamic library, kernel headers >= 5.5"
+	depends on BR2_USE_MMU
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_5
diff --git a/package/wiringpi/wiringpi.hash b/package/wiringpi/wiringpi.hash
new file mode 100644
index 0000000000..590d03946c
--- /dev/null
+++ b/package/wiringpi/wiringpi.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  a81219e9ea0ce08295d2fc0457c69c4df0c6d2e846cb5817ba3247f673480d55  wiringpi-3.4.tar.gz
+sha256  da7eabb7bafdf7d3ae5e9f223aa5bdc1eece45ac569dc21b3b037520b4464768  COPYING.LESSER
diff --git a/package/wiringpi/wiringpi.mk b/package/wiringpi/wiringpi.mk
new file mode 100644
index 0000000000..3515634d6d
--- /dev/null
+++ b/package/wiringpi/wiringpi.mk
@@ -0,0 +1,36 @@
+################################################################################
+#
+# wiringpi
+#
+################################################################################
+
+WIRINGPI_VERSION = 3.4
+WIRINGPI_SITE = $(call github,WiringPi,WiringPi,$(WIRINGPI_VERSION))
+
+WIRINGPI_LICENSE = LGPL-3.0+
+WIRINGPI_LICENSE_FILES = COPYING.LESSER
+WIRINGPI_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
+WIRINGPI_DEPENDENCIES += libxcrypt
+endif
+
+define WIRINGPI_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/wiringPi all
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/devLib all
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/gpio all
+endef
+
+define WIRINGPI_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/wiringPi install DESTDIR=$(STAGING_DIR) PREFIX=/usr LDCONFIG=true
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/devLib install DESTDIR=$(STAGING_DIR) PREFIX=/usr LDCONFIG=true
+endef
+
+define WIRINGPI_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/wiringPi install DESTDIR=$(TARGET_DIR) PREFIX=/usr LDCONFIG=true
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/devLib install DESTDIR=$(TARGET_DIR) PREFIX=/usr LDCONFIG=true
+	$(INSTALL) -D -m 0755 $(@D)/gpio/gpio $(TARGET_DIR)/usr/bin/gpio
+	$(INSTALL) -D -m 0755 $(@D)/gpio/pintest $(TARGET_DIR)/usr/bin/pintest
+endef
+
+$(eval $(generic-package))
-- 
2.45.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

                 reply	other threads:[~2024-05-13 21:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240513214832.18094-1-ps.report@gmx.net \
    --to=buildroot@buildroot.org \
    --cc=buildroot@busybox.net \
    --cc=ps.report@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.