Skip to contentSkip to conversation

flatcc: new package

PATCH Superseded Steve deRosier 3 participants 3 messages Apr 16, 2016 – Apr 18, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flatcc: new package

This adds flatcc as a new package, pulling v0.3.0 from github. flatcc has both a host tool - the compiler, and libraries for the target.

---
 package/Config.in        |  1 +
 package/flatcc/Config.in |  8 ++++++++
 package/flatcc/flatcc.mk | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 package/flatcc/Config.in
 create mode 100644 package/flatcc/flatcc.mk
package/Config.in +1 -0
index bcfe13b..9e3d953 100644
@@ -1201,6 +1201,7 @@ menu "Other"
 	source "package/ding-libs/Config.in"
 	source "package/eigen/Config.in"
 	source "package/elfutils/Config.in"
+	source "package/flatcc/Config.in"
 	source "package/fftw/Config.in"
 	source "package/flann/Config.in"
 	source "package/gflags/Config.in"
package/flatcc/Config.in new file +8 -0
new file mode 100644
index 0000000..4f84f06
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_FLATCC
+	bool "flatcc"
+	help
+	  flatcc is C language implementation of Google Flatbuffers. It consists
+	  of both a library for the target as well as a flatbuffer compiler tool
+	  for the host.
+
+	  https://github.com/dvidelabs/flatcc
package/flatcc/flatcc.mk new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 flatcc: new package

Hi Steve,

Thanks for your contribution. I have a few comments, will you fix them and repost?

Quoted 8 lines · Steve deRosier

This adds flatcc as a new package, pulling v0.3.0 from github. flatcc has both a host tool - the compiler, and libraries for the target.

---
  package/Config.in        |  1 +
  package/flatcc/Config.in |  8 ++++++++
  package/flatcc/flatcc.mk | 41 +++++++++++++++++++++++++++++++++++++++++

You should also add a hash file.

Quoted 22 lines
  3 files changed, 50 insertions(+)

create mode 100644 package/flatcc/Config.in
create mode 100644 package/flatcc/flatcc.mk

package/Config.in +1 -0
index bcfe13b..9e3d953 100644
@@ -1201,6 +1201,7 @@ menu "Other"
  	source "package/ding-libs/Config.in"
  	source "package/eigen/Config.in"
  	source "package/elfutils/Config.in"
+	source "package/flatcc/Config.in"
  	source "package/fftw/Config.in"
  	source "package/flann/Config.in"
  	source "package/gflags/Config.in"
package/flatcc/Config.in new file +0 -0
new file mode 100644
index 0000000..4f84f06

package/flatcc/Config.in line 2

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

I doesn't seem to build on big-endian, so add

	depends on BR2_ENDIAN == "LITTLE"

package/flatcc/Config.in line 6

Quoted 4 lines
package/flatcc/Config.in new file +4 -0
+	help
+	  flatcc is C language implementation of Google Flatbuffers. It consists
+	  of both a library for the target as well as a flatbuffer compiler tool
+	  for the host.

Help text should be wrapped at 72 columns, where the tab counts as 8, so 62
significant characters.

Quoted 8 lines
package/flatcc/Config.in new file +2 -0
+
+	  https://github.com/dvidelabs/flatcc
package/flatcc/flatcc.mk new file +0 -0
new file mode 100644
index 0000000..28fb89b

package/flatcc/flatcc.mk line 6

Quoted 6 lines
package/flatcc/flatcc.mk new file +6 -0
@@ -0,0 +1,41 @@
+################################################################################
+#
+# FLATCC
+#
+################################################################################
+FLATCC_VERSION = v0.3.0

There's a v0.3.2 now.

package/flatcc/flatcc.mk line 7

Quoted 1 line
package/flatcc/flatcc.mk new file +1 -0
+FLATCC_SITE =$(call github,dvidelabs,flatcc,$(FLATCC_VERSION))

^ missing space

package/flatcc/flatcc.mk line 11

Quoted 4 lines
package/flatcc/flatcc.mk new file +4 -0
+FLATCC_LICENSE = Apache-2.0
+FLATCC_LICENSE_FILES = LICENSE
+FLATCC_INSTALL_STAGING = YES
+FLATCC_DEPENDENCIES += host-flatcc

