Browse Source

cmake3 package added

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 7 years ago
parent
commit
179c9851ec
  1. 12
      SOURCES/cmake3-fedora-flag_release.patch
  2. 19
      SOURCES/cmake3-findruby.patch
  3. 9
      SOURCES/cmake3-init.el
  4. 115
      SOURCES/cmake3-libarchive3.patch
  5. 4384
      SOURCES/cmake3-rename.patch
  6. 2
      SOURCES/cmake3.attr
  7. 82
      SOURCES/cmake3.prov
  8. 34
      SOURCES/macros.cmake3
  9. 474
      SPECS/cmake3.spec

12
SOURCES/cmake3-fedora-flag_release.patch

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
diff -up a/Modules/Compiler/GNU.cmake.than a/Modules/Compiler/GNU.cmake
--- a/Modules/Compiler/GNU.cmake.than 2016-06-02 13:42:38.186383915 +0200
+++ b/Modules/Compiler/GNU.cmake 2016-06-02 14:00:26.256271135 +0200
@@ -40,7 +40,7 @@
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2 -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")

19
SOURCES/cmake3-findruby.patch

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
--- a/Modules/FindRuby.cmake.orig 2014-10-27 08:40:56.000000000 -0600
+++ b/Modules/FindRuby.cmake 2014-10-29 20:37:15.832502515 -0600
@@ -109,14 +109,8 @@
_RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR)
_RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR)
- # vendor_ruby available ?
- execute_process(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'"
- OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET)
-
- if(RUBY_HAS_VENDOR_RUBY)
- _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR)
- _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR)
- endif()
+ _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR)
+ _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR)
# save the results in the cache so we don't have to run ruby the next time again
set(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)

9
SOURCES/cmake3-init.el

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
;;
;; Setup cmake3-mode for autoloading
;;
(autoload 'cmake3-mode "cmake3-mode" "Major mode for editing CMake listfiles." t)
(setq auto-mode-alist
(append
'(("CMakeLists\\.txt\\'" . cmake3-mode))
'(("\\.cmake\\'" . cmake3-mode))
auto-mode-alist))

115
SOURCES/cmake3-libarchive3.patch

@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
commit 58a06a071bd16825efe0e44d0729068e97014529
Author: Björn Esser <me@besser82.io>
Date: Tue Aug 23 13:48:13 2016 +0200

cmake3-libarchive3.patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ef8605..84d3a56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -384,7 +384,7 @@ macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Build or use system libarchive for CMake and CTest.
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
- find_package(LibArchive 3.0.0)
+ find_package(LibArchive3 3.0.0)
if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif()
diff --git a/Modules/FindLibArchive3.cmake b/Modules/FindLibArchive3.cmake
new file mode 100644
index 0000000..4e18975
--- /dev/null
+++ b/Modules/FindLibArchive3.cmake
@@ -0,0 +1,75 @@
+#.rst:
+# FindLibArchive3
+# ---------------
+#
+# Find libarchive library and headers
+#
+# The module defines the following variables:
+#
+# ::
+#
+# LibArchive_FOUND - true if libarchive was found
+# LibArchive_INCLUDE_DIRS - include search path
+# LibArchive_LIBRARIES - libraries to link
+# LibArchive_VERSION - libarchive 3-component version number
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_path(LibArchive_INCLUDE_DIR
+ NAMES archive3.h
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/include"
+ )
+
+find_library(LibArchive_LIBRARY
+ NAMES archive3 libarchive3
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/lib"
+ )
+
+mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY)
+
+# Extract the version number from the header.
+if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive3.h")
+ # The version string appears in one of three known formats in the header:
+ # #define ARCHIVE_LIBRARY_VERSION "libarchive 2.4.12"
+ # #define ARCHIVE_VERSION_STRING "libarchive 2.8.4"
+ # #define ARCHIVE_VERSION_ONLY_STRING "3.2.0"
+ # Match any format.
+ set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"(libarchive +)?([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$")
+ file(STRINGS "${LibArchive_INCLUDE_DIR}/archive3.h" _LibArchive_VERSION_STRING LIMIT_COUNT 1 REGEX "${_LibArchive_VERSION_REGEX}")
+ if(_LibArchive_VERSION_STRING)
+ string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\2.\\3.\\4" LibArchive_VERSION "${_LibArchive_VERSION_STRING}")
+ endif()
+ unset(_LibArchive_VERSION_REGEX)
+ unset(_LibArchive_VERSION_STRING)
+endif()
+
+# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND
+# to TRUE if all listed variables are TRUE.
+# (Use ${CMAKE_ROOT}/Modules instead of ${CMAKE_CURRENT_LIST_DIR} because CMake
+# itself includes this FindLibArchive when built with an older CMake that does
+# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(LibArchive
+ REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
+ VERSION_VAR LibArchive_VERSION
+ )
+set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
+unset(LIBARCHIVE_FOUND)
+
+if(LibArchive_FOUND)
+ set(LibArchive_INCLUDE_DIRS ${LibArchive_INCLUDE_DIR})
+ set(LibArchive_LIBRARIES ${LibArchive_LIBRARY})
+endif()
diff --git a/Utilities/cm_libarchive.h b/Utilities/cm_libarchive.h
index c6a8a82..8fa06b4 100644
--- a/Utilities/cm_libarchive.h
+++ b/Utilities/cm_libarchive.h
@@ -15,8 +15,8 @@
/* Use the libarchive configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_LIBARCHIVE
-#include <archive.h>
-#include <archive_entry.h>
+#include <archive3.h>
+#include <archive_entry3.h>
#else
#include <cmlibarchive/libarchive/archive.h>
#include <cmlibarchive/libarchive/archive_entry.h>

4384
SOURCES/cmake3-rename.patch

File diff suppressed because it is too large Load Diff

2
SOURCES/cmake3.attr

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
%__cmake3_provides %{_rpmconfigdir}/cmake3.prov
%__cmake3_path ^/usr/lib(64)?/cmake/.*/.*(Config\.cmake|-config\.cmake)$

82
SOURCES/cmake3.prov

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (C) 2015 Daniel Vrátil <dvratil@redhat.com>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

import sys
import re
import glob

class CMakeParser:
def __init__(self, filelist = None):
if filelist == None:
filelist = sys.stdin

paths = map(lambda x: x.rstrip(), filelist.readlines())
for path in paths:
modulePath, cmakeModule, lowercase = self.parseCmakeModuleConfig(path)
if modulePath and cmakeModule:
version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase)

if version:
print("cmake(%s) = %s" % (cmakeModule, version))
else:
print("cmake(%s)" % cmakeModule)


def parseCmakeModuleConfig(self, configFile):
paths = configFile.rsplit("/", 3)

modulePath = "%s/cmake/%s" % (paths[0], paths[2])

lowercase = False
configFile = glob.glob("%s/*Config.cmake" % modulePath)
if not configFile:
configFile = glob.glob("%s/*-config.cmake" % modulePath)
lowercase = True
if not configFile:
return (None, None, None)

if lowercase:
moduleName = configFile[0][len(modulePath) + 1:-len("-config.cmake")]
else:
moduleName = configFile[0][len(modulePath) + 1:-len("Config.cmake")]

return (modulePath, moduleName, lowercase)

def resolveCMakeModuleVersion(self, modulePath, cmakeModule, lowercase):
versionFile = ("%s/%s-config-version.cmake" if lowercase else "%s/%sConfigVersion.cmake") % (modulePath, cmakeModule)
try:
f = open(versionFile, 'r')
except:
return None

for line in f:
line = line.strip()

# set(PACKAGE_VERSION <version>)
version = re.match(r"^set[\ ]*\([\ ]*PACKAGE_VERSION[\ ]+[\"]*([0-9\.]+)[\"]*[\ ]*[.]*\)", line)
if version:
return version.groups(1)[0]

