pkg-cmake: allow to build package in a subdirectory
PATCH v6 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 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 | 3 +++ package/pkg-cmake.mk | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
docs/manual/adding-packages-cmake.txt +3 -0
@@ -146,3 +146,6 @@ possible to customize what is done in any particular step: +LIBFOO_CONFIGURE_CMDS+ variable, it will be used instead of the default CMake one. However, using this method should be restricted to very specific cases. Do not use it in the general case. + +* By adding +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ when a package + prevents doing an in-source-tree build.
package/pkg-cmake.mk +9 -2
@@ -61,7 +61,12 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),NO) +$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +else $(2)_BUILDDIR = $$($(2)_SRCDIR) +endif # # Configure step. Only define it if not already defined by the package
@@ -73,7 +78,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 +104,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 v6 2/3 python-cheetah: add host-package support
From: Gwenhael Goavec-Merou <[email protected]>
Some packages, like GNURadio for VOLK, needs cheetah on host at buildtime.
HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown is needed to avoids setuptools downloads markdown if it can't be find it.
---
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 v6 2/3 python-cheetah: add host-package support
Quoted 6 lines · Gwenhael Goavec-Merou
From: Gwenhael Goavec-Merou <[email protected]>
Some packages, like GNURadio for VOLK, needs cheetah on host at buildtime.
HOST_PYTHON_CHEETAH_DEPENDENCIES= host-python-markdown is needed to avoids setuptools downloads markdown if it can't be find it.
If you do post a v7, please rephrase this:
The dependency on host-python-markdown is needed to avoid that setuptools downloads markdown if it is not installed yet.
Quoted 2 lines
Signed-off-by Gwenhael Goavec-Merou <[email protected]>
Regards,
Arnout
Quoted 21 lines
---
Changes v3 -> v4:
* useHOST_PYTHON_CHEETAH_DEPENDENCIESinstead ofPYTHON_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 · 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: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH v6 3/3 GNURadio: new package
In reply to Gwenhael Goavec-MerouFrom: Gwenhael Goavec-Merou <[email protected]>
---
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 | 32 ++++++++++++ package/gnuradio/Config.in | 46 +++++++++++++++++ package/gnuradio/gnuradio.hash | 2 + package/gnuradio/gnuradio.mk | 59 ++++++++++++++++++++++ 5 files changed, 140 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
@@ -1043,6 +1043,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 +32 -0
@@ -0,0 +1,32 @@ +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 +@@ -541,7 +541,7 @@ endif(ENABLE_STATIC_LIBS) + ######################################################################## + + +-if(Boost_FOUND) ++if(Boost_FOUND AND BUILD_TEST) + + set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIES
package/gnuradio/Config.in new file +46 -0
46 lines not on this page · raw message
package/gnuradio/gnuradio.hash new file +2 -0
@@ -0,0 +1,2 @@ +# From http://gnuradio.org/redmine/projects/gnuradio/files +md5 b4a917a548f41ce25c6c88f9bc864bca gnuradio-3.7.5.tar.gz
package/gnuradio/gnuradio.mk new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.0.5
PATCH v6 3/3 GNURadio: new package
Quoted 3 lines · Gwenhael Goavec-Merou
From: Gwenhael Goavec-Merou <[email protected]>
Signed-off-by Gwenhael Goavec-Merou <[email protected]>
Unfortunately I still have a few comments. But I think GNURadio is a really
useful package for buildroot (or vice versa :-).
Quoted 1 line
---
[snip]
Quoted 25 lines
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +19
-0@@ -0,0 +1,32 @@ +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 + ) +
package/gnuradio/0001-suppress-boost_unitest-detection.patch line 29
Quoted 10 lines
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +10
-0+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 +@@ -541,7 +541,7 @@ endif(ENABLE_STATIC_LIBS) + ######################################################################## + + +-if(Boost_FOUND) ++if(Boost_FOUND AND BUILD_TEST)
My CMake knowledge is a bit limited, but if boost's unit test framework is not
enabled and BUILD_TEST is, will this not give an error? For buildroot that's not so relevant because we never enable BUILD_TEST, but for upstreaming it is.
Quoted 9 lines
package/gnuradio/0001-suppress-boost_unitest-detection.patch new file +3
-0+ + set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc PROPERTIESpackage/gnuradio/Config.in new file +0
-0
package/gnuradio/Config.in line 5
Quoted 5 lines
package/gnuradio/Config.in new file +5
-0@@ -0,0 +1,46 @@ +comment "gnuradio needs a toolchain w/ C++, IPV6, threads, largefile, wchar" + depends on BR2_USE_MMU + depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \ + !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE || \ + !BR2_INET_IPV6
Two tabs is enough for the continued indentation.
Quoted 1 line
package/gnuradio/Config.in new file +1
-0+
[snip]
package/gnuradio/gnuradio.hash line 2
Quoted 8 lines
package/gnuradio/gnuradio.hash new file +2
-0@@ -0,0 +1,2 @@ +# From http://gnuradio.org/redmine/projects/gnuradio/files +md5 b4a917a548f41ce25c6c88f9bc864bca gnuradio-3.7.5.tar.gz
If upstream only provides md5, we usually add a locally-calculated sha256.
Quoted 8 lines
package/gnuradio/gnuradio.mk new file +2
-0@@ -0,0 +1,59 @@ +################################################################################ +#
package/gnuradio/gnuradio.mk line 12
Quoted 10 lines
package/gnuradio/gnuradio.mk new file +10
-0+# gnuradio +# +################################################################################ + +GNURADIO_VERSION = 3.7.5 +GNURADIO_SITE = http://gnuradio.org/redmine/attachments/download/792 +GNURADIO_LICENSE = GPLv3+ +GNURADIO_LICENSE_FILES = COPYING + +# gnuradio prevents doing an in-source-tree build
This comment is redundant, the variable explains it all.
package/gnuradio/gnuradio.mk line 18
Quoted 6 lines
package/gnuradio/gnuradio.mk new file +6
-0+GNURADIO_SUPPORTS_IN_SOURCE_BUILD = NO + +# host-python-cheetah is needed for volk to compile +GNURADIO_DEPENDENCIES = \ + host-python-cheetah \ + host-swig \
Isn't host-swig only needed when python is enabled? Or does volk also require it?
Quoted 8 lines
package/gnuradio/gnuradio.mk new file +8
-0+ boost + +GNURADIO_CONF_OPTS = \ + -DENABLE_DEFAULT=OFF \ + -DENABLE_VOLK=ON \ + -DENABLE_GNURADIO_RUNTIME=ON + +#For third-party blocks, the gnuradio libraries are mandatory at
package/gnuradio/gnuradio.mk line 36
Quoted 10 lines
package/gnuradio/gnuradio.mk new file +10
-0+# compile time. +GNURADIO_INSTALL_STAGING = YES + +# Yes, this is silly, because -march is already known by the compiler +# with the internal toolchain, and passed by the external wrapper for +# external toolchains. Nonetheless, gnuradio does some matching on the +# CFLAGS to decide whether to build the NEON functions or not, and +# wants to see the string 'armv7' in the CFLAGS. +ifeq ($(BR2_ARM_CPU_ARMV7A),y) +GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="-march=armv7-a"
Not all armv7 actually support NEON, so this should also be in the HAS_NEON
condition. So something like:
# Yes, this is silly, because -march is already known by the compiler
# with the internal toolchain, and passed by the external wrapper for # external toolchains. Nonetheless, gnuradio does some matching on the # CFLAGS to decide whether to build the NEON functions or not, and # wants to see the string 'armv7' in the CFLAGS. ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_ARM_CPU_HAS_NEON),yy) GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="-march=armv7-a" endif
package/gnuradio/gnuradio.mk line 43
Quoted 7 lines
package/gnuradio/gnuradio.mk new file +7
-0+endif + +# As soon as -mfpu=neon is supported by the compiler, gnuradio will try +# to use it. But having NEON support in the compiler doesn't necessarily +# mean we have NEON support in our CPU. +ifeq ($(BR2_ARM_CPU_HAS_NEON),) +GNURADIO_CONF_OPTS += -Dhave_mfpu_neon=0
I don't find anything that looks like this CMake variable in the source... Are
you sure it does anything?
Regards,
Arnout
Quoted 17 lines
package/gnuradio/gnuradio.mk new file +16
-0+endif + +ifeq ($(BR2_PACKAGE_GNURADIO_BLOCKS),y) +GNURADIO_CONF_OPTS += -DENABLE_GR_BLOCKS=ON +else +GNURADIO_CONF_OPTS += -DENABLE_GR_BLOCKS=OFF +endif + +ifeq ($(BR2_PACKAGE_GNURADIO_PYTHON),y) +GNURADIO_DEPENDENCIES += python +GNURADIO_CONF_OPTS += -DENABLE_PYTHON=ON +else +GNURADIO_CONF_OPTS += -DENABLE_PYTHON=OFF +endif + +$(eval $(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: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH v6 3/3 GNURadio: new package
Quoted 9 lines · On Thu, 12 Mar 2015 00:14:44 +0100 Arnout Vandecappelle <[email protected]> wrote:
Quoted 3 lines · Gwenhael Goavec-Merou
From: Gwenhael Goavec-Merou <[email protected]>
Signed-off-by Gwenhael Goavec-Merou <[email protected]>Unfortunately I still have a few comments. But I think GNURadio is a really
useful package for buildroot (or vice versa :-).Quoted 1 line
---
[snip]
Quoted 7 lines
package/gnuradio/gnuradio.mk line 18
Quoted 4 lines
package/gnuradio/gnuradio.mk new file +4
-0+# host-python-cheetah is needed for volk to compile +GNURADIO_DEPENDENCIES = \ + host-python-cheetah \ + host-swig \Isn't host-swig only needed when python is enabled? Or does volk also require it?
(host-)swig is only needed for the compilation. At runtime is no more needed.
Quoted 1 line
[snip]
Quoted 11 lines
package/gnuradio/gnuradio.mk line 43
Quoted 7 lines
package/gnuradio/gnuradio.mk new file +7
-0+endif + +# As soon as -mfpu=neon is supported by the compiler, gnuradio will try +# to use it. But having NEON support in the compiler doesn't necessarily +# mean we have NEON support in our CPU. +ifeq ($(BR2_ARM_CPU_HAS_NEON),) +GNURADIO_CONF_OPTS += -Dhave_mfpu_neon=0I don't find anything that looks like this CMake variable in the source... Are
you sure it does anything?
Yes, it disable all hf/neon optimization. If it is use unconditionnaly the previous WA is not needed but volk is not optimized for hf/neon.
Quoted 4 lines
Regards,
Arnout
Regards,
Gwen
PATCH v6 1/3 pkg-cmake: allow to build package in a subdirectory
In reply to Gwenhael Goavec-MerouQuoted 7 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]>
I still have improvements proposed below, but since this is already v6 and it's
pretty OK as it is I don't mind doing that in a follow-up patch. Gwenhael, if you do produce a v7, don't forget to keep my Reviewed-by.
Quoted 22 lines
---
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 | 3 +++ package/pkg-cmake.mk | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)docs/manual/adding-packages-cmake.txt +0
-0
docs/manual/adding-packages-cmake.txt possible to customize what is done in any particular step: · line 151
Quoted 6 lines
docs/manual/adding-packages-cmake.txt +3
-0@@ -146,3 +146,6 @@ possible to customize what is done in any particular step: +LIBFOO_CONFIGURE_CMDS+ variable, it will be used instead of the default CMake one. However, using this method should be restricted to very specific cases. Do not use it in the general case. + +* By adding +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ when a package + prevents doing an in-source-tree build.
This is not the right place for documenting this variable. It should be two
paragraphs higher, together with all the other variables. And then it should be reformulated like this:
* +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.
package/pkg-cmake.mk $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install · line 65
Quoted 10 lines
package/pkg-cmake.mk +2
-0@@ -61,7 +61,12 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),NO)
For all other variables like this (except _LIBTOOL_PATCH) we compare with YES,
not NO. So we should have:
$(2)_SUPPORTS_IN_SOURCE_BUILD ?= YES
ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
...
Regards,
Arnout
Quoted 28 lines
package/pkg-cmake.mk +7
-2+$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +else $(2)_BUILDDIR = $$($(2)_SRCDIR) +endif # # Configure step. Only define it if not already defined by the package@@ -73,7 +78,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 +104,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 · 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: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F