The + is redundant.

package/flatcc/flatcc.mk line 13

Quoted 2 lines
package/flatcc/flatcc.mk new file +2 -0
+
+FLATCC_CONF_OPTS += -DFLATCC_TEST=OFF -DFLATCC_PORTABLE=ON

Why set portable to ON? AFAICS in the CMakeLists.txt, it should be detected
properly based on the cross-gcc version... But maybe that's something new in v0.3.2.

package/flatcc/flatcc.mk line 17

Quoted 4 lines
package/flatcc/flatcc.mk new file +4 -0
+HOST_FLATCC_CONF_OPTS += -DFLATCC_TEST=OFF
+
+define HOST_FLATCC_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/flatcc $(HOST_DIR)/usr/bin/flatcc

I was going to say: this shouldn't be needed - but in fact it is, it looks
like they have a weird CMakeLists.txt that doesn't even have an 'install' target... Se yes, this is needed.

package/flatcc/flatcc.mk line 21

Quoted 6 lines
package/flatcc/flatcc.mk new file +4 -0
+endef
 
 
+
+ifeq ($(BR2_STATIC_LIBS),y)
+	FLATCC_INSTALL_TARGET = NO

We don't usually do this. However, in this case it does make sense because
it's an elegant way to not execute the INSTALL_TARGET_COMMANDS that install the non-existent .so files.

That said, it should not be indented. We only indent commands (inside a define
block), not variable assignments.

package/flatcc/flatcc.mk line 33

Quoted 12 lines
package/flatcc/flatcc.mk new file +12 -0
+define FLATCC_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatcc.a $(STAGING_DIR)/usr/lib/libflatcc.a
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatccrt.a $(STAGING_DIR)/usr/lib/libflatccrt.a
+	cp -r $(@D)/include/flatcc $(STAGING_DIR)/usr/include/.
+endef
+else
+define FLATCC_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatcc.so $(STAGING_DIR)/usr/lib/libflatcc.so
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatccrt.so $(STAGING_DIR)/usr/lib/libflatccrt.so
+	cp -r $(@D)/include/flatcc $(STAGING_DIR)/usr/include/.
+endef
+endif

Here you forgot about the STATIC_SHARED case. The proper way to do it would be:

ifeq ($(BR2_SHARED_LIBS),)
define FLATCC INSTALL_STAGING_STATIC
... libflatcc.a and libflatccrt.a
endef
endif
ifeq ($(BR2_STATIC_LIBS),)
define FLATCC_INSTALL_STAGING_SHARED
... libflatcc.so and libflatccrt.so
endef
endif

define FLATCC_INSTALL_STAGING_COMMANDS

	cp -r $(@D)/include/flatcc $(STAGING_DIR)/usr/include/.
	$(FLATCC_INSTALL_STAGING_STATIC)
	$(FLATCC_INSTALL_STAGING_SHARED)

endef

Alternatively, the condition for static could be:
ifeq ($(BR2_STATIC_LIBS)$(BR2_STATIC_SHARED_LIBS),y)

Regards,
Arnout

Quoted 9 lines
package/flatcc/flatcc.mk new file +8 -0
+
+define FLATCC_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatcc.so $(TARGET_DIR)/usr/lib/libflatcc.so
+	$(INSTALL) -D -m 0755 $(@D)/lib/libflatccrt.so $(TARGET_DIR)/usr/lib/libflatccrt.so
+endef
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH 1/1 flatcc: new package

Hello,

Quoted 6 lines · Arnout Vandecappelle

package/flatcc/flatcc.mk line 17

Quoted 2 lines
package/flatcc/flatcc.mk new file +2 -0
+define HOST_FLATCC_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/flatcc $(HOST_DIR)/usr/bin/flatcc

I was going to say: this shouldn't be needed - but in fact it is, it looks
like they have a weird CMakeLists.txt that doesn't even have an 'install' target... Se yes, this is needed.

Then this definitely calls for a comment that explains why this is needed.

Thanks!

Thomas

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