return None

if __name__ == "__main__":
parser = CMakeParser()

34
SOURCES/macros.cmake3

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
#
# Macros for cmake3
#
%_cmake3_lib_suffix64 -DLIB_SUFFIX=64
%_cmake3_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
%_cmake3_version @@CMAKE_VERSION@@
%__cmake3 /usr/bin/cmake3

# - Set default compile flags
# - CMAKE_*_FLAGS_RELEASE are added *after* the *FLAGS environment variables
# and default to -O3 -DNDEBUG. Strip the -O3 so we can override with *FLAGS
# - Turn on verbose makefiles so we can see and verify compile flags
# - Set default install prefixes and library install directories
# - Turn on shared libraries by default
%cmake3 \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \
%__cmake3 \\\
-DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
-DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
-DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \\\
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
%if "%{?_lib}" == "lib64" \
%{?_cmake3_lib_suffix64} \\\
%endif \
-DBUILD_SHARED_LIBS:BOOL=ON

474
SPECS/cmake3.spec

@ -0,0 +1,474 @@ @@ -0,0 +1,474 @@
# Set to bcond_without or use --with bootstrap if bootstrapping a new release
# or architecture
%bcond_with bootstrap

# Set to bcond_with or use --without gui to disable qt4 gui build
%bcond_without gui

# Setting the Python-version used by default
%if 0%{?rhel} && 0%{?rhel} < 8
%bcond_with python3
%else
%bcond_without python3
%endif

# Do we add appdata-files?
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without appdata
%else
%bcond_with appdata
%endif

# Sphinx-build cannot import CMakeLexer on EPEL <= 6
%if 0%{?fedora} || 0%{?rhel} >= 7
%bcond_without sphinx
%else
%bcond_with sphinx
%endif

# Run tests
%bcond_without test

# Place rpm-macros into proper location
%global rpm_macros_dir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)

# Setup _pkgdocdir if not defined already
%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}

%global major_version 3
%global minor_version 12
# Set to RC version if building RC, else %%{nil}
#global rcver rc1

# Uncomment if building for EPEL
%global name_suffix %{major_version}
%global orig_name cmake

Name: %{orig_name}%{?name_suffix}
Version: %{major_version}.%{minor_version}.2
Release: 1%{?dist}
Summary: Cross-platform make system

# most sources are BSD
# Source/CursesDialog/form/ a bunch is MIT
# Source/kwsys/MD5.c is zlib
# some GPL-licensed bison-generated files, which all include an
# exception granting redistribution under terms of your choice
License: BSD and MIT and zlib
URL: http://www.cmake.org
Source0: http://www.cmake.org/files/v%{major_version}.%{minor_version}/%{orig_name}-%{version}%{?rcver:-%rcver}.tar.gz
Source1: %{name}-init.el
Source2: macros.%{name}
# See https://bugzilla.redhat.com/show_bug.cgi?id=1202899
Source3: %{name}.attr
Source4: %{name}.prov

# Patch to fix RindRuby vendor settings
# http://public.kitware.com/Bug/view.php?id=12965
# https://bugzilla.redhat.com/show_bug.cgi?id=822796
Patch2: %{name}-findruby.patch
# replace release flag -O3 with -O2 for fedora
Patch3: %{name}-fedora-flag_release.patch

# Patch for renaming on EPEL
%if 0%{?name_suffix:1}
Patch1000: %{name}-rename.patch
Patch1001: %{name}-libarchive3.patch
%endif

