[meta-freescale] [PATCH] mfgtools: add recipe

Stefan Agner stefan at agner.ch
Mon Jun 17 00:18:20 PDT 2019


Hi Ming,

Thanks for tackling this.

On 15.06.2019 12:42, liu.ming50 at gmail.com wrote:
> From: Ming Liu <liu.ming50 at gmail.com>
> 
> Freescale/NXP I.MX Chip image deploy tools, uuu (Universal Update
> Utility), mfgtools 3.0.
> 
> Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
> ---
>  .../0001-CMakeLists.txt-fix-libzip-name.patch      | 54 ++++++++++++++++++++++
>  ...MakeLists.txt-support-building-static-uuu.patch | 32 +++++++++++++
>  recipes-bsp/mfgtools/mfgtools_git.bb               | 31 +++++++++++++
>  3 files changed, 117 insertions(+)
>  create mode 100644
> recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-fix-libzip-name.patch
>  create mode 100644
> recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-support-building-static-uuu.patch
>  create mode 100644 recipes-bsp/mfgtools/mfgtools_git.bb
> 
> diff --git
> a/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-fix-libzip-name.patch
> b/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-fix-libzip-name.patch
> new file mode 100644
> index 0000000..03f68a5
> --- /dev/null
> +++ b/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-fix-libzip-name.patch
> @@ -0,0 +1,54 @@
> +From b11bd93be67c5ad92e279f071a812234486c128b Mon Sep 17 00:00:00 2001
> +From: Ming Liu <liu.ming50 at gmail.com>
> +Date: Thu, 13 Jun 2019 16:52:45 +0200
> +Subject: [PATCH] CMakeLists.txt: fix libzip name
> +
> +Change libzip -> zlib, this is needed for building with OE.
> +
> +Upstream-Status: Inappropriate [oe specific]
> +
> +Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
> +---
> + libuuu/CMakeLists.txt | 2 +-
> + uuu/CMakeLists.txt    | 5 ++---
> + 2 files changed, 3 insertions(+), 4 deletions(-)
> +
> +diff --git a/libuuu/CMakeLists.txt b/libuuu/CMakeLists.txt
> +index 740d7ed..30324d0 100644
> +--- a/libuuu/CMakeLists.txt
> ++++ b/libuuu/CMakeLists.txt
> +@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
> + 
> + find_package(PkgConfig REQUIRED)
> + pkg_check_modules(LIBUSB REQUIRED libusb-1.0>=1.0.16)
> +-pkg_check_modules(LIBZIP REQUIRED libzip)
> ++pkg_check_modules(LIBZIP REQUIRED zlib)
> + find_package(Threads)
> + 
> + include_directories(${LIBUSB_INCLUDE_DIRS} include)
> +diff --git a/uuu/CMakeLists.txt b/uuu/CMakeLists.txt
> +index a2d8c87..1ca8013 100644
> +--- a/uuu/CMakeLists.txt
> ++++ b/uuu/CMakeLists.txt
> +@@ -5,8 +5,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
> + 
> + find_package(PkgConfig REQUIRED)
> + pkg_check_modules(LIBUSB REQUIRED libusb-1.0>=1.0.16)
> +-pkg_check_modules(LIBZIP REQUIRED libzip)
> +-pkg_check_modules(LIBZ REQUIRED zlib)
> ++pkg_check_modules(LIBZIP REQUIRED zlib)
> + find_package(Threads)
> + 
> + 
> +@@ -27,7 +26,7 @@ set(LSTS
> + 	sd_burn_all.lst
> + )
> + 
> +-link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libuuu
> ${LIBUSB_LIBRARY_DIRS} ${LIBZIP_LIBRARY_DIRS} ${LIBZ_LIBRARY_DIRS})
> ++link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libuuu
> ${LIBUSB_LIBRARY_DIRS} ${LIBZIP_LIBRARY_DIRS})
> + 
> + set(CLIST_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/gen_txt_include.sh)
> + set(generated_files_dir "${CMAKE_BINARY_DIR}/uuu/gen")
> +-- 
> +2.7.4
> +
> diff --git
> a/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-support-building-static-uuu.patch
> b/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-support-building-static-uuu.patch
> new file mode 100644
> index 0000000..bb69c87
> --- /dev/null
> +++
> b/recipes-bsp/mfgtools/mfgtools/0001-CMakeLists.txt-support-building-static-uuu.patch
> @@ -0,0 +1,32 @@
> +From 2ccb6fa0ae52981c78f79afa7009ccab11c6703f Mon Sep 17 00:00:00 2001
> +From: Ming Liu <liu.ming50 at gmail.com>
> +Date: Sat, 15 Jun 2019 05:18:10 +0800
> +Subject: [PATCH] CMakeLists.txt: support building static uuu
> +
> +Upstream-Status: Inappropriate [oe specific]
> +
> +Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
> +---
> + CMakeLists.txt | 6 ++++++
> + 1 file changed, 6 insertions(+)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 302f8cb..f23871e 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -4,6 +4,12 @@ set(CMAKE_CXX_STANDARD 11)
> + set(CMAKE_CXX_STANDARD_REQUIRED ON)
> + 
> + option(BUILD_DOC "Build documentation" OFF)
> ++option(BUILD_STATIC "Build static uuu binary" OFF)
> ++
> ++if (BUILD_STATIC)
> ++	set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
> ++	set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++")
> ++endif (BUILD_STATIC)
> + 
> + add_subdirectory(libuuu)
> + add_subdirectory(uuu)
> +-- 
> +2.7.4
> +
> diff --git a/recipes-bsp/mfgtools/mfgtools_git.bb
> b/recipes-bsp/mfgtools/mfgtools_git.bb
> new file mode 100644
> index 0000000..4ba6065
> --- /dev/null
> +++ b/recipes-bsp/mfgtools/mfgtools_git.bb
> @@ -0,0 +1,31 @@
> +SUMMARY = "uuu (Universal Update Utility), mfgtools 3.0"
> +DESCRIPTION = "Freescale/NXP I.MX Chip image deploy tools, uuu
> (Universal Update Utility), mfgtools 3.0."
> +HOMEPAGE = "https://github.com/NXPmicro/mfgtools"
> +SECTION = "devel"
> +LICENSE = "BSD"
> +LIC_FILES_CHKSUM = "file://README.md;md5=653656dfc74a26684d74346214abe93a"
> +
> +SRC_URI = "gitsm://github.com/NXPmicro/mfgtools;branch=master \
> +           file://0001-CMakeLists.txt-fix-libzip-name.patch \
> +           file://0001-CMakeLists.txt-support-building-static-uuu.patch \
> +          "
> +
> +# uuu_1.2.91
> +SRCREV = "3799f4d7b0464cc9253b4597ba7ccc54deefca20"
> +
> +PV = "1.2.91+git${SRCPV}"
> +
> +S = "${WORKDIR}/git"
> +
> +DEPENDS = "libusb1 zlib bzip2"
> +
> +inherit pkgconfig cmake
> +
> +PACKAGECONFIG ??= "static"

We use a static build to create a binary which is rather easy to run on
a variety of new and old distributions, but not sure if that is the
default use case.

I would rather prefer if we enable this package config in a local
bbappend or similar and leave it non-static by default.


We might even argue whether compiling statically is something an
upstream recipe should provide. But I leave that decision up to the
maintainers...

--
Stefan

> +PACKAGECONFIG[doc] = "-DBUILD_DOC=ON,-DBUILD_DOC=OFF,doxygen-native"
> +PACKAGECONFIG[static] = "-DBUILD_STATIC=ON,-DBUILD_STATIC=OFF"
> +
> +# Do not set RPATH if static build is intended.
> +OECMAKE_RPATH_forcevariable = "${@bb.utils.contains('PACKAGECONFIG',
> 'static', '', '${libdir}', d)}"
> +
> +BBCLASSEXTEND = "native"
> -- 
> 2.7.4


More information about the meta-freescale mailing list