Adding leveldb to buildroot
A message that is not in the archive (sent off-list or not yet received): [email protected]
Steve, All,
[Sorry for the duplicate, I forgot to Cc the Buildroot mailing list in the previous mail.]
On 2014-12-08 15:17 +0000, Steve James spake thusly:
Quoted 4 lines
Hello Yann,
I noticed that you started adding leveldb to buildroot at the weekend. I just finished off theMakefilefor the current release (1.18). Files are attached. Please do with them as you wish.
Thank you for your contribution!
In the future, do not hesitate to post the patch to the mailing list, so it can get more thorough reviews.
In fact, I started work on leveldb back in MAy 2013, not this week-end! ;-)
It is part of my (still on-going) work to get a complete libvirt integration in Buildroot, and leveldb is needed by ceph, which in turn can be used by Qemu, but that is still all a long way ahead.
As for leveldb, I have some comments.
First, look at the manual, which explains how to add a package, the coding style we use, and some other usefull tips and tricks, as well as how to submit your changes:
http://buildroot.net/downloads/manual/manual.html
http://buildroot.net/downloads/manual/manual.html#adding-packages
http://buildroot.net/downloads/manual/manual.html#_contributing_to_buildroot
http://buildroot.net/downloads/manual/manual.html#submitting-patches
You must sign-off your patches. Signing-off is a way to handle a chain of origins of a contribution; see a description there:
http://elinux.org/Developer_Certificate_Of_Origin
Basically, you sign-off on a patch with a line like:
Quoted 4 lines
config
BR2_PACKAGE_LEVELDB
bool "leveldb"
selectBR2_PACKAGE_SNAPPY
help
This hsould be indented with a single TAB, not spaces.
Quoted 4 lines
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
Help text should be indented with a single TAB followed by two spaces.
Quoted 2 lines
comment "leveldb needs a toolchain w/ C++"
depends on !BR2_INSTALL_LIBSTDCPP
If so, then you should add a "depends on BR2_INSTALL_LIBSTDCPP" to the main option:
config BR2_PACKAGE_LEVELDB
bool "leveldb"
depends on BR2_INSTALL_LIBSTDCPP
select BR2_PACKAGE_SNAPPY
help
leveldb blabla...
Quoted 5 lines
#############################################################
## leveldb # #############################################################
The ### lines should be 80-chars wide.
Quoted 7 lines
LEVELDB_VERSION= 1.18LEVELDB_SITE= https://github.com/google/leveldb/archive/LEVELDB_SOURCE= v$(LEVELDB_VERSION).tar.gzLEVELDB_LICENSE= BSD-3cLEVELDB_LICENSE_FILES= LICENSELEVELDB_INSTALL_STAGING= YES
There should be only one space before and after the equal sign.
Quoted 3 lines
define
LEVELDB_BUILD_CMDS$(MAKE) -C $(@D) all
This won't work, because you forgot to pass the appropriate variables that contain the cross-compiler and compilation flags. This should be something like:
$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) all
(You can omit 'all' if it is the default rule of the makefile, which it usually is.)
Quoted 8 lines
endef
define
LEVELDB_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0644 $(@D)/libleveldb.a $(TARGET_DIR)/usr/lib
$(INSTALL) -D -m 0755 $(@D)/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib$(HOSTLN) -sf $(TARGET_DIR)/usr/lib/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.so.1 $(HOSTLN) -sf $(TARGET_DIR)/usr/lib/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.so
The last three lines won;t work in case we are doing a static-only build, that is when BR2_PREFER_STATIC_LIB is set.
Quoted 1 line
$(INSTALL) -d -m 0755 $(@D)/include/leveldb $(TARGET_DIR)/usr/include/leveldb
What are you trying to do there? Are you trying to copy the directory $(@D)/include/leveldb and all its content over to $(TARGET_DIR)/usr/include/leveldb ?
If so, that's wrong. This should be installed in $(STAGING_DIR).
Basically, we put all that is needed for development (headers, .so symlinks, shared and/or static libraries) in $(STAGING_DIR), and all that is needed at runtime (shared libraries) in $(TARGET_DIR).
Quoted 3 lines
endef
$(eval $(generic-package))
All the comments above are not in anyway a mean to turn down this patch, but are made so that the code we get in Buildroot meets our standards so that it is maintainable over the long run, and also so you can improve and gain some more knowledge of Buildroot internals.
Care to address all the above and respin a new version, please?
Thank you again for your contribution, it is much appreciated! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Quoted 11 lines · On Monday 08 Dec 2014 17:55:21 Yann E. MORIN wrote:
Steve, All,
[Sorry for the duplicate, I forgot to Cc the Buildroot mailing list in the previous mail.]
On 2014-12-08 15:17 +0000, Steve James spake thusly:
Quoted 4 lines
Hello Yann,
I noticed that you started adding leveldb to buildroot at the weekend. I just finished off theMakefilefor the current release (1.18). Files are attached. Please do with them as you wish.
Quoted 4 lines
Thank you for your contribution!
In the future, do not hesitate to post the patch to the mailing list, so it can get more thorough reviews.
Thanks Yann. OK, will do. I have been watching the list for a few days. I think I get the idea. Patches will follow after this message...
Quoted 2 lines
In fact, I started work on leveldb back in MAy 2013, not this week-end! ;-)
It was this [1] commit that I had in mind when I said "started" -- that's how it looks from the outside of course. I started with this changeset to add leveldb. By the way, it's the origin of some of my non-compliant formatting! ;-) Maybe the spec. changed since May 2013? Any way...
[1] -
https://gitorious.org/buildroot/buildroot/commit/73ad73787a074707ee91dc1beeb75d72fb9ed9f1
Quoted 3 lines
It is part of my (still on-going) work to get a complete libvirt integration in Buildroot, and leveldb is needed by ceph, which in turn can be used by Qemu, but that is still all a long way ahead.
Hopefully at least the leveldb part can be completed soon.
Quoted 11 lines
As for leveldb, I have some comments.
First, look at the manual, which explains how to add a package, the coding style we use, and some other usefull tips and tricks, as well as how to submit your changes:
http://buildroot.net/downloads/manual/manual.html
http://buildroot.net/downloads/manual/manual.html#adding-packageshttp://buildroot.net/downloads/manual/manual.html#_contributing_to_buildro
ot http://buildroot.net/downloads/manual/manual.html#submitting-patches
Thanks. The documentation is comprehensive and necessarily large, so I'm still working my way through it. It'll take a while to fully assimilate.
Quoted 7 lines
You must sign-off your patches. Signing-off is a way to handle a chain of origins of a contribution; see a description there:
http://elinux.org/Developer_Certificate_Of_OriginBasically, you sign-off on a patch with a line like:
Signed-off-by Your Real NAME <[email protected]>
Got it.
Quoted 6 lines
Quoted 5 lines
config
BR2_PACKAGE_LEVELDBbool "leveldb"
selectBR2_PACKAGE_SNAPPY
help
Quoted 8 lines
This hsould be indented with a single TAB, not spaces.
Quoted 4 lines
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
Help text should be indented with a single TAB followed by two spaces.
OK. (I hate tabs, but lets not go OT with a religious Tab War)
Quoted 7 lines
Quoted 3 lines
comment "leveldb needs a toolchain w/ C++"
depends on !BR2_INSTALL_LIBSTDCPP
If so, then you should add a "depends on
BR2_INSTALL_LIBSTDCPP" to the main option:
Quoted 6 lines
config
BR2_PACKAGE_LEVELDB
bool "leveldb"
depends onBR2_INSTALL_LIBSTDCPP
selectBR2_PACKAGE_SNAPPY
help
leveldb blabla...
OK
Quoted 8 lines
Quoted 6 lines
#############################################################
## leveldb # #############################################################The ### lines should be 80-chars wide.
OK.
Quoted 8 lines
Quoted 6 lines
LEVELDB_VERSION= 1.18LEVELDB_SITE= https://github.com/google/leveldb/archive/LEVELDB_SOURCE= v$(LEVELDB_VERSION).tar.gzLEVELDB_LICENSE= BSD-3cLEVELDB_LICENSE_FILES= LICENSELEVELDB_INSTALL_STAGING= YESThere should be only one space before and after the equal sign.
OK (evil tabs...)
Quoted 4 lines
Quoted 3 lines
define
LEVELDB_BUILD_CMDS$(MAKE) -C $(@D) all
Quoted 8 lines
This won't work, because you forgot to pass the appropriate variables that contain the cross-compiler and compilation flags. This should be something like:
$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) all(You can omit 'all' if it is the default rule of the makefile, which it usually is.)
You're right, I hadn't got to that bit of the documentation yet.
Quoted 7 lines
Quoted 7 lines
endef
define
LEVELDB_INSTALL_TARGET_CMDS$(INSTALL) -D -m 0644 $(@D)/libleveldb.a $(TARGET_DIR)/usr/lib $(INSTALL) -D -m 0755 $(@D)/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib
Quoted 7 lines
Quoted 4 lines
$(HOSTLN) -sf $(TARGET_DIR)/usr/lib/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.so.1 $(HOSTLN) -sf $(TARGET_DIR)/usr/lib/libleveldb.so.1.18 $(TARGET_DIR)/usr/lib/libleveldb.soThe last three lines won;t work in case we are doing a static-only build, that is when
BR2_PREFER_STATIC_LIBis set.
Right. I think I get the idea now. Put static and dynamic libs into staging, dynamic libs only into target.
Quoted 8 lines
Quoted 2 lines
$(INSTALL) -d -m 0755 $(@D)/include/leveldb $(TARGET_DIR)/usr/include/leveldbWhat are you trying to do there? Are you trying to copy the directory $(@D)/include/leveldb and all its content over to $(TARGET_DIR)/usr/include/leveldb ?
If so, that's wrong. This should be installed in $(STAGING_DIR).
Yep, was my broken attempt to copy all the leveldb headers.
Quoted 3 lines
Basically, we put all that is needed for development (headers, .so symlinks, shared and/or static libraries) in $(STAGING_DIR), and all that is needed at runtime (shared libraries) in $(TARGET_DIR).
That's what I was missing before. RTFM, sorry.
Quoted 8 lines
Quoted 3 lines
endef
$(eval $(generic-package))
All the comments above are not in anyway a mean to turn down this patch, but are made so that the code we get in Buildroot meets our standards so that it is maintainable over the long run, and also so you can improve and gain some more knowledge of Buildroot internals.
No problem. I appreciate the attention to detail and thanks for the review.
Quoted 1 line
Care to address all the above and respin a new version, please?
It's on its way.
Quoted 4 lines
Thank you again for your contribution, it is much appreciated! :-)
Regards,
Yann E. MORIN.
And thanks for the welcome Yann,
Regards,
Steve.