pkg-cmake: allow to build package in a subdirectory
PATCH v7 1/3 pkg-cmake: allow to build package in a subdirectory
From: Gwenhael Goavec-Merou <[email protected]>
For some cmake based packages, like GNURadio, it's forbidden to do the compilation directly in the sources directory. This patch add a new variable to specify, if needed, the name of a sub-directory used to compile.
---
Changes v6 -> v7:
* move and reformulate LIBFOO_SUPPORTS_IN_SOURCE_BUILD description.
* adds default value to YES and test if _SUPPORT_IN_SOURCE_BUILD is equal to YES instead of NO
Changes v5 -> v6:
* s/, no/,NO/
* s/$$($(2)_SUPPORTS_IN_SOURCE_BUILD)/$$($(3)_SUPPORTS_IN_SOURCE_BUILD)/
Changes v4 -> v5:
* Instead of overloading BUILDDIR uses a variable to set if package is compiled in-source-tree or not
* update again manual
Changes v2 -> v3:
* Update docs to add detail about LIBFOO_BUILDDIR
Changes v1 -> v2:
* Allow to overload $(2)_BUILDDIR instead of adding a new variable and test
--- docs/manual/adding-packages-cmake.txt | 4 ++++ package/pkg-cmake.mk | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
docs/manual/adding-packages-cmake.txt +4 -0
@@ -100,6 +100,10 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: +* +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ should be set when the package + cannot be built inside the source tree but needs a separate build + directory. + ** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+;
package/pkg-cmake.mk +12 -2
@@ -61,7 +61,15 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +$(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES + + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES) $(2)_BUILDDIR = $$($(2)_SRCDIR) +else +$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +endif # # Configure step. Only define it if not already defined by the package
@@ -73,7 +81,8 @@ ifeq ($(4),target) # Configure package for target define $(2)_CONFIGURE_CMDS - (cd $$($$(PKG)_BUILDDIR) && \ + (mkdir -p $$($$(PKG)_BUILDDIR) && \ + cd $$($$(PKG)_BUILDDIR) && \ rm -f CMakeCache.txt && \ PATH=$$(BR_PATH) \ $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
@@ -98,7 +107,8 @@ else # Configure package for host define $(2)_CONFIGURE_CMDS - (cd $$($$(PKG)_BUILDDIR) && \ + (mkdir -p $$($$(PKG)_BUILDDIR) && \ + cd $$($$(PKG)_BUILDDIR) && \ rm -f CMakeCache.txt && \ PATH=$$(BR_PATH) \ $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
Signature · 1 line
2.0.5
PATCH v7 1/3 pkg-cmake: allow to build package in a subdirectory
2015-03-13 9:24 GMT+01:00 Gwenhael Goavec-Merou <[email protected]>:
Quoted 8 lines
From: Gwenhael Goavec-Merou <[email protected]>
For some cmake based packages, like GNURadio, it's forbidden to do the compilation directly in the sources directory. This patch add a new variable to specify, if needed, the name of a sub-directory used to compile.
Signed-off-by Gwenhael Goavec-Merou <[email protected]>
Quoted 77 lines
---
Changes v6 -> v7:
* move and reformulateLIBFOO_SUPPORTS_IN_SOURCE_BUILDdescription.
* adds default value to YES and test if_SUPPORT_IN_SOURCE_BUILDis equal to YES instead of NO
Changes v5 -> v6:
* s/, no/,NO/
* s/$$($(2)_SUPPORTS_IN_SOURCE_BUILD)/$$($(3)_SUPPORTS_IN_SOURCE_BUILD)/
Changes v4 -> v5:
* Instead of overloading BUILDDIR uses a variable to set if package is compiled in-source-tree or not
* update again manual
Changes v2 -> v3:
* Update docs to add detail aboutLIBFOO_BUILDDIR
Changes v1 -> v2:
* Allow to overload $(2)_BUILDDIR instead of adding a new variable and test--- docs/manual/adding-packages-cmake.txt | 4 ++++ package/pkg-cmake.mk | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)docs/manual/adding-packages-cmake.txt +4
-0@@ -100,6 +100,10 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: +* +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ should be set when the package + cannot be built inside the source tree but needs a separate build + directory. + ** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+;package/pkg-cmake.mk +12
-3@@ -61,7 +61,15 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +$(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES + + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES) $(2)_BUILDDIR = $$($(2)_SRCDIR) +else +$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +endif # # Configure step. Only define it if not already defined by the package@@ -73,7 +81,8 @@ ifeq ($(4),target) # Configure package for target define $(2)_CONFIGURE_CMDS - (cd $$($$(PKG)_BUILDDIR) && \ + (mkdir -p $$($$(PKG)_BUILDDIR) && \ + cd $$($$(PKG)_BUILDDIR) && \ rm -f CMakeCache.txt && \ PATH=$$(BR_PATH) \ $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \@@ -98,7 +107,8 @@ else # Configure package for host define $(2)_CONFIGURE_CMDS - (cd $$($$(PKG)_BUILDDIR) && \ + (mkdir -p $$($$(PKG)_BUILDDIR) && \ + cd $$($$(PKG)_BUILDDIR) && \ rm -f CMakeCache.txt && \ PATH=$$(BR_PATH) \ $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \ --
Quoted 1 line
2.0.5
Patch works for me and it's really appreciated cause I have several packages that doesn't build in source directory.
Quoted 5 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo
PATCH v7 2/3 python-cheetah: add host-package support
In reply to Gwenhael Goavec-MerouFrom: Gwenhael Goavec-Merou <[email protected]>
Some packages, like GNURadio for VOLK, needs cheetah on host at buildtime.
The dependency on host-python-markdown is needed to avoid that setuptools downloads markdown if it is not installed yet.
---
Changes v4 -> v7:
* reformulate commit message.
Changes v3 -> v4:
* use HOST_PYTHON_CHEETAH_DEPENDENCIES instead of PYTHON_CHEETAH_DEPENDENCIES
* suppress '+' for dependency definition
--- package/python-cheetah/python-cheetah.mk | 2 ++ 1 file changed, 2 insertions(+)
package/python-cheetah/python-cheetah.mk +2 -0
@@ -9,5 +9,7 @@ PYTHON_CHEETAH_SOURCE = Cheetah-$(PYTHON_CHEETAH_VERSION).tar.gz PYTHON_CHEETAH_SITE = http://pypi.python.org/packages/source/C/Cheetah PYTHON_CHEETAH_LICENSE = MIT PYTHON_CHEETAH_SETUP_TYPE = setuptools +HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown $(eval $(python-package)) +$(eval $(host-python-package))
Signature · 1 line
2.0.5
PATCH v7 2/3 python-cheetah: add host-package support
Dear Gwenhael Goavec-Merou,
package/python-cheetah/python-cheetah.mk PYTHON_CHEETAH_SOURCE = Cheetah-$(PYTHON_CHEETAH_VERSION).tar.gz · line 12
Quoted 9 lines · Gwenhael Goavec-Merou
package/python-cheetah/python-cheetah.mk +1
-0@@ -9,5 +9,7 @@ PYTHON_CHEETAH_SOURCE = Cheetah-$(PYTHON_CHEETAH_VERSION).tar.gz PYTHON_CHEETAH_SITE = http://pypi.python.org/packages/source/C/Cheetah PYTHON_CHEETAH_LICENSE = MIT PYTHON_CHEETAH_SETUP_TYPE = setuptools +HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown
I've added a comment in the .mk file above this line to explain this dependency (taken from your commit log), and applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v7 2/3 python-cheetah: add host-package support
In reply to Gwenhael Goavec-MerouDear Gwenhael Goavec-Merou,
package/python-cheetah/python-cheetah.mk PYTHON_CHEETAH_SOURCE = Cheetah-$(PYTHON_CHEETAH_VERSION).tar.gz · line 15
Quoted 12 lines · Gwenhael Goavec-Merou
package/python-cheetah/python-cheetah.mk +2
-0@@ -9,5 +9,7 @@ PYTHON_CHEETAH_SOURCE = Cheetah-$(PYTHON_CHEETAH_VERSION).tar.gz PYTHON_CHEETAH_SITE = http://pypi.python.org/packages/source/C/Cheetah PYTHON_CHEETAH_LICENSE = MIT PYTHON_CHEETAH_SETUP_TYPE = setuptools +HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown $(eval $(python-package)) +$(eval $(host-python-package))
host-python-cheetah is causing some build failures:
http://autobuild.buildroot.org/results/a1f/a1f0666b8c7e390b7edc99ab69af200bde9f5796/build-end.log.
Could you have a look?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v7 3/3 GNURadio: new package
In reply to Gwenhael Goavec-MerouFrom: Gwenhael Goavec-Merou <[email protected]>
---
Changes v6 -> v7:
* add detection boost unit_test_framework to avoid build failure if BUILD_TEST is set and unit_test_framework not available.
* comment indentation.
* Locally calculated sha256.
* suppress redundant comment.
* use hf/neon optimization only if target CPU is an ARMV7A and NEON available. Changes v5 -> v6:
* GNURADIO_SUPPORTS_IN_SOURCE_BUILD = no -> GNURADIO_SUPPORTS_IN_SOURCE_BUILD = NO Changes v4 -> v5:
* GNURadio -> gnuradio.
* help for all options.
* rename patch, add signed-off and a comment.
* dependencies comment.
* typo.
* better workaround to avoid compile fails when neon is enabled.
* indentation.
* better options handlings.
Changes v2 -> v3:
* move comment at the beginning of the file.
* add a patch to suppress boost-test dependency.
* move python dependencies in the specific option.
* use stable archive instead of git.
* add hook specific for ARM for using neon if available (without this hook volk fails to build).
Changes v1 -> v2:
* overload _BUILDDIR variable to specify build directory
--- package/Config.in | 1 + .../0001-suppress-boost_unitest-detection.patch | 40 +++++++++++++++ package/gnuradio/Config.in | 46 +++++++++++++++++ package/gnuradio/gnuradio.hash | 5 ++ package/gnuradio/gnuradio.mk | 58 ++++++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 package/gnuradio/0001-suppress-boost_unitest-detection.patch create mode 100644 package/gnuradio/Config.in create mode 100644 package/gnuradio/gnuradio.hash create mode 100644 package/gnuradio/gnuradio.mk
package/Config.in +1 -0
@@ -1044,6 +1044,7 @@ menu "Miscellaneous" source "package/clamav/Config.in" source "package/collectd/Config.in" source "package/empty/Config.in" + source "package/gnuradio/Config.in" source "package/googlefontdirectory/Config.in" source "package/haveged/Config.in" source "package/mcrypt/Config.in"
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +40 -0
@@ -0,0 +1,40 @@ +By default, the boost test option is mandatory for build environment +detection. +This patch suppress this dependency and allows the test part only if +build_test is enabled at the Buildroot level. + +Signed-off-by: Gwenhael Goavec-Merou <[email protected]> +--- +Index: gnuradio-3.7.5/volk/cmake/VolkBoost.cmake +=================================================================== +--- gnuradio-3.7.5.orig/volk/cmake/VolkBoost.cmake ++++ gnuradio-3.7.5/volk/cmake/VolkBoost.cmake +@@ -29,7 +29,6 @@ set(__INCLUDED_VOLK_BOOST_CMAKE TRUE) + set(BOOST_REQUIRED_COMPONENTS + filesystem + system +- unit_test_framework + program_options + ) + +Index: gnuradio-3.7.5/volk/lib/CMakeLists.txt +=================================================================== +--- gnuradio-3.7.5.orig/volk/lib/CMakeLists.txt ++++ gnuradio-3.7.5/volk/lib/CMakeLists.txt +@@ -540,8 +540,9 @@ endif(ENABLE_STATIC_LIBS) + # Build the QA test application + ######################################################################## + ++find_package(Boost "1.35" COMPONENTS "unit_test_framework") + +-if(Boost_FOUND) ++if(Boost_FOUND AND BUILD_TEST) + + set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIES +@@ -558,4 +559,4 @@ if(Boost_FOUND) + target_link_libraries(test_all volk ${Boost_LIBRARIES}) + add_test(qa_volk_test_all test_all) + +-endif(Boost_FOUND) ++endif(Boost_FOUND AND BUILD_TEST)
package/gnuradio/Config.in new file +46 -0
46 lines not on this page · raw message
package/gnuradio/gnuradio.hash new file +5 -0
@@ -0,0 +1,5 @@ +# From http://gnuradio.org/redmine/projects/gnuradio/files +md5 b4a917a548f41ce25c6c88f9bc864bca gnuradio-3.7.5.tar.gz + +# Locally calculated: +sha256 467f62190687a34f9faa18be8d650e28d7046b94070b1b6d94355c28beb76243 gnuradio-3.7.5.tar.gz
package/gnuradio/gnuradio.mk new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.0.5
PATCH v7 3/3 GNURadio: new package
Dear Gwenhael Goavec-Merou,
package/gnuradio/0001-suppress-boost_unitest-detection.patch line 16
Quoted 9 lines · Gwenhael Goavec-Merou
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +9
-0+Index: gnuradio-3.7.5/volk/cmake/VolkBoost.cmake +=================================================================== +--- gnuradio-3.7.5.orig/volk/cmake/VolkBoost.cmake ++++ gnuradio-3.7.5/volk/cmake/VolkBoost.cmake +@@ -29,7 +29,6 @@ set(__INCLUDED_VOLK_BOOST_CMAKE TRUE) + set(BOOST_REQUIRED_COMPONENTS + filesystem + system +- unit_test_framework
It will probably be needed to re-add this unit_test_framework dependency, but maybe only if BUILD_TEST is enabled, or something like that.
Quoted 14 lines
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +14
-0+ program_options + ) + +Index: gnuradio-3.7.5/volk/lib/CMakeLists.txt +=================================================================== +--- gnuradio-3.7.5.orig/volk/lib/CMakeLists.txt ++++ gnuradio-3.7.5/volk/lib/CMakeLists.txt +@@ -540,8 +540,9 @@ endif(ENABLE_STATIC_LIBS) + # Build the QA test application + ######################################################################## + ++find_package(Boost "1.35" COMPONENTS "unit_test_framework") + +-if(Boost_FOUND)
package/gnuradio/0001-suppress-boost_unitest-detection.patch line 40
Quoted 10 lines
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +10
-0++if(Boost_FOUND AND BUILD_TEST) + + set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIES +@@ -558,4 +559,4 @@ if(Boost_FOUND) + target_link_libraries(test_all volk ${Boost_LIBRARIES}) + add_test(qa_volk_test_all test_all) + +-endif(Boost_FOUND) ++endif(Boost_FOUND AND BUILD_TEST)
Can you please work with upstream to get this patch merged?
package/gnuradio/gnuradio.mk line 18
Quoted 5 lines
package/gnuradio/gnuradio.mk new file +5
-0+# host-python-cheetah is needed for volk to compile +GNURADIO_DEPENDENCIES = \ + host-python-cheetah \ + host-swig \ + boost
Indentation should be only one tab.
package/gnuradio/gnuradio.mk line 23
Quoted 4 lines
package/gnuradio/gnuradio.mk new file +4
-0+GNURADIO_CONF_OPTS = \ + -DENABLE_DEFAULT=OFF \ + -DENABLE_VOLK=ON \ + -DENABLE_GNURADIO_RUNTIME=ON
Ditto.
Committed with the indentation fixed.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v7 1/3 pkg-cmake: allow to build package in a subdirectory
In reply to Gwenhael Goavec-MerouHi Gwenhael, all,
Quoted 34 lines · Gwenhael Goavec-Merou
From: Gwenhael Goavec-Merou <[email protected]>
For some cmake based packages, like GNURadio, it's forbidden to do the compilation directly in the sources directory. This patch add a new variable to specify, if needed, the name of a sub-directory used to compile.
Signed-off-by Gwenhael Goavec-Merou <[email protected]>---
Changes v6 -> v7:
* move and reformulateLIBFOO_SUPPORTS_IN_SOURCE_BUILDdescription.
* adds default value to YES and test if_SUPPORT_IN_SOURCE_BUILDis equal to YES instead of NO
Changes v5 -> v6:
* s/, no/,NO/
* s/$$($(2)_SUPPORTS_IN_SOURCE_BUILD)/$$($(3)_SUPPORTS_IN_SOURCE_BUILD)/
Changes v4 -> v5:
* Instead of overloading BUILDDIR uses a variable to set if package is compiled in-source-tree or not
* update again manual
Changes v2 -> v3:
* Update docs to add detail aboutLIBFOO_BUILDDIR
Changes v1 -> v2:
* Allow to overload $(2)_BUILDDIR instead of adding a new variable and test--- docs/manual/adding-packages-cmake.txt | 4 ++++ package/pkg-cmake.mk | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)docs/manual/adding-packages-cmake.txt +0
-0
docs/manual/adding-packages-cmake.txt typical packages will therefore only use a few of them. · line 105
Quoted 6 lines
docs/manual/adding-packages-cmake.txt +3
-0@@ -100,6 +100,10 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: +* +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ should be set when the package + cannot be built inside the source tree but needs a separate build + directory.
hmm... _SUPPORTS_IN_SOURCE_BUILD semantically tells that the package can be built in its srctree but does not tell it will be, unlike how it is used in the Buildroot infra (below).
IMHO, i'd prefer _BUILD_IN_SRCTREE or something similar (e.g. _BUILD_IN_SRCDIR) that just tells what Buildroot should/must/will do.
Quoted 11 lines
docs/manual/adding-packages-cmake.txt +1
-0+ ** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+;package/pkg-cmake.mk +0
-0@@ -61,7 +61,15 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install
package/pkg-cmake.mk $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install · line 72
Quoted 10 lines
package/pkg-cmake.mk +8
-0$(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +$(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES + + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES) $(2)_BUILDDIR = $$($(2)_SRCDIR) +else +$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +endif
[...]
I know I'm late on this, and this is already the 7th iteration... so, except this nitpicking point, you have my:
Regards,
Signature · 1 line
Samuel
PATCH v7 1/3 pkg-cmake: allow to build package in a subdirectory
In reply to Gwenhael Goavec-MerouDear Gwenhael Goavec-Merou,
docs/manual/adding-packages-cmake.txt typical packages will therefore only use a few of them. · line 105
Quoted 11 lines · Gwenhael Goavec-Merou
docs/manual/adding-packages-cmake.txt +3
-0@@ -100,6 +100,10 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: +* +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ should be set when the package + cannot be built inside the source tree but needs a separate build + directory.
Did you generate the documentation to review what you did? This chunk was added right in the middle of the documentation of <pkg>_CONF_OPTS.
docs/manual/adding-packages-cmake.txt typical packages will therefore only use a few of them. · line 109
Quoted 4 lines
docs/manual/adding-packages-cmake.txt +1
-0+ ** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+;
I.e, this part must be right after <pkg>_CONF_OPTS.
I've fixed that and applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com