Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Alexander Turenko <alexander.turenko@tarantool.org>,
	"Alexander V. Tikhonov" <avtikhon@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 2/2] build: update CMake minimal version to 3.1
Date: Wed, 20 Jan 2021 21:19:47 +0300	[thread overview]
Message-ID: <4cb3d48dc4640e7e2c73da66dc1e4586a4f76e02.1611149713.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1611149713.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 minimal required version in build documentation

This commit updates the CMake minimal 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 minimal
required version is 3.1 since this commit. See the commit message for
more info.
---
 debian/control     |  9 ++++++++-
 rpm/tarantool.spec | 33 ++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index 38d0ba731..0741e91f8 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 it 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 aae60f8dc..4167ca480 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -5,7 +5,28 @@
 %bcond_with systemd
 %endif
 
-BuildRequires: cmake >= 2.8
+# XXX: There is an old CMake (2.8.12) provided by cmake package in
+# main CentOS repositories for distributions older than CentOS 7
+# (inclusively). At the same time, there is a newer package cmake3
+# providing CMake 3+ from EPEL repository. Ergo, one need to use
+# cmake3 package to build Tarantool on old systems.
+# FIXME: Make the condition simpler after CentOS 6 is purged from
+# Tarantool infrastructure.
+%define use_cmake3 %{?rhel:%{rhel}}%{!?rhel:9999} <= 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 6 and RHEL/CentOS 7
+# proceed to 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)
 # RHEL 6 requires devtoolset
@@ -115,7 +135,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
@@ -147,7 +167,14 @@ C and Lua/C modules.
 
 %build
 # RHBZ #1301720: SYSCONFDIR an LOCALSTATEDIR must be specified explicitly
-%cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+# 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
+       . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
          -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=%{_localstatedir} \
          -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
 %if %{with backtrace}
-- 
2.25.0


  parent reply	other threads:[~2021-01-20 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 18:19 [Tarantool-patches] [PATCH 0/2] Update CMake minimal version in Tarantool Igor Munkin via Tarantool-patches
2021-01-20 18:19 ` [Tarantool-patches] [PATCH 1/2] gitlab-ci: purge Debian Jessie from CI Igor Munkin via Tarantool-patches
2021-01-20 18:19 ` Igor Munkin via Tarantool-patches [this message]
2021-01-21  0:48   ` [Tarantool-patches] [PATCH 2/2] build: update CMake minimal version to 3.1 Igor Munkin via Tarantool-patches
2021-01-20 18:42 ` [Tarantool-patches] [PATCH 0/2] Update CMake minimal version in Tarantool Igor Munkin via Tarantool-patches
2021-01-25 19:21 ` Igor Munkin 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=4cb3d48dc4640e7e2c73da66dc1e4586a4f76e02.1611149713.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=imun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] build: update CMake minimal 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