Skip to contentSkip to conversation

Raspberry Pi - WiringPi Library Package

PATCH New Guillermo A. Amaral 2 participants 2 messages Jul 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Raspberry Pi - WiringPi Library Package

From: "Guillermo A. Amaral" <[email protected]>

---
 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 +++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 package/wiringpi/Config.in
 create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch
 create mode 100644 package/wiringpi/wiringpi-cmake-support.patch
 create mode 100644 package/wiringpi/wiringpi.mk
package/Config.in +1 -0
index 3186bb7..2824904 100644
@@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in"
 source "package/usbmount/Config.in"
 source "package/usbutils/Config.in"
 source "package/wipe/Config.in"
+source "package/wiringpi/Config.in"
 source "package/w_scan/Config.in"
 endmenu
 
package/wiringpi/Config.in new file +8 -0
new file mode 100644
index 0000000..7ce1048
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_WIRINGPI
+        bool "wiringpi"
+	depends on BR2_arm
+	help
+	  GPIO Interface library for the Raspberry Pi.
+
+	  http://wiringpi.com/
+
package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file +15 -0
new file mode 100644
index 0000000..097cb93
@@ -0,0 +1,15 @@
+diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c
+index ba61d9f..2ee23b9 100644
+--- a/wiringPi/wiringPi.c
++++ b/wiringPi/wiringPi.c
+@@ -77,6 +77,10 @@
+ #define	FALSE	(1==2)
+ #endif
+ 
++#ifndef O_CLOEXEC
++#define O_CLOEXEC 0
++#endif
++
+ // Environment Variables
+ 
+ #define	ENV_DEBUG	"WIRINGPI_DEBUG"
package/wiringpi/wiringpi-cmake-support.patch new file +101 -0

101 lines not on this page · raw message

package/wiringpi/wiringpi.mk new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 1/1 Raspberry Pi - WiringPi Library Package

Dear Guillermo A. Amaral,

Quoted 4 lines · Guillermo A. Amaral

From: "Guillermo A. Amaral" <[email protected]>

Quoted 11 lines
---
 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 +++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 package/wiringpi/Config.in
 create mode 100644 package/wiringpi/wiringpi-CLOEXEC-undefined.patch
 create mode 100644 package/wiringpi/wiringpi-cmake-support.patch
 create mode 100644 package/wiringpi/wiringpi.mk

Thanks for this patch! I'm giving a few comments below.

On a side note, I'm really wondering why such hardware platform specific libraries are needed. Why aren't people using the standard Linux GPIO API in /sys/class/gpio, which is re-usable across hardware platforms? Why is it always that the RasberryPi community constantly invents for everything a non-standard way of doing things? Of course, that's nothing against your patch, but I'm really wondering what RasberryPi users are smoking. The big interest of Linux compared to micro-controller development is IMO that user-space interfaces are standardized across hardware platforms, so you can easily move on program from on platform to another, and re-use your knowledge between platforms. Those RasberryPi specific libraries really look like things being done by people who come from a micro-controller background, and don't understand the value of standardized APIs across hardware platforms.

Anyway, enough rant.

Quoted 18 lines
package/Config.in +1 -0
index 3186bb7..2824904 100644
@@ -303,6 +303,7 @@ source "package/usb_modeswitch_data/Config.in"
 source "package/usbmount/Config.in"
 source "package/usbutils/Config.in"
 source "package/wipe/Config.in"
+source "package/wiringpi/Config.in"
 source "package/w_scan/Config.in"
 endmenu
 
package/wiringpi/Config.in new file +0 -0
new file mode 100644
index 0000000..7ce1048

package/wiringpi/Config.in line 2

Quoted 2 lines
package/wiringpi/Config.in new file +2 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_WIRINGPI
+        bool "wiringpi"

Indentation should be a tab.

package/wiringpi/wiringpi-CLOEXEC-undefined.patch

Quoted 11 lines
package/wiringpi/Config.in new file +6 -0
+	depends on BR2_arm
+	help
+	  GPIO Interface library for the Raspberry Pi.
+
+	  http://wiringpi.com/
+
package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file +0 -0
new file mode 100644
index 0000000..097cb93

All patches should have a header with a description + Signed-off-by.

package/wiringpi/wiringpi-cmake-support.patch

