cmake/cmake.spec
Simon Lees ec7529e107 Accepting request 773189 from home:StefanBruens:branches:devel:tools:building
- Revert LIBDIR change in macros - it is inconsistent (all other
  INSTALL_<dir>s use absolute paths), unneeded (paths may be
  absolute or relative), and breaks a number of packages.
- Update minimum libarchive version, >= 3.3.3.
- Do not flag macros as config file.
- Adjust constraints (7G disk space is required, independent
  of architecture).

OBS-URL: https://build.opensuse.org/request/show/773189
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=398
2020-02-10 21:08:19 +00:00

219 lines
6.6 KiB
RPMSpec

#
# spec file for package cmake
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "gui"
%define psuffix -ui
%bcond_without gui
%else
%bcond_with gui
%endif
%if "%{flavor}" == "mini"
%define psuffix -mini
%bcond_without mini
%else
%bcond_with mini
%endif
%define shortversion 3.16
Name: cmake%{?psuffix}
Version: 3.16.2
Release: 0
Summary: Cross-platform make system
License: BSD-3-Clause
URL: https://www.cmake.org/
Source0: https://www.cmake.org/files/v%{shortversion}/cmake-%{version}.tar.gz
Source1: cmake.macros
# bnc#947585 - Let CMake produces automatic RPM provides
Source3: cmake.attr
Source4: cmake.prov
Source5: https://www.cmake.org/files/v%{shortversion}/cmake-%{version}-SHA-256.txt
Source6: https://www.cmake.org/files/v%{shortversion}/cmake-%{version}-SHA-256.txt.asc
Source7: cmake.keyring
Patch0: cmake-fix-ruby-test.patch
# Search for python interpreters from newest to oldest rather then picking up /usr/bin/python as first choice
Patch1: feature-suse-python-interp-search-order.patch
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: rhash-devel
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libssl)
BuildRequires: pkgconfig(libuv) >= 1.10
BuildRequires: pkgconfig(ncurses)
BuildRequires: pkgconfig(zlib)
Requires: make
# bnc#953842 - A python file is shipped so require python base so it can be run.
Requires: python3-base
%if %{with mini}
Requires: this-is-only-for-build-envs
Conflicts: cmake
Provides: cmake = %{version}
%else
BuildRequires: pkgconfig(jsoncpp) >= 1.4.1
BuildRequires: pkgconfig(libarchive) >= 3.3.3
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libzstd)
Conflicts: cmake-mini
%endif
%if %{with gui}
BuildRequires: python3-Sphinx
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(Qt5Widgets)
%endif
%description
CMake is a cross-platform build system.
%package -n cmake-man
Summary: Manual pages for cmake, a cross-platform make system
Supplements: cmake
%description -n cmake-man
Manual pages for cmake, a cross-platform make system.
%package -n cmake-gui
Summary: CMake graphical user interface
Requires: cmake
%description -n cmake-gui
This is a Graphical User Interface for CMake, a cross-platform
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 cmake-%{version}.tar.gz %{SOURCE5} | grep -Eo '^[0-9a-f]+'` %{SOURCE0}" | sha256sum -c
%setup -q -n cmake-%{version}
%autopatch -p1
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
# This is not autotools configure
./configure \
--prefix=%{_prefix} \
--datadir=/share/cmake \
--docdir=/share/doc/packages/cmake \
--mandir=/share/man \
--system-libs \
%if %{with mini}
--no-system-curl \
--no-system-jsoncpp \
--no-system-libarchive \
--no-system-zstd \
%endif
--parallel=0%{jobs} \
--verbose \
%if %{with gui}
--qt-gui \
--sphinx-man \
%else
--no-qt-gui \
%endif
%{nil}
%make_build
%install
%make_install
mkdir -p %{buildroot}%{_libdir}/cmake
%if %{with gui}
%suse_update_desktop_file -r cmake-gui CMake Development IDE Tools Qt
# delete files that belong to the 'cmake' package
rm -rf %{buildroot}%{_bindir}/{cpack,cmake,ctest,ccmake}
rm -rf %{buildroot}%{_datadir}/cmake
rm -rf %{buildroot}%{_datadir}/aclocal/cmake.m4
rm -rf %{buildroot}%{_docdir}/cmake
%else
find %{buildroot}%{_datadir}/cmake -type f -print0 | xargs -0 chmod 644
# rpm macros
install -m644 %{SOURCE1} -D %{buildroot}%{_rpmconfigdir}/macros.d/macros.cmake
# RPM auto provides
install -p -m0644 -D %{SOURCE3} %{buildroot}%{_libexecdir}/rpm/fileattrs/cmake.attr
install -p -m0755 -D %{SOURCE4} %{buildroot}%{_libexecdir}/rpm/cmake.prov
# Install bash completion symlinks
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
for f in %{buildroot}%{_datadir}/cmake/completions/*
do
ln -s ../../cmake/completions/$(basename $f) %{buildroot}%{_datadir}/bash-completion/completions
done
# cmake-mode.el
%define cmake_mode_el %{_datadir}/emacs/site-lisp/cmake-mode.el
install -D -p -m 0644 Auxiliary/cmake-mode.el %{buildroot}%cmake_mode_el
rm %{buildroot}%{_datadir}/cmake/editors/emacs/cmake-mode.el
# fix: W: files-duplicate (%%license covers already)
rm %{buildroot}%{_docdir}/cmake/Copyright.txt
%fdupes %{buildroot}%{_datadir}/cmake
%endif
%if "%{flavor}" == ""
%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
./bin/ctest --force-new-ctest-process --output-on-failure %{?_smp_mflags} \
-E "(TestUpload|SimpleInstall|SimpleInstall-Stage2|CPackComponentsForAll-RPM-(default|OnePackPerGroup|IgnoreGroup|AllInOne)|CPack_RPM)"
%endif
%if %{with gui}
%files -n cmake-gui
%license Copyright.txt
%{_bindir}/cmake-gui
%{_datadir}/applications/cmake-gui.desktop
%{_datadir}/mime/packages/cmakecache.xml
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/*
%{_datadir}/icons/hicolor/128x128/apps/CMakeSetup.png
%{_datadir}/icons/hicolor/32x32/apps/CMakeSetup.png
%files -n cmake-man
%license Copyright.txt
%{_mandir}/man7/*
%{_mandir}/man1/*
%else
%files
%license Copyright.txt
%doc README.rst
%{_rpmconfigdir}/macros.d/macros.cmake
%{_libexecdir}/rpm
%{_bindir}/cpack
%{_bindir}/cmake
%{_bindir}/ctest
%{_bindir}/ccmake
%{_datadir}/cmake
%{_libdir}/cmake
%dir %{_datadir}/aclocal
%{_datadir}/aclocal/cmake.m4
%doc %{_docdir}/cmake
%{_datadir}/bash-completion
%cmake_mode_el
%dir %{dirname:%cmake_mode_el}
%endif
%changelog