Skip to contentSkip to conversation

c-periphery: new package

PATCH New Thomas Petazzoni 2 participants 4 messages May 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 c-periphery: new package

This package is needed as a dependency of lua-periphery. Currently, c-periphery is automatically cloned by lua-periphery, which causes two problems:

1/ It does not integrate properly with the download infrastructure of
Buildroot, making offline builds impossible since not the entire source code is downloaded by Buildroot.

2/ It does not use the latest version of c-periphery, which has some
fixes contributed by Vicente to fix c-periphery on MIPS.

Introducing this package is needed as part of the fix for the following build failure:

http://autobuild.buildroot.org/results/0ad/0ad656970b3cbc84b5531b28155ba2f747715fe3/

---
 package/Config.in                  |  1 +
 package/c-periphery/Config.in      | 16 ++++++++++++++++
 package/c-periphery/c-periphery.mk | 27 +++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 package/c-periphery/Config.in
 create mode 100644 package/c-periphery/c-periphery.mk
package/Config.in +1 -0
index af4d2b7..e0c2e2a 100644
@@ -811,6 +811,7 @@ menu "Graphics"
 endmenu
 
 menu "Hardware handling"
+	source "package/c-periphery/Config.in"
 	source "package/ccid/Config.in"
 	source "package/dtc/Config.in"
 	source "package/gnu-efi/Config.in"
