Skip to contentSkip to conversation

wiringpi: new package

PATCH New Lucas De Marchi 3 participants 11 messages Jan 10, 2014 – Apr 1, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 wiringpi: new package

wiringpi has a really poor build system wrt cross-compiling and has no official release. These are the patches needed to cross-compile it in its latest revision.

This patch set was made hoping it would be merged by upstream. Therefore it's conservative on the changes. However the feedback was that "cross-compiling is wrong and you should fork it if you want to do so".

I don't really want to fork it, but I think it's doable to maintain a patch set like this in buildroot.

---
 package/Config.in                                  |   1 +
 package/wiringpi/0001-Do-not-call-ldconfig.patch   |  84 +++++++++
 package/wiringpi/0002-Fix-typo-in-makefiles.patch  | 187 +++++++++++++++++++++
 ...verride-build-variables-from-command-line.patch |  94 +++++++++++
 package/wiringpi/0004-Add-gitignore-file.patch     |  23 +++
 ...er-includes-from-source-instead-of-system.patch |  41 +++++
 .../0006-Use-relative-links-on-install-rules.patch |  41 +++++
 .../0007-Link-gpio-binary-to-local-libraries.patch |  59 +++++++
 .../0008-Do-not-try-to-change-gpio-ownership.patch |  27 +++
 package/wiringpi/0008-tmp.patch                    |  25 +++
 package/wiringpi/Config.in                         |  17 ++
 package/wiringpi/wiringpi.mk                       |  28 +++
 12 files changed, 627 insertions(+)
 create mode 100644 package/wiringpi/0001-Do-not-call-ldconfig.patch
 create mode 100644 package/wiringpi/0002-Fix-typo-in-makefiles.patch
 create mode 100644 package/wiringpi/0003-Do-not-override-build-variables-from-command-line.patch
 create mode 100644 package/wiringpi/0004-Add-gitignore-file.patch
 create mode 100644 package/wiringpi/0005-Prefer-includes-from-source-instead-of-system.patch
 create mode 100644 package/wiringpi/0006-Use-relative-links-on-install-rules.patch
 create mode 100644 package/wiringpi/0007-Link-gpio-binary-to-local-libraries.patch
 create mode 100644 package/wiringpi/0008-Do-not-try-to-change-gpio-ownership.patch
 create mode 100644 package/wiringpi/0008-tmp.patch
 create mode 100644 package/wiringpi/Config.in
 create mode 100644 package/wiringpi/wiringpi.mk
package/Config.in +1 -0
index 38db5de..748ddbf 100644
@@ -581,6 +581,7 @@ source "package/neardal/Config.in"
 source "package/pcsc-lite/Config.in"
 source "package/tslib/Config.in"
 source "package/urg/Config.in"
+source "package/wiringpi/Config.in"
 endmenu
 
 menu "Javascript"
package/wiringpi/0001-Do-not-call-ldconfig.patch new file +84 -0

84 lines not on this page · raw message

package/wiringpi/0002-Fix-typo-in-makefiles.patch new file +187 -0

187 lines not on this page · raw message

package/wiringpi/0003-Do-not-override-build-variables-from-command-line.patch new file +94 -0

94 lines not on this page · raw message

package/wiringpi/0004-Add-gitignore-file.patch new file +23 -0
new file mode 100644
index 0000000..081d5be
@@ -0,0 +1,23 @@
+From 5f677acf115e1aa36d32a93164aa669d73c40fbf Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Sat, 28 Dec 2013 18:26:20 -0200
+Subject: [PATCH 4/8] Add gitignore file
+
+---
+ .gitignore | 4 ++++
+ 1 file changed, 4 insertions(+)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..d20b9b6
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,4 @@
++*.o
++*.so
++*.so.*
++/gpio/gpio
+-- 
+1.8.5.2
+
package/wiringpi/0005-Prefer-includes-from-source-instead-of-system.patch new file +41 -0

41 lines not on this page · raw message

package/wiringpi/0006-Use-relative-links-on-install-rules.patch new file +41 -0

41 lines not on this page · raw message

package/wiringpi/0007-Link-gpio-binary-to-local-libraries.patch new file +59 -0

59 lines not on this page · raw message

package/wiringpi/0008-Do-not-try-to-change-gpio-ownership.patch new file +27 -0
new file mode 100644
index 0000000..46ca9c3
@@ -0,0 +1,27 @@
+From 16baf307dfd1b5c5b4cd58bd52a717125e595c90 Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Mon, 30 Dec 2013 18:27:24 -0200
+Subject: [PATCH 8/8] Do not try to change gpio ownership
+
+---
+ gpio/Makefile | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/gpio/Makefile b/gpio/Makefile
+index 8e80762..c21f2b7 100644
+--- a/gpio/Makefile
++++ b/gpio/Makefile
+@@ -64,9 +64,7 @@ tags:	$(SRC)
+ .PHONY:	install
+ install:
+ 	@echo "[Install]"
+-	@cp gpio		$(DESTDIR)$(PREFIX)/bin
+-	@chown root.root	$(DESTDIR)$(PREFIX)/bin/gpio
+-	@chmod 4755		$(DESTDIR)$(PREFIX)/bin/gpio
++	@install gpio -m 0755 	$(DESTDIR)$(PREFIX)/bin/gpio
+ 	@mkdir -p		$(DESTDIR)$(PREFIX)/man/man1
+ 	@cp gpio.1		$(DESTDIR)$(PREFIX)/man/man1
+ 
+-- 
+1.8.5.2
+
package/wiringpi/0008-tmp.patch new file +25 -0
new file mode 100644
index 0000000..10d4396
@@ -0,0 +1,25 @@
+From fb72d08215b9f9af0d58951794f314f1ff6de04d Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Mon, 30 Dec 2013 17:08:37 -0200
+Subject: [PATCH 8/8] tmp
+
+---
+ gpio/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gpio/Makefile b/gpio/Makefile
+index 387f28c..55704fa 100644
+--- a/gpio/Makefile
++++ b/gpio/Makefile
+@@ -45,7 +45,7 @@ all:		gpio
+ 
+ gpio:	$(OBJ)
+ 	@echo [Link]
+-	@$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
++	$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
+ 	
+ .c.o:
+ 	@echo [Compile] $<
+-- 
+1.8.5.2
+
package/wiringpi/Config.in new file +17 -0
new file mode 100644
index 0000000..1e7433a
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_WIRINGPI
+	bool "wiringpi"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_PACKAGE_RPI_USERLAND
+	help
+	  WiringPi is a GPIO access library written in C for the BCM2835
+	  used in the Raspberry Pi.
+
+	  WiringPi includes a command-line utility gpio which can be
+	  used to program and setup the GPIO pins. You can use this to
+	  read and write the pins and even use it to control them from
+	  shell scripts.
+
+	  http://wiringpi.com/
+
+comment "wiringpi needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/wiringpi/wiringpi.mk new file +28 -0
new file mode 100644
index 0000000..8e448ea
@@ -0,0 +1,28 @@
+################################################################################
+#
+# wiringpi
+#
+################################################################################
+
+WIRINGPI_VERSION = f18c8f7204d6354220fd6754578b3daa43734e1b
+WIRINGPI_SITE = git://git.drogon.net/wiringPi
+
+WIRINGPI_LICENSE = LGPLv3
+WIRINGPI_LICENSE_FILES = COPYING.LESSER
+
+PREFIX = /usr
+
+define WIRINGPI_BUILD_CMDS
+	env
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/wiringPi
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/devLib
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio
+endef
+
+define WIRINGPI_INSTALL_TARGET_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/wiringPi install
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/devLib install
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 2/3 psplash: use git repository

psplash doesn't see a new release for quite some time. The lattest commits brought some nice bug fixes and a feature that allows to easily customize the splash image.

---
 package/psplash/psplash.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/psplash/psplash.mk +3 -2
index cb1c54a..fe14f44 100644
@@ -4,9 +4,10 @@
 #
 ################################################################################
 
-PSPLASH_VERSION = 0.1
-PSPLASH_SITE = http://downloads.yoctoproject.org/releases/psplash
+PSPLASH_VERSION = afd4e228c606a9998feae44a3fed4474803240b7
+PSPLASH_SITE = git://git.yoctoproject.org/psplash
 PSPLASH_LICENSE = GPLv2+
 PSPLASH_LICENSE_FILES = COPYING
+PSPLASH_AUTORECONF = YES
 
 $(eval $(autotools-package))
Signature · 1 line
1.8.5.2
#2 lore raw

PATCH 2/3 psplash: use git repository

Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Lucas" == Lucas De Marchi <[email protected]> writes:

psplash doesn't see a new release for quite some time. The lattest commits brought some nice bug fixes and a feature that allows to easily customize the splash image.

---
 package/psplash/psplash.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/psplash/psplash.mk +0 -0
index cb1c54a..fe14f44 100644

package/psplash/psplash.mk line 10

Quoted 9 lines
package/psplash/psplash.mk +2 -2
@@ -4,9 +4,10 @@
 #
 ################################################################################
 
-PSPLASH_VERSION = 0.1
-PSPLASH_SITE = http://downloads.yoctoproject.org/releases/psplash
+PSPLASH_VERSION = afd4e228c606a9998feae44a3fed4474803240b7
+PSPLASH_SITE = git://git.yoctoproject.org/psplash
 PSPLASH_LICENSE = GPLv2+
 PSPLASH_LICENSE_FILES = COPYING

That git revision no longer has a COPYING file, so I've dropped this line and committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 3/3 pi4j: new package

In reply to Lucas De Marchi

Add pi4j using its released binaries. The java archives are a bit different than other packages. Since they are coming already pre-compiled put them in /opt with the same layout as in raspbian, according to http://pi4j.com/install.html

---
 package/Config.in      |  1 +
 package/pi4j/Config.in | 10 ++++++++++
 package/pi4j/pi4j.mk   | 30 ++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 package/pi4j/Config.in
 create mode 100644 package/pi4j/pi4j.mk
package/Config.in +1 -0
index 748ddbf..ea4556f 100644
@@ -579,6 +579,7 @@ source "package/mtdev/Config.in"
 source "package/ne10/Config.in"
 source "package/neardal/Config.in"
 source "package/pcsc-lite/Config.in"
+source "package/pi4j/Config.in"
 source "package/tslib/Config.in"
 source "package/urg/Config.in"
 source "package/wiringpi/Config.in"
package/pi4j/Config.in new file +10 -0
new file mode 100644
index 0000000..99736bf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PI4J
+	bool "pi4j"
+	depends on BR2_PACKAGE_RPI_USERLAND
+	help
+	  This package is intended to provide a bridge between the native
+	  libraries and Java for full access to the Raspberry Pi.
+
+	  It installs the pre-compiled library from the released pi4j tarball.
+
+	  http://pi4j.com/
package/pi4j/pi4j.mk new file +30 -0
new file mode 100644
index 0000000..38f2926
@@ -0,0 +1,30 @@
+################################################################################
+#
+# pi4j
+#
+################################################################################
+
+PI4J_VERSION = 0.0.5
+PI4J_SITE = http://pi4j.googlecode.com/files/
+PI4J_SOURCE = pi4j-$(PI4J_VERSION).zip
+PI4J_LICENSE = Apache-v2
+PI4J_LICENSE_FILES = LICENSE.txt
+
+define PI4J_EXTRACT_CMDS
+	unzip -q -d $(@D)/../ $(DL_DIR)/$(PI4J_SOURCE)
+endef
+
+define PI4J_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-core.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-core.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-device.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-device.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-example.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-example.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-gpio-extension.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-extension.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-service.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-service.jar
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.5.2
#4 lore raw

PATCH 3/3 pi4j: new package

Dear Lucas De Marchi,

Quoted 4 lines · Lucas De Marchi

Add pi4j using its released binaries. The java archives are a bit different than other packages. Since they are coming already pre-compiled put them in /opt with the same layout as in raspbian, according to http://pi4j.com/install.html

I think this is quite certainly the first Java library for which we have a package. Which JVM are you using to run this on the target? The official Oracle JDK?

I think this package, like Python/Lua/Perl packages, should depend on the selection of a JVM, be it the official Oracle JDK (for which a package would have to be created), or JamVM, if this package is actually compatible with it.

Regarding the installation in /opt, I'm not sure. The fact that Raspbian installs it here is not that much of an argument to me (quite the opposite, actually!).

On Ubuntu, the Java libraries are apparently installed in /usr/share/java/, which seems a bit more sensible to me. The JNI parts are installed in /usr/lib/jni/. See:

$ dpkg -L librxtx-java
[... skip documentation ...]
/usr/share/java
/usr/share/java/RXTXcomm-2.2pre2.jar
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/librxtx-java
/usr/lib
/usr/lib/jni
/usr/lib/jni/librxtxRaw-2.2pre1.so
/usr/lib/jni/librxtxI2C-2.2pre1.so
/usr/lib/jni/librxtxRS485-2.2pre1.so
/usr/lib/jni/librxtxSerial-2.2pre1.so
/usr/lib/jni/librxtxParallel-2.2pre1.so
/usr/share/java/RXTXcomm.jar
/usr/lib/jni/librxtxSerial.so
/usr/lib/jni/librxtxRS485.so
/usr/lib/jni/librxtxI2C.so
/usr/lib/jni/librxtxParallel.so
/usr/lib/jni/librxtxRaw.so

package/pi4j/Config.in line 3

Quoted 9 lines
package/pi4j/Config.in new file +3 -0
new file mode 100644
index 0000000..99736bf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PI4J
+	bool "pi4j"
+	depends on BR2_PACKAGE_RPI_USERLAND

Why this dependency?

As stated above, we should ensure that a JVM is selected here.

package/pi4j/Config.in

Quoted 12 lines
package/pi4j/Config.in new file +12 -0
+define PI4J_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-core.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-core.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-device.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-device.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-example.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-example.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-gpio-extension.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-extension.jar
+	$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-service.jar \
+		$(TARGET_DIR)/opt/pi4j/lib/pi4j-service.jar
+endef

This can probably be improved a little bit:

PI4J_LIBS = core device example extension service

define PI4J_INSTALL_TARGET_CMDS

	$(foreach lib,$(PI4J_LIBS),\
		$(INSTALL) -D -m 0644 $(@D)/lib/pi4j-$(lib).jar $(TARGET_DIR)/opt/pi4j/lib/pi4j-$(lib).jar)

endef

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 3/3 pi4j: new package

Quoted 4 lines · Thomas Petazzoni

Dear Lucas De Marchi,

On Fri, 10 Jan 2014 17:50:22 -0200, Lucas De Marchi wrote:

Quoted 8 lines
Quoted 4 lines

Add pi4j using its released binaries. The java archives are a bit different than other packages. Since they are coming already pre-compiled put them in /opt with the same layout as in raspbian, according to http://pi4j.com/install.html

I think this is quite certainly the first Java library for which we have a package. Which JVM are you using to run this on the target? The official Oracle JDK?

I'm using the official Oracle JDK. However I think we are not allowed to distribute it or make "recipes" to distribute it as part of buildroot, are we? Its license looks really restrictive. My current approach for the rootfs I'm building for a friend of mine is to install the Oracle jdk by using a overlay directory in buildroot. Do you think it would be possible to add the oracle jdk to buildroot?

Quoted 9 lines

I think this package, like Python/Lua/Perl packages, should depend on the selection of a JVM, be it the official Oracle JDK (for which a package would have to be created), or JamVM, if this package is actually compatible with it.

Regarding the installation in /opt, I'm not sure. The fact that Raspbian installs it here is not that much of an argument to me (quite the opposite, actually!).

I put it there actually because it's a pre-compiled thing.

Quoted 27 lines

On Ubuntu, the Java libraries are apparently installed in /usr/share/java/, which seems a bit more sensible to me. The JNI parts are installed in /usr/lib/jni/. See:

$ dpkg -L librxtx-java
[... skip documentation ...]
/usr/share/java
/usr/share/java/RXTXcomm-2.2pre2.jar
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/librxtx-java
/usr/lib
/usr/lib/jni
/usr/lib/jni/librxtxRaw-2.2pre1.so
/usr/lib/jni/librxtxI2C-2.2pre1.so
/usr/lib/jni/librxtxRS485-2.2pre1.so
/usr/lib/jni/librxtxSerial-2.2pre1.so
/usr/lib/jni/librxtxParallel-2.2pre1.so
/usr/share/java/RXTXcomm.jar
/usr/lib/jni/librxtxSerial.so
/usr/lib/jni/librxtxRS485.so
/usr/lib/jni/librxtxI2C.so
/usr/lib/jni/librxtxParallel.so
/usr/lib/jni/librxtxRaw.so
Quoted 11 lines

package/pi4j/Config.in line 3

Quoted 9 lines
package/pi4j/Config.in new file +3 -0
new file mode 100644
index 0000000..99736bf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PI4J
+     bool "pi4j"
+     depends on BR2_PACKAGE_RPI_USERLAND

Why this dependency?

the same as for wiringpi. This package is specific to rpi and doesn't make sense on other platforms.

Quoted 18 lines

As stated above, we should ensure that a JVM is selected here.

package/pi4j/Config.in

Quoted 12 lines
package/pi4j/Config.in new file +12 -0
+define PI4J_INSTALL_TARGET_CMDS
+     $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-core.jar \
+             $(TARGET_DIR)/opt/pi4j/lib/pi4j-core.jar
+     $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-device.jar \
+             $(TARGET_DIR)/opt/pi4j/lib/pi4j-device.jar
+     $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-example.jar \
+             $(TARGET_DIR)/opt/pi4j/lib/pi4j-example.jar
+     $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-gpio-extension.jar \
+             $(TARGET_DIR)/opt/pi4j/lib/pi4j-extension.jar
+     $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-service.jar \
+             $(TARGET_DIR)/opt/pi4j/lib/pi4j-service.jar
+endef

This can probably be improved a little bit:

Quoted 8 lines

PI4J_LIBS = core device example extension service

define PI4J_INSTALL_TARGET_CMDS

        $(foreach lib,$(PI4J_LIBS),\
                $(INSTALL) -D -m 0644 $(@D)/lib/pi4j-$(lib).jar $(TARGET_DIR)/opt/pi4j/lib/pi4j-$(lib).jar)

endef

Thanks!

ok, thanks.

Lucas De Marchi

#6 lore raw

PATCH 3/3 pi4j: new package

Dear Lucas De Marchi,

Quoted 10 lines · Lucas De Marchi
Quoted 3 lines

I think this is quite certainly the first Java library for which we have a package. Which JVM are you using to run this on the target? The official Oracle JDK?

I'm using the official Oracle JDK. However I think we are not allowed to distribute it or make "recipes" to distribute it as part of buildroot, are we? Its license looks really restrictive. My current approach for the rootfs I'm building for a friend of mine is to install the Oracle jdk by using a overlay directory in buildroot. Do you think it would be possible to add the oracle jdk to buildroot?

I haven't looked at the licensing details, but it would be worth checking this. I know that some time ago, Debian had a package for the JVM, which was downloading it from Sun (back in the days).

Quoted 5 lines
Quoted 3 lines

Regarding the installation in /opt, I'm not sure. The fact that Raspbian installs it here is not that much of an argument to me (quite the opposite, actually!).

I put it there actually because it's a pre-compiled thing.

Still, my feeling is that /usr/share/java is a better location.

Quoted 12 lines
Quoted 11 lines

package/pi4j/Config.in line 3

Quoted 9 lines
package/pi4j/Config.in new file +3 -0
new file mode 100644
index 0000000..99736bf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PI4J
+     bool "pi4j"
+     depends on BR2_PACKAGE_RPI_USERLAND

Why this dependency?

Quoted 2 lines

the same as for wiringpi. This package is specific to rpi and doesn't make sense on other platforms.

But you can perfectly use the Rasberry Pi without rpi-userland. rpi-userland is just the binary blobs for OpenGL and al.

Just make this dependency a dependency on BR2_arm.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH 1/3 wiringpi: new package

In reply to Lucas De Marchi

Dear Lucas De Marchi,

Quoted 3 lines · Lucas De Marchi

wiringpi has a really poor build system wrt cross-compiling and has no official release. These are the patches needed to cross-compile it in its latest revision.

We already had a patch that proposed to add this library in July 2013 (search for "Raspberry Pi - WiringPi Library Package" in the mailing list archives). At the time, the approach of the patch was to completely replace the package build system by a CMake based one. The patches were actually smaller than the ones you're proposing here:

 package/Config.in                                 |   1 +
 package/wiringpi/Config.in                        |   8 ++
 package/wiringpi/wiringpi-CLOEXEC-undefined.patch |  15 ++++
 package/wiringpi/wiringpi-cmake-support.patch     | 101 ++++++++++++++++++++++
 package/wiringpi/wiringpi.mk                      |  41 +++++++++

That being said, the big drawback of having a completely different build system is that everytime we will bump this library, we will need to do some close analysis to verify that our CMake based build system is aligned with what the official custom build system is doing. In that sense, I may in the end prefer your approach that consists in fixing the build system itself. This way, if it gets changed, then we'll automatically have these changes, or we will notice through conflicts that things have changed.

Also, looking at your patches below, only a few of them are in fact directly related to cross-compilation. Most of them fix various other issues, and maybe could be upstreamed.

Quoted 3 lines

This patch set was made hoping it would be merged by upstream. Therefore it's conservative on the changes. However the feedback was that "cross-compiling is wrong and you should fork it if you want to do so".

These RasberryPi people are really crazy. That some of them want to spend hours doing native builds on their RasberryPi is a thing, but that they force everybody to use those poor practices is really frustrating.

package/wiringpi/0002-Fix-typo-in-makefiles.patch line 6

Quoted 12 lines
package/wiringpi/0002-Fix-typo-in-makefiles.patch new file +6 -0
new file mode 100644
index 0000000..3145aa5
@@ -0,0 +1,187 @@
+From d87fbc10e372139736029009f0574e228776f205 Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Sat, 28 Dec 2013 18:26:13 -0200
+Subject: [PATCH 2/8] Fix typo in makefiles
+
+It's PHONY, not PHONEY.

This one can probably be upstreamed. Or maybe making typos is also part of the RasberryPi way of doing things? :-)

package/wiringpi/0004-Add-gitignore-file.patch line 4

Quoted 10 lines
package/wiringpi/0004-Add-gitignore-file.patch new file +4 -0
new file mode 100644
index 0000000..081d5be
@@ -0,0 +1,23 @@
+From 5f677acf115e1aa36d32a93164aa669d73c40fbf Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Sat, 28 Dec 2013 18:26:20 -0200
+Subject: [PATCH 4/8] Add gitignore file

I don't think we really need this patch in Buildroot.

package/wiringpi/Config.in line 4

Quoted 10 lines
package/wiringpi/Config.in new file +4 -0
new file mode 100644
index 0000000..1e7433a
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_WIRINGPI
+	bool "wiringpi"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_PACKAGE_RPI_USERLAND

Is this dependency really needed? What does rpi-userland brings that is needed for wiringPi?

package/wiringpi/Config.in line 7

Quoted 3 lines
package/wiringpi/Config.in new file +3 -0
+	help
+	  WiringPi is a GPIO access library written in C for the BCM2835
+	  used in the Raspberry Pi.

I continue to be skeptical about the usefulness of such a library. Why not just use the /sys/class/gpio interface? But well, wiringPi seems to actually be used by some people, so we should have a package for it.

Quoted 6 lines
package/wiringpi/wiringpi.mk new file +0 -0
new file mode 100644
index 0000000..8e448ea

package/wiringpi/wiringpi.mk line 10

Quoted 10 lines
package/wiringpi/wiringpi.mk new file +10 -0
@@ -0,0 +1,28 @@
+################################################################################
+#
+# wiringpi
+#
+################################################################################
+
+WIRINGPI_VERSION = f18c8f7204d6354220fd6754578b3daa43734e1b
+WIRINGPI_SITE = git://git.drogon.net/wiringPi
+
+WIRINGPI_LICENSE = LGPLv3

License is LGPLv3+ it seems

package/wiringpi/wiringpi.mk line 13

Quoted 3 lines
package/wiringpi/wiringpi.mk new file +3 -0
+WIRINGPI_LICENSE_FILES = COPYING.LESSER
+
+PREFIX = /usr

No, this is not possible. Make variables in Buildroot are global, and we clearly do not want a global PREFIX variable to be defined.

package/wiringpi/wiringpi.mk line 26

Quoted 12 lines
package/wiringpi/wiringpi.mk new file +12 -0
+define WIRINGPI_BUILD_CMDS
+	env
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/wiringPi
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/devLib
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio
+endef
+
+define WIRINGPI_INSTALL_TARGET_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/wiringPi install
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/devLib install
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio install
+endef

A better solution is probably:

WIRINGPI_MAKE_OPTS = \
	$(TARGET_CONFIGURE_OPTS) \
	PREFIX=/usr

WIRINGPI_DIRS = wiringPi devLib gpio

define WIRINGPI_BUILD_CMDS

	$(foreach d,$(WIRINGPI_DIRS),\
		$(TARGET_MAKE_ENV) $(MAKE) $(WIRINGPI_MAKE_OPTS) -C $(@D)/$(d))

endef

define WIRINGPI_INSTALL_TARGET_CMDS

	$(foreach d,$(WIRINGPI_DIRS),\
		$(TARGET_MAKE_ENV) $(MAKE) $(WIRINGPI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D)/$(d) install)

endef

Also, I'm a bit surprised that it doesn't get installed in the staging directory (i.e WIRINGPI_INSTALL_STAGING = YES). If it's a library, to which other applications can get linked to, then it should be installed to the staging directory as well.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#8 lore raw

PATCH 1/3 wiringpi: new package

Hi Thomas,

Quoted 20 lines · Thomas Petazzoni

Dear Lucas De Marchi,

Quoted 3 lines · Lucas De Marchi

wiringpi has a really poor build system wrt cross-compiling and has no official release. These are the patches needed to cross-compile it in its latest revision.

We already had a patch that proposed to add this library in July 2013 (search for "Raspberry Pi - WiringPi Library Package" in the mailing list archives). At the time, the approach of the patch was to completely replace the package build system by a CMake based one. The patches were actually smaller than the ones you're proposing here:

 package/Config.in                                 |   1 +
 package/wiringpi/Config.in                        |   8 ++
 package/wiringpi/wiringpi-CLOEXEC-undefined.patch |  15 ++++
 package/wiringpi/wiringpi-cmake-support.patch     | 101 ++++++++++++++++++++++
 package/wiringpi/wiringpi.mk                      |  41 +++++++++
Quoted 8 lines

That being said, the big drawback of having a completely different build system is that everytime we will bump this library, we will need to do some close analysis to verify that our CMake based build system is aligned with what the official custom build system is doing. In that sense, I may in the end prefer your approach that consists in fixing the build system itself. This way, if it gets changed, then we'll automatically have these changes, or we will notice through conflicts that things have changed.

Yes. I did what I did in the hope to merge the patches upstream though I still think it's a poor handmade build system. From my experience it's easier to merge patches with some changes to the build system making it compatible with what it was previously doing rather than proposing a new build system.

Quoted 4 lines

Also, looking at your patches below, only a few of them are in fact directly related to cross-compilation. Most of them fix various other issues, and maybe could be upstreamed.

Yeah... I'll remove the ones that are not needed. I've got really frustrated and surprised about the upstream feedback and sent it as is.

Quoted 9 lines
Quoted 4 lines

This patch set was made hoping it would be merged by upstream. Therefore it's conservative on the changes. However the feedback was that "cross-compiling is wrong and you should fork it if you want to do so".

These RasberryPi people are really crazy. That some of them want to spend hours doing native builds on their RasberryPi is a thing, but that they force everybody to use those poor practices is really frustrating.

agreed.

Quoted 16 lines

package/wiringpi/0002-Fix-typo-in-makefiles.patch line 6

Quoted 13 lines
package/wiringpi/0002-Fix-typo-in-makefiles.patch new file +6 -0
new file mode 100644
index 0000000..3145aa5
@@ -0,0 +1,187 @@
+From d87fbc10e372139736029009f0574e228776f205 Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Sat, 28 Dec 2013 18:26:13 -0200
+Subject: [PATCH 2/8] Fix typo in makefiles
+
+It's PHONY, not PHONEY.

This one can probably be upstreamed. Or maybe making typos is also part of the RasberryPi way of doing things? :-)

I sent this patch as is... it was not even reviewed. I think the wiringpi author has a wrong vision of open source: he publishes the code and he is the only one to make changes but doesn't accept contributions.

Quoted 14 lines

package/wiringpi/0004-Add-gitignore-file.patch line 4

Quoted 12 lines
package/wiringpi/0004-Add-gitignore-file.patch new file +4 -0
new file mode 100644
index 0000000..081d5be
@@ -0,0 +1,23 @@
+From 5f677acf115e1aa36d32a93164aa669d73c40fbf Mon Sep 17 00:00:00 2001
+From: Lucas De Marchi <[email protected]>
+Date: Sat, 28 Dec 2013 18:26:20 -0200
+Subject: [PATCH 4/8] Add gitignore file

I don't think we really need this patch in Buildroot.

ok

Quoted 14 lines

package/wiringpi/Config.in line 4

Quoted 11 lines
package/wiringpi/Config.in new file +4 -0
new file mode 100644
index 0000000..1e7433a
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_WIRINGPI
+     bool "wiringpi"
+     depends on BR2_TOOLCHAIN_HAS_THREADS
+     depends on BR2_PACKAGE_RPI_USERLAND

Is this dependency really needed? What does rpi-userland brings that is needed for wiringPi?

humn... I've put this dependency because this patch makes sense only for raspberry. As I can see (I'm not the one that is actually making use of it) it contains configurations that are specific to the rpi and make no sense in other platforms.

Is this "depends on" the right way to depend on a certain board.

Quoted 8 lines

package/wiringpi/Config.in line 7

Quoted 4 lines
package/wiringpi/Config.in new file +3 -0
+     help
+       WiringPi is a GPIO access library written in C for the BCM2835
+       used in the Raspberry Pi.

I continue to be skeptical about the usefulness of such a library. Why not just use the /sys/class/gpio interface? But well, wiringPi seems to actually be used by some people, so we should have a package for it.

I agree with you. I don't think it's useful at all. The only reason I'm adding it is because people are using it (particularly the gpio command that is part of it).

Quoted 11 lines
Quoted 11 lines
package/wiringpi/wiringpi.mk new file +4 -0
new file mode 100644
index 0000000..8e448ea
@@ -0,0 +1,28 @@
+################################################################################
+#
+# wiringpi
+#
Quoted 8 lines

package/wiringpi/wiringpi.mk line 10

Quoted 6 lines
package/wiringpi/wiringpi.mk new file +6 -0
+################################################################################
+
+WIRINGPI_VERSION = f18c8f7204d6354220fd6754578b3daa43734e1b
+WIRINGPI_SITE = git://git.drogon.net/wiringPi
+
+WIRINGPI_LICENSE = LGPLv3

License is LGPLv3+ it seems

indeed.

Quoted 7 lines

package/wiringpi/wiringpi.mk line 13

Quoted 4 lines
package/wiringpi/wiringpi.mk new file +3 -0
+WIRINGPI_LICENSE_FILES = COPYING.LESSER
+
+PREFIX = /usr

No, this is not possible. Make variables in Buildroot are global, and we clearly do not want a global PREFIX variable to be defined.

ok, thanks

Quoted 28 lines

package/wiringpi/wiringpi.mk line 26

Quoted 13 lines
package/wiringpi/wiringpi.mk new file +12 -0
+define WIRINGPI_BUILD_CMDS
+     env
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/wiringPi
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) $(MAKE) -C $(@D)/devLib
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio
+endef
+
+define WIRINGPI_INSTALL_TARGET_CMDS
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/wiringPi install
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/devLib install
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) PREFIX=$(PREFIX) DESTDIR=$(TARGET_DIR) $(MAKE) -C $(@D)/gpio install
+endef

A better solution is probably:

WIRINGPI_MAKE_OPTS = \
        $(TARGET_CONFIGURE_OPTS) \
        PREFIX=/usr

WIRINGPI_DIRS = wiringPi devLib gpio

define WIRINGPI_BUILD_CMDS

        $(foreach d,$(WIRINGPI_DIRS),\
                $(TARGET_MAKE_ENV) $(MAKE) $(WIRINGPI_MAKE_OPTS) -C $(@D)/$(d))

endef

define WIRINGPI_INSTALL_TARGET_CMDS

Quoted 8 lines
        $(foreach d,$(WIRINGPI_DIRS),\
                $(TARGET_MAKE_ENV) $(MAKE) $(WIRINGPI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D)/$(d) install)

endef

Also, I'm a bit surprised that it doesn't get installed in the staging directory (i.e WIRINGPI_INSTALL_STAGING = YES). If it's a library, to which other applications can get linked to, then it should be installed to the staging directory as well.

I didn't notice it probably because the gpio program is the only one actually using and linking to this library, so it doesn't need the library in the staging dir.

thanks for reviewing it, I'll send an updated version.

Lucas De Marchi

#9 lore raw

PATCH 1/3 wiringpi: new package

Dear Lucas De Marchi,

Quoted 1 line · Lucas De Marchi

thanks for reviewing it, I'll send an updated version.

Do you plan to resend new versions of your wiringpi and pi4j patches, taking into account the reviews that were made early January?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw

PATCH 1/3 wiringpi: new package

Hi Thomas,

Quoted 8 lines · Thomas Petazzoni

Dear Lucas De Marchi,

Quoted 1 line · Lucas De Marchi

thanks for reviewing it, I'll send an updated version.

Do you plan to resend new versions of your wiringpi and pi4j patches, taking into account the reviews that were made early January?

sorry for the delay

I totally lost interest in these 2 packages, partially because of the upstream reaction. Now I don't have access to a rpi anymore to test them. I may send again in future, but currently I have no plans.

--
Lucas De Marchi