BuildRequires: gcc-gfortran, gcc-c++
BuildRequires: ncurses-devel, libX11-devel
BuildRequires: bzip2-devel
BuildRequires: curl-devel
BuildRequires: expat-devel
BuildRequires: jsoncpp-devel
%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires: libarchive-devel
BuildRequires: /usr/bin/sphinx-build
BuildRequires: rhash-devel
BuildRequires: libuv-devel
%else
BuildRequires: libarchive3-devel
%endif
BuildRequires: xz-devel
BuildRequires: zlib-devel
BuildRequires: emacs
%if %{with python3}
%{!?python3_pkgversion: %global python3_pkgversion 3}
BuildRequires: python%{python3_pkgversion}-devel
%else
BuildRequires: python2-devel
%endif
%if %{without bootstrap}
#BuildRequires: xmlrpc-c-devel
%endif
%if %{with gui}
%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: libappstream-glib
%else
BuildRequires: pkgconfig(QtGui)
%endif
BuildRequires: desktop-file-utils
%global qt_gui --qt-gui
%endif

Requires: %{name}-data = %{version}-%{release}
Requires: rpm

# Source/kwsys/MD5.c
# see https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
Provides: bundled(md5-deutsch)

# https://fedorahosted.org/fpc/ticket/555
Provides: bundled(kwsys)

# cannot do this in epel, ends up replacing os-provided cmake -- Rex
%if 0%{?fedora}
%{?name_suffix:Provides: %{orig_name} = %{version}}
%endif # 0#{?fedora}

%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.


%package data
Summary: Common data-files for %{name}
Requires: %{name} = %{version}-%{release}
%if 0%{?fedora} || 0%{?rhel} >= 7
Requires: emacs-filesystem >= %{_emacs_version}
%endif

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 gui
Summary: Qt GUI for %{name}

Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: hicolor-icon-theme
Requires: shared-mime-info%{?_isa}

%description gui
The %{name}-gui package contains the Qt based GUI for %{name}.


%prep
%setup -qn %{orig_name}-%{version}%{?rcver:-%rcver}

# Apply renaming on EPEL before all other patches
%if 0%{?name_suffix:1}
%patch1000 -p1
%if 0%{?rhel} && 0%{?rhel} <= 6
%patch1001 -p1
%endif
%endif

# We cannot use backups with patches to Modules as they end up being installed
%patch2 -p1
%patch3 -p1

%if %{with python3}
echo '#!%{__python3}' > %{name}.prov
%else
echo '#!%{__python2}' > %{name}.prov
%endif
tail -n +2 %{SOURCE4} >> %{name}.prov


%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 \
--parallel=`/usr/bin/getconf _NPROCESSORS_ONLN` \
%{?with_sphinx:--sphinx-man --sphinx-html} \
%{?qt_gui};
%make_build VERBOSE=1


%install
%make_install -C build
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
ln -s ../../%{name}/completions/$(basename $f) %{buildroot}%{_datadir}/bash-completion/completions/
done
# Install emacs cmake mode
mkdir -p %{buildroot}%{_emacs_sitelispdir}/%{name}
install -p -m 0644 Auxiliary/cmake-mode.el %{buildroot}%{_emacs_sitelispdir}/%{name}/%{name}-mode.el
%{_emacs_bytecompile} %{buildroot}%{_emacs_sitelispdir}/%{name}/%{name}-mode.el
mkdir -p %{buildroot}%{_emacs_sitestartdir}
install -p -m 0644 %SOURCE1 %{buildroot}%{_emacs_sitestartdir}/
# RPM macros
install -p -m0644 -D %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.%{name}
sed -i -e "s|@@CMAKE_VERSION@@|%{version}|" -e "s|@@CMAKE_MAJOR_VERSION@@|%{major_version}|" %{buildroot}%{rpm_macros_dir}/macros.%{name}
touch -r %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.%{name}
%if 0%{?_rpmconfigdir:1}
# RPM auto provides
install -p -m0644 -D %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/fileattrs/%{name}.attr
install -p -m0755 -D %{name}.prov %{buildroot}%{_prefix}/lib/rpm/%{name}.prov
%endif
mkdir -p %{buildroot}%{_libdir}/%{name}
# Install copyright files for main package
find Source Utilities -type f -iname copy\* | while read f
do
fname=$(basename $f)
dir=$(dirname $f)
dname=$(basename $dir)
cp -p $f ./${fname}_${dname}
done
# Cleanup pre-installed documentation
%if 0%{?with_sphinx:1}
mv %{buildroot}%{_docdir}/%{name}/html .
%endif
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
%if 0%{?with_sphinx:1}
mv html %{buildroot}%{_pkgdocdir}
%endif

%if %{with gui}
# Desktop file
desktop-file-install --delete-original \
--dir=%{buildroot}%{_datadir}/applications \
%{buildroot}/%{_datadir}/applications/CMake%{?name_suffix}.desktop

%if %{with appdata}
# Register as an application to be visible in the software center
#
mkdir -p %{buildroot}%{_metainfodir}
cat > %{buildroot}%{_metainfodir}/CMake3.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Ryan Lerch <rlerch@redhat.com> -->
<!--
EmailAddress: kitware@kitware.com
SentUpstream: 2014-09-17
-->
<application>
<id type="desktop">CMake3.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<name>CMake GUI</name>
<summary>Create new CMake projects</summary>
<description>
<p>
CMake is an open source, cross platform build system that can build, test,
and package software. CMake GUI is a graphical user interface that can
create and edit CMake projects.
</p>
</description>
<url type="homepage">http://www.cmake.org</url>
<screenshots>
<screenshot type="default">https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/CMake/a.png</screenshot>
</screenshots>
<!-- FIXME: change this to an upstream email address for spec updates
<updatecontact>cmake3-owner_at_fedoraproject.org</updatecontact>
-->
</application>
EOF

appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml
%endif
%endif

%if %{with test}
%check
%if 0%{?rhel} && 0%{?rhel} <= 6
mv -f Modules/FindLibArchive.cmake Modules/FindLibArchive.disabled
%endif
pushd build
#CMake.FileDownload, CTestTestUpload, and curl require internet access
# RunCMake.CPack_RPM is broken if disttag contains "+", bug #1499151
#
# CMakeWizardTest failure: Failed Required regular expression not found.Regex=[The "cmake -i" wizard mode is no longer supported.
NO_TEST="CMake.FileDownload|CTestTestUpload|curl|RunCMake.CPack_RPM|Server|CMakeWizardTest"
# RunCMake.File_Generate fails on S390X
%ifarch s390x
NO_TEST="$NO_TEST|RunCMake.File_Generate"
%endif
export NO_TEST
bin/ctest%{?name_suffix} -V -E "$NO_TEST" %{?_smp_mflags}
popd
%if 0%{?rhel} && 0%{?rhel} <= 6
mv -f Modules/FindLibArchive.disabled Modules/FindLibArchive.cmake
%endif
%endif

%if %{with gui}
%post gui
update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/mime || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun gui
update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/mime || :
update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans gui
update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif

%files
%license Copyright.txt*
%license COPYING*
%{_bindir}/c%{name}
%{!?name_suffix:%{_bindir}/c%{name}%{major_version}}
%{_bindir}/%{name}
%{!?name_suffix:%{_bindir}/%{name}%{major_version}}
%{_bindir}/cpack%{?name_suffix}
%{!?name_suffix:%{_bindir}/cpack%{major_version}}
%{_bindir}/ctest%{?name_suffix}
%{!?name_suffix:%{_bindir}/ctest%{major_version}}
%if 0%{?with_sphinx:1}
%{_mandir}/man1/c%{name}.1.*
%{_mandir}/man1/%{name}.1.*
%{_mandir}/man1/cpack%{?name_suffix}.1.*
%{_mandir}/man1/ctest%{?name_suffix}.1.*
%{_mandir}/man7/*.7.*
%endif
%{_libdir}/%{name}/

%files data
%{_datadir}/aclocal/%{name}.m4
%{_datadir}/bash-completion/
%{_datadir}/%{name}/
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_emacs_sitelispdir}/%{name}
%{_emacs_sitestartdir}/%{name}-init.el
%else
%{_emacs_sitelispdir}
%{_emacs_sitestartdir}
%endif
%{rpm_macros_dir}/macros.%{name}
%if 0%{?_rpmconfigdir:1}
%{_rpmconfigdir}/fileattrs/%{name}.attr
%{_rpmconfigdir}/%{name}.prov
%endif

%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}*}
%{_pkgdocdir}/

%if %{with gui}
%files gui
%{_bindir}/%{name}-gui
%if %{with appdata}
%{_metainfodir}/*.appdata.xml
%endif
%{_datadir}/applications/CMake%{?name_suffix}.desktop
%{_datadir}/mime/packages/
%{_datadir}/icons/hicolor/*/apps/CMake%{?name_suffix}Setup.png
%if 0%{?with_sphinx:1}
%{_mandir}/man1/%{name}-gui.1.*
%endif
%endif


%changelog
* Thu Oct 04 2018 Antonio Trande <sagitter@fedoraproject.org> - 3.12.2-1
- Update to cmake-3.12.2

* Mon Aug 20 2018 Antonio Trande <sagitter@fedoraproject.org> - 3.12.1-1
- Update to cmake-3.12.1

* Fri Jul 27 2018 Antonio Trande <sagitter@fedoraproject.org> - 3.12.0-1
- Update to cmake-3.12.0
- Use %%_metainfodir

* Sat May 19 2018 Antonio Trande <sagitter@fedoraproject.org> - 3.11.2-1
- Update to cmake-3.11.2
- Fix appdata file's entries

* Sat Apr 07 2018 Antonio Trande <sagitter@fedoraproject.org> - 3.11.0-1
- Update to cmake-3.11.0
- Add libuv rhash development packages
- Adapt 'cmake3-rename' patch to CMake-3.11
- Move appdata file into the metainfo sub-data directory

* Thu Feb 09 2017 Orion Poplawski <orion@cora.nwra.com> 3.6.3-1
- Update to 3.6.3
- Fix cmake3.prov error

* Thu Sep 01 2016 Rex Dieter <rdieter@fedoraproject.org> 3.6.1-2
- drop Provides: cmake

* Tue Aug 23 2016 Björn Esser <fedora@besser82.io> - 3.6.1-1
- Update to 3.6.1 (#1353778)

* Fri Apr 22 2016 Björn Esser <fedora@besser82.io> - 3.5.2-2
- Do not own /usr/lib/rpm/fileattrs

* Sat Apr 16 2016 Björn Esser <fedora@besser82.io> - 3.5.2-1
- Update to 3.5.2 (#1327794)

* Fri Mar 25 2016 Björn Esser <fedora@besser82.io> - 3.5.1-1
- Update to 3.5.1 (#1321198)

* Fri Mar 11 2016 Björn Esser <fedora@besser82.io> - 3.5.0-2.1
- fix emacs-filesystem requires for epel6

* Thu Mar 10 2016 Björn Esser <fedora@besser82.io> - 3.5.0-2
- keep Help-directory and its contents in %%_datadir/%%name

* Wed Mar 09 2016 Björn Esser <fedora@besser82.io> - 3.5.0-1.2
- do not provide cmake = %%{version}

* Wed Mar 09 2016 Björn Esser <fedora@besser82.io> - 3.5.0-1.1
- fix macros

* Wed Mar 09 2016 Björn Esser <fedora@besser82.io> - 3.5.0-1
- update to 3.5.0 final

* Tue Mar 08 2016 Björn Esser <fedora@besser82.io> - 3.5.0-0.3.rc3
- bump after review (#1315193)

* Mon Mar 07 2016 Björn Esser <fedora@besser82.io> - 3.5.0-0.2.rc3
- addressing issues from review (#1315193)
- fix emacs-packaging
- use %%license-macro
- fix arch'ed Requires
- removed BuildRoot
- use %%global instead of %%define
- split documentation into noarch'ed doc-subpkg

* Mon Mar 07 2016 Björn Esser <fedora@besser82.io> - 3.5.0-0.1.rc3
- initial epel-release (#1315193)
Loading…
Cancel
Save