Skip to contentSkip to conversation

pkg-cmake: allow to build package in a subdirectory

PATCH Superseded Gwenhael Goavec-Merou 2 participants 8 messages Mar 4, 2015 – Mar 5, 2015

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 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 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 | 7 ++++++-
 package/pkg-cmake.mk                  | 8 +++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
docs/manual/adding-packages-cmake.txt +6 -1
index d92b209..05738f0 100644
@@ -79,7 +79,7 @@ First, all the package metadata information variables that exist in
 the generic infrastructure also exist in the CMake infrastructure:
 +LIBFOO_VERSION+, +LIBFOO_SOURCE+, +LIBFOO_PATCH+, +LIBFOO_SITE+,
 +LIBFOO_SUBDIR+, +LIBFOO_DEPENDENCIES+, +LIBFOO_INSTALL_STAGING+,
-+LIBFOO_INSTALL_TARGET+.
++LIBFOO_INSTALL_TARGET+, +LIBFOO_BUILDDIR+.
 
 A few additional variables, specific to the CMake infrastructure, can
 also be defined. Many of them are only useful in very specific cases,
@@ -91,6 +91,11 @@ typical packages will therefore only use a few of them.
   the tree extracted by the tarball. If +HOST_LIBFOO_SUBDIR+ is not
   specified, it defaults to +LIBFOO_SUBDIR+.
 
+* +LIBFOO_BUILDDIR+ may overload the default build directory when a
+  package prevents from in-source-tree build. For example,
+  FOO_BUILDDIR = $(FOO_SRCDIR)/.build, will be used to compile foo
+  package in .build subdirectory.
+
 * +LIBFOO_CONF_ENV+, to specify additional environment variables to
   pass to CMake. By default, empty.
 
package/pkg-cmake.mk +5 -3
index 2404c40..c50039d 100644
@@ -61,7 +61,7 @@ $(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install
 $(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install
 
 $(2)_SRCDIR			= $$($(2)_DIR)/$$($(2)_SUBDIR)
-$(2)_BUILDDIR			= $$($(2)_SRCDIR)
+$(2)_BUILDDIR			?= $$($(2)_SRCDIR)
 
 #
 # Configure step. Only define it if not already defined by the package
@@ -73,7 +73,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 +99,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
#1 lore raw

PATCH v3 2/4 python-markdown: add host-package support

From: Gwenhael Goavec-Merou <[email protected]>

Host-cheetah needs host-markdown.

---
 package/python-markdown/python-markdown.mk | 1 +
 1 file changed, 1 insertion(+)
package/python-markdown/python-markdown.mk +1 -0
index 864825e..3b2217e 100644
@@ -12,3 +12,4 @@ PYTHON_MARKDOWN_LICENSE_FILES = LICENSE.md
 PYTHON_MARKDOWN_SETUP_TYPE = distutils
 
 $(eval $(python-package))
+$(eval $(host-python-package))
Signature · 1 line
2.0.5
#2 lore raw

PATCH v3 2/4 python-markdown: add host-package support

Dear Gwenhael Goavec-Merou,

Quoted 8 lines · Gwenhael Goavec-Merou

From: Gwenhael Goavec-Merou <[email protected]>

Host-cheetah needs host-markdown.

---
 package/python-markdown/python-markdown.mk | 1 +
 1 file changed, 1 insertion(+)

Applied, thanks!

Thomas

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

PATCH v3 3/4 python-cheetah: add host-package support

In reply to Gwenhael Goavec-Merou

From: Gwenhael Goavec-Merou <[email protected]>

Some packages, like GNURadio for VOLK, needs cheetah on host at buildtime.

---
 package/python-cheetah/python-cheetah.mk | 2 ++
 1 file changed, 2 insertions(+)
package/python-cheetah/python-cheetah.mk +2 -0
index 08076b5..faf2436 100644
@@ -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
+PYTHON_CHEETAH_DEPENDENCIES += host-python-markdown
 
 $(eval $(python-package))
+$(eval $(host-python-package))
Signature · 1 line
2.0.5
#4 lore raw

PATCH v3 3/4 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
index 08076b5..faf2436 100644
@@ -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
+PYTHON_CHEETAH_DEPENDENCIES += host-python-markdown

Are you sure you need to add host-python-markdown as a dependency to the target python-cheetah package ? I.e, I'd like to understand if what you need is:

PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown

(i.e adds host-python-markdown to the dependencies of both python-cheetah and host-python-cheetah)

*OR*

PYTHON_CHEETAH_DEPENDENCIES = python-markdown

(i.e adds python-markdown to the dependencies of python-cheetah, and host-python-markdown to the dependencies of host-python-cheetah)

*OR*

HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown

(i.e adds host-python-markdown to the dependencies of host-python-cheetah)

Also, use '=' and not '+=' in such situations.

Thanks!

Thomas

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

PATCH v3 3/4 python-cheetah: add host-package support

Dear Thomas Petazzoni

Quoted 30 lines · On Wed, 4 Mar 2015 22:49:40 +0100 Thomas Petazzoni…

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
index 08076b5..faf2436 100644
@@ -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
+PYTHON_CHEETAH_DEPENDENCIES += host-python-markdown

Are you sure you need to add host-python-markdown as a dependency to the target python-cheetah package ? I.e, I'd like to understand if what you need is:

PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown

(i.e adds host-python-markdown to the dependencies of both python-cheetah and host-python-cheetah)

*OR*

PYTHON_CHEETAH_DEPENDENCIES = python-markdown

(i.e adds python-markdown to the dependencies of python-cheetah, and host-python-markdown to the dependencies of host-python-cheetah)

Quoted 7 lines

*OR*

HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown

(i.e adds host-python-markdown to the dependencies of host-python-cheetah)

I'm wrong, it's true, host-python-markdown is only needed for host-python-cheetah. I think the best solution is the second option, ie. PYTHON_CHEETAH_DEPENDENCIES = python-markdown to be sure to have the correct dependency in all case (although python-cheetah as not really needed to python-markdown to be compiles).

Quoted 10 lines

Also, use '=' and not '+=' in such situations.

Thanks!

Thomas

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

Regards
Gwen

#6 lore raw

PATCH v3 3/4 python-cheetah: add host-package support

Hello,

Quoted 5 lines · gwenhael.goavec

I'm wrong, it's true, host-python-markdown is only needed for host-python-cheetah. I think the best solution is the second option, ie. PYTHON_CHEETAH_DEPENDENCIES = python-markdown to be sure to have the correct dependency in all case (although python-cheetah as not really needed to python-markdown to be compiles).

If only host-python-markdown is needed to build host-python-cheetah, then the correct solution is:

HOST_PYTHON_CHEETAH_DEPENDENCIES = host-python-markdown

Best regards,

Thomas

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

PATCH v3 4/4 GNURadio: new package

In reply to Gwenhael Goavec-Merou

From: Gwenhael Goavec-Merou <[email protected]>

---
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 +
 package/gnuradio/Config.in                         | 42 +++++++++++++++++++++
 ...dio-0001-suppress-boost_unitest-detection.patch | 44 ++++++++++++++++++++++
 package/gnuradio/gnuradio.hash                     |  2 +
 package/gnuradio/gnuradio.mk                       | 39 +++++++++++++++++++
 5 files changed, 128 insertions(+)
 create mode 100644 package/gnuradio/Config.in
 create mode 100644 package/gnuradio/gnuradio-0001-suppress-boost_unitest-detection.patch
 create mode 100644 package/gnuradio/gnuradio.hash
 create mode 100644 package/gnuradio/gnuradio.mk
package/Config.in +1 -0
index ba45f32..2e167d5 100644
@@ -1041,6 +1041,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/Config.in new file +42 -0

42 lines not on this page · raw message

package/gnuradio/gnuradio-0001-suppress-boost_unitest-detection.patch new file +44 -0

44 lines not on this page · raw message

package/gnuradio/gnuradio.hash new file +2 -0
new file mode 100644
index 0000000..a25b466
@@ -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 +39 -0
new file mode 100644
index 0000000..4528e55
@@ -0,0 +1,39 @@
+################################################################################
+#
+# gnuradio
+#
+################################################################################
+
+GNURADIO_VERSION = 3.7.5
+GNURADIO_SITE = http://gnuradio.org/redmine/attachments/download/792
+GNURADIO_SOURCE = gnuradio-$(GNURADIO_VERSION).tar.gz
+GNURADIO_LICENSE = GPLv3+
+GNURADIO_LICENSE_FILES = COPYING
+
+# gnuradio prevent from in-source-tree build
+GNURADIO_BUILDDIR = $(GNURADIO_SRCDIR)/build
+
+#needed for volk compile
+GNURADIO_DEPENDENCIES += host-python-cheetah
+GNURADIO_DEPENDENCIES += host-swig host-boost boost
+
+GNURADIO_DEPENDENCIES += $(if $(BR2_PACKAGE_GNURADIO_PYTHON),python)
+
+GNURADIO_INSTALL_STAGING = YES
+
+GNURADIO_CONF_OPTS += -DENABLE_DEFAULT=OFF -DENABLE_TESTING=OFF
+GNURADIO_CONF_OPTS += -DENABLE_VOLK=ON -DENABLE_GNURADIO_RUNTIME=ON
+ifeq ($(BR2_arm),y)
+ifeq ($(BR2_ARM_CPU_HAS_NEON)$(BR2_ARM_EABIHF),yy)
+GNURADIO_MTUNE = $(call qstrip,$(BR2_GCC_TARGET_CPU))
+GNURADIO_CONF_OPTS += -DCMAKE_C_FLAGS="-mfloat-abi=hard -mfpu=neon -march=armv7-a -mtune=$(GNURADIO_MTUNE)"
+GNURADIO_CONF_OPTS += -DCMAKE_ASM_FLAGS="-mfpu=neon -mfloat-abi=hard -march=armv7-a"
+else
+GNURADIO_CONF_OPTS += -Dhave_mfpu_neon=0
+endif
+endif
+
+GNURADIO_CONF_OPTS += -DENABLE_GR_BLOCKS=$(if $(BR2_PACKAGE_GNURADIO_BLOCKS),ON,OFF)
+GNURADIO_CONF_OPTS += -DENABLE_PYTHON=$(if $(BR2_PACKAGE_GNURADIO_PYTHON),ON,OFF)
+
+$(eval $(cmake-package))
Signature · 1 line
2.0.5