Skip to contentSkip to conversation

cmake: don't inherit autotools

PATCH In review Ross Burton 2 participants 7 messages Sep 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cmake: don't inherit autotools

cmake doesn't use autotools, the functions get replaced by either cmake.bbclass (target) or the recipe itself (native) leaving just lots of superfluous dependencies.

---
 meta/recipes-devtools/cmake/cmake-native_3.6.1.bb | 15 +++++++++++++++
 meta/recipes-devtools/cmake/cmake.inc             |  9 ---------
 2 files changed, 15 insertions(+), 9 deletions(-)
meta/recipes-devtools/cmake/cmake-native_3.6.1.bb +15 -0
index 33930fb..f3a485f 100644
@@ -8,6 +8,9 @@ SRC_URI += "\
     file://cmlibarchive-disable-ext2fs.patch \
 "
 
+B = "${WORKDIR}/build"
+do_configure[cleandirs] = "${B}"
+
 # Disable ccmake since we don't depend on ncurses
 CMAKE_EXTRACONF = "\
     -DBUILD_CursesDialog=0 \
@@ -15,4 +18,16 @@ CMAKE_EXTRACONF = "\
     -DHAVE_SYS_ACL_H=0 \
 "
 
+do_configure () {
+	${S}/configure --prefix=${prefix} -- ${CMAKE_EXTRACONF}
+}
+
+do_compile() {
+	oe_runmake
+}
+
+do_install() {
+	oe_runmake 'DESTDIR=${D}' install
+}
+
 do_compile[progress] = "percent"
meta/recipes-devtools/cmake/cmake.inc +0 -9
index 1f73b3a..4fcb0b1 100644
@@ -21,8 +21,6 @@ SRC_URI[sha256sum] = "28ee98ec40427d41a45673847db7a905b59ce9243bb866eaf59dce0f58
 
 UPSTREAM_CHECK_REGEX = "cmake-(?P<pver>\d+(\.\d+)+)\.tar"
 
-inherit autotools
-
 # Ugly hack to work around undefined OE_QMAKE_PATH_EXTERNAL_HOST_BINS variable
 # and possibly missing qmake binary (qtbase-native can be removed from sysroot
 # e.g. in order to upgrade it, even when there is target qtbase)
@@ -45,10 +43,3 @@ do_configure_prepend() {
 	sed -i 's/^  find_package(Qt5Widgets REQUIRED)/#  find_package(Qt5Widgets REQUIRED)/g' ${S}/Tests/QtAutogen/CMakeLists.txt
 	sed -i 's/^  find_package(Qt5Core REQUIRED)/#  find_package(Qt5Core REQUIRED)/g' ${S}/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
 }
-
-# Extra flags to pass to cmake invoked by bootstrap
-CMAKE_EXTRACONF = ""
-
-do_configure () {
-	${S}/configure --prefix=${prefix} -- ${CMAKE_EXTRACONF}
-}
Signature · 1 line
2.8.1
#1 lore raw

PATCH 2/3 cmake: use convenience options for clarity

The intention here was "everything but jsoncpp is system provided" so use the convenience option to ensure this remains true in the future.

---
 meta/recipes-devtools/cmake/cmake_3.6.1.bb | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
meta/recipes-devtools/cmake/cmake_3.6.1.bb +2 -7
index 2f188f0..67ba9c4 100644
@@ -25,13 +25,8 @@ python () {
 
 EXTRA_OECMAKE=" \
     -DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \
-    -DCMAKE_USE_SYSTEM_LIBRARY_BZIP2=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_CURL=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_FORM=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_LIBLZMA=1 \
-    -DCMAKE_USE_SYSTEM_LIBRARY_ZLIB=1 \
+    -DCMAKE_USE_SYSTEM_LIBRARIES=1 \
+    -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \
     -DKWSYS_CHAR_IS_SIGNED=1 \
     -DBUILD_CursesDialog=0 \
     ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '-DKWSYS_LFS_WORKS=1', '-DKWSYS_LFS_DISABLE=1', d)} \
Signature · 1 line
2.8.1
#6 lore raw

PATCH 3/3 cmake-native: rationalise system/internal library dependencies

In reply to Ross Burton

By default cmake will auto-detect if a library is present on the host and if it isn't present will use an internal fork. For some libraries using the internal fork is preferable as it can be built with less dependencies, but for others we're either already building it or the impact of building it is comparable to internal build.

Continue to use the internal fork of libarchive as our libarchive-native has a large number of build dependencies. Using the internal libarchive means that system bzip2 and zlib must be used.

Explicitly use the internal fork of jsoncpp as we don't have this in oe-core.

Explicitly depend on curl-native, expat-native, and xz-native to ensure these dependencies are not floating. curl-native is a non-trivial dependency but is comparable to building the internal fork, so there's no reason to build it twice.

Change bzip2-native to bzip2-replacement-native as bzip2-native is ASSUME_PROVIDED.

[ YOCTO #9639 ]

---
 meta/recipes-devtools/cmake/cmake-native_3.6.1.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-devtools/cmake/cmake-native_3.6.1.bb +4 -2
index f3a485f..a301ae6 100644
@@ -1,8 +1,7 @@
 require cmake.inc
 inherit native
 
-# Using cmake's internal libarchive, so some dependencies are needed
-DEPENDS += "bzip2-native zlib-native"
+DEPENDS += "bzip2-replacement-native expat-native xz-native zlib-native curl-native"
 
 SRC_URI += "\
     file://cmlibarchive-disable-ext2fs.patch \
@@ -14,6 +13,9 @@ do_configure[cleandirs] = "${B}"
 # Disable ccmake since we don't depend on ncurses
 CMAKE_EXTRACONF = "\
     -DBUILD_CursesDialog=0 \
+    -DCMAKE_USE_SYSTEM_LIBRARIES=1 \
+    -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \
+    -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 \
     -DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 \
     -DHAVE_SYS_ACL_H=0 \
 "
Signature · 1 line
2.8.1
#2 lore raw

Re: [PATCH 2/3] cmake: use convenience options for clarity

In reply to Ross Burton
Quoted 4 lines · Ross Burton

The intention here was "everything but jsoncpp is system provided" so use the convenience option to ensure this remains true in the future.

Why jsoncpp cannot be also linked?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#3 lore raw

Re: [PATCH 2/3] cmake: use convenience options for clarity

Quoted 2 lines · Otavio Salvador

Why jsoncpp cannot be also linked?

Because it's not in oe-core.

Ross

#4 lore raw

Re: [PATCH 2/3] cmake: use convenience options for clarity

Quoted 7 lines · Ross
Quoted 2 lines · Otavio Salvador

Why jsoncpp cannot be also linked?

Because it's not in oe-core.

Ok; but this means it should be right?

If so, we can work on a recipe for it. It is better to avoid bundled copies of recipe specially because security flaws...

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw

Re: [PATCH 2/3] cmake: use convenience options for clarity

Quoted 5 lines · Otavio Salvador

Ok; but this means it should be right?

If so, we can work on a recipe for it. It is better to avoid bundled copies of recipe specially because security flaws...

Nothing else wants it, cmake ships with its own trimmed copy. I'm not massively convinced it's worth the bother (especially now).

Ross