Quoted 21 lines
package/wiringpi/wiringpi-CLOEXEC-undefined.patch new file +15 -0
@@ -0,0 +1,15 @@
+diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c
+index ba61d9f..2ee23b9 100644
+--- a/wiringPi/wiringPi.c
++++ b/wiringPi/wiringPi.c
+@@ -77,6 +77,10 @@
+ #define	FALSE	(1==2)
+ #endif
+ 
++#ifndef O_CLOEXEC
++#define O_CLOEXEC 0
++#endif
++
+ // Environment Variables
+ 
+ #define	ENV_DEBUG	"WIRINGPI_DEBUG"
package/wiringpi/wiringpi-cmake-support.patch new file +0 -0
new file mode 100644
index 0000000..f6664ab

Same thing here. However, can you comment on why you're adding a new build system here instead of using the Makefiles that come with the official version of this WiringPi thing?

Quoted 8 lines
package/wiringpi/wiringpi.mk new file +2 -0
new file mode 100644
index 0000000..2f38c4e
@@ -0,0 +1,41 @@
+#############################################################
+#

package/wiringpi/wiringpi.mk line 12

Quoted 10 lines
package/wiringpi/wiringpi.mk new file +10 -0
+# wiringpi
+#
+#############################################################
+
+WIRINGPI_VERSION = 02a3bd8d8f2ae5c873e63875a8faef5b627f9db6
+WIRINGPI_SITE = git://git.drogon.net/wiringPi
+WIRINGPI_LICENSE = LGPLv3+
+WIRINGPI_LICENSE_FILES = COPYING.LESSER
+WIRINGPI_INSTALL_STAGING = YES
+WIRINGPI_INSTALL_TARGET = YES

This last line is not needed, that's the default.

package/wiringpi/wiringpi.mk line 13

Quoted 1 line
package/wiringpi/wiringpi.mk new file +1 -0
+WIRINGPI_CONF_OPT = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr

CMAKE_INSTALL_PREFIX is already passed by the cmake-package infrastructure.

Maybe CMAKE_BUILD_TYPE (which I believe is a standard CMake variable) should also be passed by the cmake package infrastructure. But OK, that's a separate contribution.

package/wiringpi/wiringpi.mk line 26

Quoted 12 lines
package/wiringpi/wiringpi.mk new file +12 -0
+define WIRINGPI_INSTALL_TARGET_CMDS
+	$(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(TARGET_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake"
+	mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_target.txt
+endef
+
+define WIRINGPI_INSTALL_STAGING_CMDS
+	$(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=staging -P "$(@D)/cmake_install.cmake"
+	mv $(@D)/install_manifest_staging.txt $(@D)/install_manifest_staging_staging.txt
+
+	$(HOST_DIR)/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR)/usr -DCOMPONENT=target -P "$(@D)/cmake_install.cmake"
+	mv $(@D)/install_manifest_target.txt $(@D)/install_manifest_target_staging.txt
+endef

Not sure what you're doing here. Why do you have those target and staging components? Just install everything to both staging and target. Headers, static libraries and such are automatically removed from the target/ directory by Buildroot. If there's anything else that is installed in target/ and isn't really needed, you can remove it from the target/ directory using a POST_INSTALL_TARGET hook.

Your patch that introduces the CMake build system should not introduce within the WiringPi build system the notion of target vs. staging.

package/wiringpi/wiringpi.mk line 30

Quoted 4 lines
package/wiringpi/wiringpi.mk new file +4 -0
+
+define WIRINGPI_POST_STAGING_CLEANUP
+    rm $(STAGING_DIR)/usr/bin/cpio
+endef

This isn't used anywhere.

package/wiringpi/wiringpi.mk line 39

Quoted 8 lines
package/wiringpi/wiringpi.mk new file +8 -0
+define WIRINGPI_UNINSTALL_TARGET_CMDS
+	xargs rm -f < $(@D)/install_manifest_target_target.txt
+endef
+
+define WIRINGPI_UNINSTALL_STAGING_CMDS
+	xargs rm -f < $(@D)/install_manifest_staging_staging.txt
+	xargs rm -f < $(@D)/install_manifest_target_staging.txt
+endef

Don't bother implementing the uninstall steps, we're considering phasing them out.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com