package/c-periphery/Config.in new file +16 -0
new file mode 100644
index 0000000..0bfb4b1
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_C_PERIPHERY
+	bool "c-periphery"
+	help
+	  c-periphery is a set of C wrapper functions for GPIO, SPI,
+	  I2C, MMIO, and Serial peripheral I/O interface access in
+	  userspace Linux. The c-periphery wrappers simplify and
+	  consolidate the native Linux APIs to these
+	  interfaces. c-periphery is useful in embedded Linux
+	  environments (including BeagleBone, Raspberry Pi,
+	  etc. platforms) for interfacing with external
+	  peripherals. c-periphery is re-entrant, uses static
+	  allocations, has no dependencies outside the standard C
+	  library and Linux, compiles into a static library for easy
+	  integration with other projects, and is MIT licensed.
+
+	  https://github.com/vsergeev/c-periphery
package/c-periphery/c-periphery.mk new file +27 -0
new file mode 100644
index 0000000..68193d7
@@ -0,0 +1,27 @@
+################################################################################
+#
+# c-periphery
+#
+################################################################################
+
+C_PERIPHERY_VERSION = 0fdfac3264f1dce32991f4ec30d084e34b35181d
+C_PERIPHERY_SITE = $(call github,vsergeev,c-periphery,$(C_PERIPHERY_VERSION))
+C_PERIPHERY_INSTALL_STAGING = YES
+# only a static library
+C_PERIPHERY_INSTALL_TARGET = NO
+C_PERIPHERY_LICENSE = MIT
+C_PERIPHERY_LICENSE_FILES = LICENSE
+
+define C_PERIPHERY_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
+endef
+
+# There is no 'install' rule in the Makefile, so we handle things
+# manually.
+define C_PERIPHERY_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/periphery.a $(STAGING_DIR)/usr/lib/libc-periphery.a
+	mkdir -p $(STAGING_DIR)/usr/include/c-periphery/
+	cp -dpfr $(@D)/src/*.h $(STAGING_DIR)/usr/include/c-periphery/
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 lua-periphery: depend on c-periphery instead of cloning it

lua-periphery currently clones and builds the c-periphery library by itself. This causes two problems:

1/ It does not integrate properly with the download infrastructure of
Buildroot, making offline builds impossible since not the entire source code is downloaded by Buildroot.

2/ It does not use the latest version of c-periphery, which has some
fixes contributed by Vicente to fix c-periphery on MIPS.

This commit fixes:

http://autobuild.buildroot.org/results/0ad/0ad656970b3cbc84b5531b28155ba2f747715fe3/

---
 ...01-Makefile-don-t-clone-build-c-periphery.patch | 32 ++++++++
 package/lua-periphery/0002-Fix-include-paths.patch | 89 ++++++++++++++++++++++
 package/lua-periphery/Config.in                    |  1 +
 package/lua-periphery/lua-periphery.mk             |  1 +
 4 files changed, 123 insertions(+)
 create mode 100644 package/lua-periphery/0001-Makefile-don-t-clone-build-c-periphery.patch
 create mode 100644 package/lua-periphery/0002-Fix-include-paths.patch
package/lua-periphery/0001-Makefile-don-t-clone-build-c-periphery.patch new file +32 -0
new file mode 100644
index 0000000..85545ce
@@ -0,0 +1,32 @@
+From 395bb4cb37612a4ac94346531b13ff0e901ed05e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Tue, 5 May 2015 23:59:17 +0200
+Subject: [PATCH 1/2] Makefile: don't clone/build c-periphery
+
+This patch adjusts lua-periphery Makefile to not clone and build the
+c-periphery library by itself, and instead of the already available
+c-periphery library.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lua-periphery/Makefile b/lua-periphery/Makefile
+index bed9b32..a4c68eb 100644
+--- a/lua-periphery/Makefile
++++ b/lua-periphery/Makefile
+@@ -36,8 +36,8 @@ install:
+ 
+ ###########################################################################
+ 
+-$(LIB): $(C_PERIPHERY_LIB) $(SRCS)
+-	$(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) $(C_PERIPHERY_LIB) -o $@
++$(LIB): $(SRCS)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -lc-periphery -o $@
+ 
+ $(C_PERIPHERY_LIB): $(C_PERIPHERY)/Makefile
+ 	cd $(C_PERIPHERY); $(MAKE)
+-- 
+2.1.0
+
package/lua-periphery/0002-Fix-include-paths.patch new file +89 -0

89 lines not on this page · raw message

package/lua-periphery/Config.in +1 -0
index de5a716..df0546f 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_LUA_PERIPHERY
 	bool "lua-periphery"
 	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
+	select BR2_PACKAGE_C_PERIPHERY
 	help
 	  A library for GPIO, SPI, I2C, MMIO, and Serial peripheral I/O
 	  interface access in userspace Linux with Lua.
package/lua-periphery/lua-periphery.mk +1 -0
index 0717a27..99e1dbe 100644
@@ -7,6 +7,7 @@
 LUA_PERIPHERY_VERSION_UPSTREAM = 1.0.4
 LUA_PERIPHERY_VERSION = $(LUA_PERIPHERY_VERSION_UPSTREAM)-1
 LUA_PERIPHERY_SUBDIR = lua-periphery
+LUA_PERIPHERY_DEPENDENCIES = c-periphery
 LUA_PERIPHERY_LICENSE = MIT
 LUA_PERIPHERY_LICENSE_FILES = $(LUA_PERIPHERY_SUBDIR)/LICENSE
 
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/2 lua-periphery: depend on c-periphery instead of cloning it

Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

lua-periphery currently clones and builds the c-periphery library by itself. This causes two problems:

1/ It does not integrate properly with the download infrastructure of
Buildroot, making offline builds impossible since not the entire source code is downloaded by Buildroot.

2/ It does not use the latest version of c-periphery, which has some
fixes contributed by Vicente to fix c-periphery on MIPS.

This commit fixes:

http://autobuild.buildroot.org/results/0ad/0ad656970b3cbc84b5531b28155ba2f747715fe3/

+++ b/package/lua-periphery/0001-Makefile-don-t-clone-build-c-periphery.patch

package/lua-periphery/0001-Makefile-don-t-clone-build-c-periphery.patch line 7

Quoted 7 lines
package/lua-periphery/0001-Makefile-don-t-clone-build-c-periphery.patch new file +7 -0
@@ -0,0 +1,32 @@
+From 395bb4cb37612a4ac94346531b13ff0e901ed05e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Tue, 5 May 2015 23:59:17 +0200
+Subject: [PATCH 1/2] Makefile: don't clone/build c-periphery
+
+This patch adjusts lua-periphery Makefile to not clone and build the
+c-periphery library by itself, and instead of the already available

s/of/use/

Committed with that fixed, thanks.

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

PATCH 1/2 c-periphery: new package

In reply to Thomas Petazzoni
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

This package is needed as a dependency of lua-periphery. Currently, c-periphery is automatically cloned by lua-periphery, which causes two problems:

1/ It does not integrate properly with the download infrastructure of
Buildroot, making offline builds impossible since not the entire source code is downloaded by Buildroot.

2/ It does not use the latest version of c-periphery, which has some
fixes contributed by Vicente to fix c-periphery on MIPS.

Quoted 6 lines

Introducing this package is needed as part of the fix for the following build failure:

http://autobuild.buildroot.org/results/0ad/0ad656970b3cbc84b5531b28155ba2f747715fe3/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard