package/dtc: add option to install programs
authorYann E. MORIN <yann.morin.1998@free.fr>
Thu, 9 May 2013 12:22:59 +0000 (12:22 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 12 May 2013 21:49:04 +0000 (23:49 +0200)
By default, we only install the libfdt library.

As suggested by Arnout, add an option that also
installs the few dtc programs.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/dtc/Config.in
package/dtc/dtc.mk

index e1f6e86ded76ff78ccb8414e46195216b104099a..fac6ab2ea44bdd9961bca43122e2af69051c2ed4 100644 (file)
@@ -1,9 +1,33 @@
 config BR2_PACKAGE_DTC
-       bool "dtc"
+       bool "dtc (libfdt)"
        help
          The Device Tree Compiler, dtc, takes as input a device-tree in
          a given format and outputs a device-tree in another format.
 
-         Note that only the library is installed for now.
+         Note that only the library is installed.
+         If you want the programs, say 'y' here, and to "dtc programs", below.
 
          http://git.jdl.com/gitweb/?p=dtc.git  (no home page)
+
+if BR2_PACKAGE_DTC
+
+config BR2_PACKAGE_DTC_PROGRAMS
+       bool "dtc programs"
+       help
+         Say 'y' here if you also want the programs on the target:
+           - convert-dtsv0     convert from version 0 to version 1
+           - dtc               the device tree compiler
+           - dtdiff            compare two device trees (needs bash)
+           - fdtdump           print a readable version of a flat device tree
+           - fdtget            read values from device tree
+           - fdtput            write a property value to a device tree
+
+         Note: dtdiff requires bash, so if bash is not selected, dtdiff will
+               be removed from the target file system. Enable bash if you
+               need dtdiff on the target.
+
+comment "dtdiff will not be installed: it requires bash"
+       depends on BR2_PACKAGE_DTC_PROGRAMS
+       depends on !BR2_PACKAGE_BASH
+
+endif
index f05b09de2a9a697963af9a46a67078a5e7670fd7..76ff3617cf9da5b04c3b14419681ed894c2f5cbb 100644 (file)
@@ -8,26 +8,49 @@ DTC_VERSION         = e4b497f367a3b2ae99cc52089a14a221b13a76ef
 DTC_SITE            = git://git.jdl.com/software/dtc.git
 DTC_LICENSE         = GPLv2+/BSD-2c
 DTC_LICENSE_FILES   = README.license GPL
-# Note: the dual-license only applies to the library.
-#       The DT compiler (dtc) is GPLv2+, but we do not install it.
 DTC_INSTALL_STAGING = YES
 
+define DTC_POST_INSTALL_TARGET_RM_DTDIFF
+       rm -f $(TARGET_DIR)/usr/bin/dtdiff
+endef
+
+ifeq ($(BR2_PACKAGE_DTC_PROGRAMS),y)
+
+DTC_LICENSE        += (for the library), GPLv2+ (for the executables)
+# Use default goal to build everything
+DTC_BUILD_GOAL      =
+DTC_INSTALL_GOAL    = install
+DTC_CLEAN_GOAL      = clean
+ifeq ($(BR2_PACKAGE_BASH),)
+DTC_POST_INSTALL_TARGET_HOOKS += DTC_POST_INSTALL_TARGET_RM_DTDIFF
+endif
+
+else # $(BR2_PACKAGE_DTC_PROGRAMS) != y
+
+DTC_BUILD_GOAL      = libfdt
+# libfdt_install is our own install rule added by our patch
+DTC_INSTALL_GOAL    = libfdt_install
+DTC_CLEAN_GOAL      = libfdt_clean
+
+endif # $(BR2_PACKAGE_DTC_PROGRAMS) != y
+
 define DTC_BUILD_CMDS
        $(TARGET_CONFIGURE_OPTS)    \
-       $(MAKE) -C $(@D) PREFIX=/usr libfdt
+       CFLAGS="$(TARGET_CFLAGS)"   \
+       $(MAKE) -C $(@D) PREFIX=/usr $(DTC_BUILD_GOAL)
 endef
 
-# libfdt_install is our own install rule added by our patch
+# For staging, only the library is needed
 define DTC_INSTALL_STAGING_CMDS
        $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr libfdt_install
 endef
 
 define DTC_INSTALL_TARGET_CMDS
-       $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr libfdt_install
+       $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
 endef
 
 define DTC_CLEAN_CMDS
-       $(MAKE) -C $(@D) libfdt_clean
+       $(MAKE) -C $(@D) $(DTC_CLEAN_GOAL)
 endef
 
 $(eval $(generic-package))