File cmake.spec of Package cmake
#
# spec file for package cmake
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Distro specific switches
%define use_devtoolset 0
%if 0%{?el6} || 0%{?el7}
%if ! 0%{?rhel_version} || 0%{?rhel_version} == 600
%define use_devtoolset 1
%endif
%endif
%if 0%{?rhel_version} == 600
# default to plain patch
%define __scm patch
# Plain patch (-m is unused)
%define __scm_setup_patch(q) %{nil}
%define __scm_apply_patch(qp:m:)\
%{__patch} %{-p:-p%{-p*}} %{-q:-s}
# Single patch application
%define apply_patch(qp:m:)\
%{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
# Automatically apply all patches
%define autopatch(vp:)\
%{lua:\
for i, p in ipairs(patches) do\
print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")..p.."\\n"))\
end}
%endif
%define shortversion 3.10
Name: cmake
Version: 3.10.1
Release: 0
Summary: Cross-platform, open-source make system
License: BSD-3-Clause
Group: Development/Tools/Building
Url: http://www.cmake.org/
Source0: http://www.cmake.org/files/v%{shortversion}/%{name}-%{version}.tar.gz
Source1: cmake.macros
# bnc#947585 - Let CMake produces automatic RPM provides
Source3: cmake.attr
Source4: cmake.prov
Source5: http://www.cmake.org/files/v%{shortversion}/%{name}-%{version}-SHA-256.txt
Source6: http://www.cmake.org/files/v%{shortversion}/%{name}-%{version}-SHA-256.txt.asc
Source7: cmake.keyring
Patch2: cmake-fix-ruby-test.patch
# PATCH-FIX-UPSTREAM form.patch -- set the correct include path for the ncurses includes
Patch4: form.patch
# PATCH-FIX-UPSTREAM system-libs.patch -- allow choosing between bundled and system jsoncpp & form libs
Patch5: system-libs.patch
Patch6: cmake-3.10.1_boost-1.66.patch
# Search for python interpreters from newest to oldest rather then picking up /usr/bin/python as first choice
Patch7: feature-suse-python-interp-search-order.patch
%if 0%{?suse_version} >= 1330
BuildRequires: libcurl-mini-devel
%else
BuildRequires: curl-devel
%endif
%if 0%{?use_devtoolset}
%if 0%{?rhel_version}
BuildRequires: devtoolset-4-gcc-c++
%else
BuildRequires: devtoolset-4-gcc-c++
%endif
%else
BuildRequires: gcc-c++
%endif
## these two do not exist on centos/rhel
%if 0%{?suse_version}
%if 0%{?suse_version} > 1010
BuildRequires: fdupes
%endif
%if 0%{?sles_version} != 10
BuildRequires: libarchive-devel >= 3.0.2
%endif
BuildRequires: rhash-devel
%endif
BuildRequires: libbz2-devel
BuildRequires: libexpat-devel
# use libuv package for Leap and Tumbleweed
%if (0%{?suse_version} > 1320 || (0%{?suse_version} == 1315 && 0%{?is_opensuse}))
BuildRequires: libuv-devel
%define use_system_uvlib ON
# otherwise use libuv part of CMake tarball
%else
%define use_system_uvlib OFF
%endif
BuildRequires: ncurses-devel
# this is commented as it would create dependancy cycle between jsoncpp and cmake
#if 0%{?suse_version} > 1320
#BuildRequires: pkgconfig(jsoncpp)
#endif
BuildRequires: pkgconfig
BuildRequires: zlib-devel
BuildRequires: pkgconfig(liblzma)
Requires: make
%if 0%{?suse_version}
# bnc#953842 - A python file is shipped so require python base so it can be run.
Requires: python3-base
%endif
# Recommends: cmake-mans
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
CMake is a cross-platform, open-source build system
%prep
# The publisher doesn't sign the source tarball, but a signatures file containing multiple hashes.
# Verify hashes in that file against source tarball.
echo "`grep %{name}-%{version}.tar.gz %{SOURCE5} | grep -Eo '^[0-9a-f]+'` %{SOURCE0}" | sha256sum -c
%setup -q
## RHEL_6, RHEL_7 has no autopatch. CentOS and SUSE have it.
%autopatch -p1
## this is the series seen in CentOS_6 autopatch:
# patch -p1 -s < cmake-fix-ruby-test.patch
# patch -p1 -s < form.patch
# patch -p1 -s < system-libs.patch
# patch -p1 -s < cmake-3.10.1_boost-1.66.patch
# patch -p1 -s < feature-suse-python-interp-search-order.patch
%build
%if 0%{?use_devtoolset}
source /opt/rh/devtoolset-4/enable
%endif
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
# This is not autotools configure
./configure \
--prefix=%{_prefix} \
--datadir=/share/%{name} \
--docdir=/share/doc/packages/%{name} \
--mandir=/share/man \
%if 0%{?suse_version} && !0%{?sles_version}
--system-libs \
%else
--system-curl \
--system-expat \
--system-zlib \
--system-bzip2 \
--no-system-libarchive \
%endif
--no-system-jsoncpp \
--parallel=0%{jobs} \
--verbose \
--no-qt-gui \
-- \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=%{use_system_uvlib}
make VERBOSE=1 %{?_smp_mflags}
%install
%make_install
mkdir -p %{buildroot}%{_libdir}/cmake
find %{buildroot}%{_datadir}/cmake -type f -print0 | xargs -0 chmod 644
# rpm macros
install -m644 %{SOURCE1} -D %{buildroot}%{_sysconfdir}/rpm/macros.cmake
%if 0%{?suse_version} > 1310
## cmake.prov requires python3, which we do not have on centos:6
# RPM auto provides
install -p -m0644 -D %{SOURCE3} %{buildroot}%{_libexecdir}/rpm/fileattrs/cmake.attr
install -p -m0755 -D %{SOURCE4} %{buildroot}%{_libexecdir}/rpm/cmake.prov
%endif
%if 0%{?suse_version} > 1010
%fdupes %{buildroot}%{_datadir}/cmake
%endif
%check
# Excluded tests:
# TestUpload: uses internet connection
# SimpleInstall: seems to fail due to RPATH strictness
# if any other app installs then this test is bogus
# suse specific brp-25-symlink cramps the symlinks, hence the CPackComponentsForAll-RPM-(default|OnePackPerGroup|IgnoreGroup|AllInOne) fail
#
# on centos6 these test fail:
#[ 296s] 39 - FortranOnly (Failed)
#[ 296s] 40 - VSGNUFortran (Failed)
#[ 296s] 74 - CxxDialect (Failed)
#[ 296s] 83 - Module.CheckIPOSupported-Fortran (Failed)
#[ 296s] 200 - Server (Failed)
#[ 296s] 227 - Fortran (Failed)
#[ 296s] 228 - FortranModules (Failed)
#[ 296s] 249 - CMakeOnly.CompilerIdFortran (Failed)
#[ 296s] 432 - CMake.FileDownload (Failed)
# It appears the regexp below is not rooted at ^ or $. Sigh, well.
#
# rhel6 fails its tests when we use their native compiler.
%if 0%{?use_devtoolset}
source /opt/rh/devtoolset-4/enable
%endif
./bin/ctest --force-new-ctest-process --output-on-failure %{?_smp_mflags} \
-E "(TestUpload|SimpleInstall|SimpleInstall-Stage2|CPackComponentsForAll-RPM-(default|OnePackPerGroup|IgnoreGroup|AllInOne)|CPack_RPM|Fortran|Server|CxxDialect|CMake.FileDownload)"
%files
%defattr(-,root,root)
%config %{_sysconfdir}/rpm/macros.cmake
%if 0%{?suse_version} > 1310
%{_libexecdir}/rpm
%endif
%{_bindir}/cpack
%{_bindir}/cmake
%{_bindir}/ctest
%{_bindir}/ccmake
%{_datadir}/cmake
%{_libdir}/cmake
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/cmake.m4
%if 0%{?suse_version}
%doc %{_docdir}/%{name}
%else
%doc %{_docdir}/packages/%{name}
%endif
%changelog