Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: "Alexander V. Tikhonov" <avtikhon@tarantool.org>,
	Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 2/2] build: update CMake minimum version to 3.1
Date: Mon, 25 Jan 2021 22:14:43 +0300	[thread overview]
Message-ID: <29585e5741c0a249e7dafdb2efa60ba9e583eedf.1611598362.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1611598362.git.imun@tarantool.org>

In scope of implementing self-sufficient testing environment LuaJIT
build system is partially ported to CMake. While integrating the new
build system with Tarantool it was found (on practice of course) that
using generator expressions[1] in target DEPENDS section is introduced
only in CMake 3.1[2]. This CMake feature is used to pass so called
"LuaJIT binary" to be used in LuaJIT tests, so one can run the same
testing machinery with both Tarantool and LuaJIT with no changes in it.

[1]: https://cmake.org/cmake/help/v3.1/manual/cmake-generator-expressions.7.html
[2]: https://cmake.org/cmake/help/latest/release/3.1.html#commands

Relates to #4862

Signed-off-by: Igor Munkin <imun@tarantool.org>

@TarantoolBot document
Title: Update CMake minimum required version in build documentation

This commit updates the CMake minimum required version to be used in
Tarantool build infrastructure. However, one can build Tarantool from
sources and the required toolchain list should be updated. CMake minimum
required version is 3.1 since this commit. See the commit message for
more info.

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 debian/control     |  9 ++++++++-
 rpm/tarantool.spec | 30 +++++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index 8be2e9d01..ce810ee67 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,14 @@ Uploaders: Dmitry E. Oboukhov <unera@debian.org>
 Build-Depends: cdbs (>= 0.4.100), debhelper (>= 9), dpkg-dev (>= 1.16.1~),
 # Enable systemd for Debian Jessie+ and Ubuntu Wily+
  debhelper (>= 9.20160709) | dh-systemd (>= 1.22) | sysvinit (<< 2.88dsf-59) | upstart (<< 1.13),
- cmake,
+# XXX: This is a tiny hack to support Tarantool build on the old
+# distributions (e.g. Ubuntu Trusty Tahr) providing CMake 3+ via
+# cmake3 package that conflicts and replaces cmake package (that
+# provides CMake 2.18). Alternatives resolution order allows to
+# make package manager seek for cmake3 package at first and use it
+# if found or fallback to cmake package (that provides CMake 3+
+# for modern distributions) otherwise.
+ cmake3 (>= 3.1) | cmake (>= 3.1),
  libreadline-dev,
  libncurses5-dev,
  libssl-dev,
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index 8ba14d4d0..ffd161862 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -5,7 +5,24 @@
 %bcond_with systemd
 %endif
 
-BuildRequires: cmake >= 2.8
+# XXX: There is an old CMake (2.8.12) provided by cmake package in
+# main CentOS 7 repositories. At the same time, there is a newer
+# package cmake3 providing CMake 3+ from EPEL repository. So, one
+# need to use cmake3 package to build Tarantool on old systems.
+%define use_cmake3 0%{?rhel} == 7
+
+%if %use_cmake3
+# XXX: Unfortunately there is no way to make rpmbuild install and
+# enable EPEL repository prior to the build step. However, the
+# requirement below obligues user to enable EPEL by himself,
+# otherwise this dependency is left unmet. If there are any issues
+# with building an RPM package on RHEL/CentOS 7 read the docs:
+# https://www.tarantool.io/en/doc/latest/dev_guide/building_from_source/
+BuildRequires: cmake3 >= 3.1
+%else
+BuildRequires: cmake >= 3.1
+%endif
+
 BuildRequires: make
 %if (0%{?fedora} >= 22 || 0%{?rhel} >= 7 || 0%{?sle_version} >= 1500)
 BuildRequires: gcc >= 4.5
@@ -115,7 +132,7 @@ Requires: openssl
 # RHEL <= 7 doesn't support Recommends:
 Recommends: tarantool-devel
 Recommends: git-core
-Recommends: cmake >= 2.8
+Recommends: cmake >= 3.1
 Recommends: make
 Recommends: gcc >= 4.5
 Recommends: gcc-c++ >= 4.5
@@ -154,7 +171,14 @@ C and Lua/C modules.
 # 2. -DENABLE_LTO=ON
 #    because for now LTO flags are set in CC/LD flags by default:
 #      '-flto=auto -ffat-lto-objects'
-%cmake -B . \
+# XXX: KISS, please. I can play with RPM macros to redefine cmake
+# macro for cmake3 usage, but it totally doesn't worth it.
+%if %use_cmake3
+%cmake3 \
+%else
+%cmake \
+%endif
+       -B . \
          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
          -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=%{_localstatedir} \
          -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
-- 
2.25.0


  parent reply	other threads:[~2021-01-25 19:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 19:14 [Tarantool-patches] [PATCH v2 0/2] Update CMake minimum version in Tarantool Igor Munkin via Tarantool-patches
2021-01-25 19:14 ` [Tarantool-patches] [PATCH v2 1/2] github-ci: purge Debian Jessie from CI Igor Munkin via Tarantool-patches
2021-01-25 19:14 ` Igor Munkin via Tarantool-patches [this message]
2021-01-25 19:47 ` [Tarantool-patches] [PATCH v2 0/2] Update CMake minimum version in Tarantool Alexander V. Tikhonov via Tarantool-patches
2021-01-25 20:23   ` Igor Munkin via Tarantool-patches
2021-01-27 13:09 ` Kirill Yukhin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29585e5741c0a249e7dafdb2efa60ba9e583eedf.1611598362.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] build: update CMake minimum version to 3.1' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox