File cmake.spec of Package cmake
%global major_version 3
%global minor_version 18
Name: cmake
Version: 3.18.2
Release: 19.1
Summary: Cross-platform make system
License: BSD and MIT and zlib
Source: cmake-%{version}.tar.bz2
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: gcc-c++
%if 0%{?suse_version}
BuildRequires: gcc-fortran
BuildRequires: libbz2-devel
BuildRequires: libexpat-devel
%else
BuildRequires: gcc-gfortran
BuildRequires: bzip2-devel
BuildRequires: expat-devel
%endif
BuildRequires: sed
BuildRequires: git
BuildRequires: ncurses-devel
BuildRequires: curl-devel
BuildRequires: libarchive-devel
BuildRequires: libuv-devel
BuildRequires: xz-devel
BuildRequires: zlib-devel
Requires: %{_bindir}/env
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: %{name}-data = %{version}-%{release}
Requires: %{name}-filesystem%{?_isa} = %{version}-%{release}
Provides: %{name} = %{version}-%{release}
%if 0%{?el7}
BuildRequires: devtoolset-7-gcc-c++
%endif
%package data
Summary: Common data-files for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name}-filesystem = %{version}-%{release}
BuildArch: noarch
%description data
This package contains common data-files for %{name}.
%package doc
Summary: Documentation for %{name}
BuildArch: noarch
%description doc
This package contains documentation for %{name}.
%package filesystem
Summary: Directories used by CMake modules
%description filesystem
This package owns all directories used by CMake modules.
%description
CMake is used to control the software compilation process using simple
platform and compiler independent configuration files. CMake generates
native makefiles and workspaces that can be used in the compiler
environment of your choice. CMake is quite sophisticated: it is possible
to support complex environments requiring system configuration, preprocessor
generation, code generation, and template instantiation.
%prep
%autosetup -n cmake-%{version}
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export LDFLAGS="%{?__global_ldflags}"
mkdir build
pushd build
../bootstrap --prefix=%{_prefix} --datadir=/share/%{name} \
--docdir=/share/doc/%{name} --mandir=/share/man \
--%{?with_bootstrap:no-}system-libs \
--no-system-jsoncpp \
--no-system-librhash \
--parallel=`/usr/bin/getconf _NPROCESSORS_ONLN`
%make_build VERBOSE=1
%install
mkdir -p %{buildroot}%{_pkgdocdir}
%make_install -C build CMAKE_DOC_DIR=%{buildroot}%{_pkgdocdir}
find %{buildroot}%{_datadir}/%{name}/Modules -type f | xargs chmod -x
[ -n "$(find %{buildroot}%{_datadir}/%{name}/Modules -name \*.orig)" ] &&
echo "Found .orig files in %{_datadir}/%{name}/Modules, rebase patches" &&
exit 1
# Install major_version name links
%{!?name_suffix:for f in ccmake cmake cpack ctest; do ln -s $f %{buildroot}%{_bindir}/${f}%{major_version}; done}
# Install bash completion symlinks
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
for f in %{buildroot}%{_datadir}/%{name}/completions/*; do
if [ -f $f ]; then
ln -s ../../%{name}/completions/$(basename $f) %{buildroot}%{_datadir}/bash-completion/completions
fi
done
rm -rf %{buildroot}%{_docdir}/%{name}
# Install documentation to _pkgdocdir
mkdir -p %{buildroot}%{_pkgdocdir}
cp -pr %{buildroot}%{_datadir}/%{name}/Help %{buildroot}%{_pkgdocdir}
mv %{buildroot}%{_pkgdocdir}/Help %{buildroot}%{_pkgdocdir}/rst
# create manifests for splitting files and directories for filesystem-package
find %{buildroot}%{_datadir}/%{name} -type d | \
sed -e 's!^%{buildroot}!%%dir "!g' -e 's!$!"!g' > data_dirs.mf
find %{buildroot}%{_datadir}/%{name} -type f | \
sed -e 's!^%{buildroot}!"!g' -e 's!$!"!g' > data_files.mf
find %{buildroot}%{_libdir}/%{name} -type d | \
sed -e 's!^%{buildroot}!%%dir "!g' -e 's!$!"!g' > lib_dirs.mf
find %{buildroot}%{_libdir}/%{name} -type f | \
sed -e 's!^%{buildroot}!"!g' -e 's!$!"!g' > lib_files.mf
find %{buildroot}%{_bindir} -type f -or -type l -or -xtype l | \
sed -e '/.*-gui$/d' -e '/^$/d' -e 's!^%{buildroot}!"!g' -e 's!$!"!g' >> lib_files.mf
#pushd build
##CMake.FileDownload, CTestTestUpload, and curl require internet access
## RunCMake.CPack_RPM is broken if disttag contains "+", bug #1499151
## CPackComponentsForAll-RPM-IgnoreGroup fails on RHEL8
## https://gitlab.kitware.com/cmake/cmake/issues/19983
#NO_TEST="CMake.FileDownload|CTestTestUpload|curl|RunCMake.CPack_RPM|CPackComponentsForAll-RPM-IgnoreGroup"
#export NO_TEST
#bin/ctest -V -E "$NO_TEST" %{?_smp_mflags}
%files -f lib_files.mf
%doc %dir %{_pkgdocdir}
%license Copyright.txt*
%files data -f data_files.mf
%{_datadir}/aclocal/cmake.m4
%{_datadir}/bash-completion
%{_datadir}/emacs/site-lisp/cmake-mode.el
%{_datadir}/vim/vimfiles/indent/cmake.vim
%{_datadir}/vim/vimfiles/syntax/cmake.vim
%files doc
# Pickup license-files from main-pkg's license-dir
# If there's no license-dir they are picked up by %%doc previously
%{?_licensedir:%license %{_datadir}/licenses/%{name}*}
%doc %{_pkgdocdir}
%if 0%{?el7}
%files filesystem -f data_dirs.mf -f lib_dirs.mf
%else
%files filesystem -f data_dirs.mf
%endif
%changelog