!1 init cmake

Merge pull request !1 from jinjin/yang
This commit is contained in:
openeuler-ci-bot 2019-12-14 11:29:12 +08:00 committed by Gitee
commit 4d68d172c4
12 changed files with 634 additions and 75 deletions

View File

@ -1,36 +0,0 @@
# cmake
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +0,0 @@
# cmake
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

BIN
cmake-3.12.1.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,168 @@
diff -up cmake-3.12.0/.fedora_flag_release.orig cmake-3.12.0/.fedora_flag_release
diff -up cmake-3.12.0/Modules/Compiler/Absoft-Fortran.cmake.orig cmake-3.12.0/Modules/Compiler/Absoft-Fortran.cmake
--- cmake-3.12.0/Modules/Compiler/Absoft-Fortran.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/Absoft-Fortran.cmake 2018-07-27 08:51:37.486583595 -0500
@@ -1,7 +1,7 @@
string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " ")
-string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O2")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-YMOD_OUT_DIR=")
set(CMAKE_Fortran_MODPATH_FLAG "-p")
diff -up cmake-3.12.0/Modules/Compiler/G95-Fortran.cmake.orig cmake-3.12.0/Modules/Compiler/G95-Fortran.cmake
--- cmake-3.12.0/Modules/Compiler/G95-Fortran.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/G95-Fortran.cmake 2018-07-27 08:51:37.487583601 -0500
@@ -1,7 +1,7 @@
string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
-string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O2")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
diff -up cmake-3.12.0/Modules/Compiler/GNU.cmake.orig cmake-3.12.0/Modules/Compiler/GNU.cmake
--- cmake-3.12.0/Modules/Compiler/GNU.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/GNU.cmake 2018-07-27 08:51:37.488583607 -0500
@@ -40,7 +40,7 @@ macro(__compiler_gnu lang)
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>")
diff -up cmake-3.12.0/Modules/Compiler/GNU-Fortran.cmake.orig cmake-3.12.0/Modules/Compiler/GNU-Fortran.cmake
--- cmake-3.12.0/Modules/Compiler/GNU-Fortran.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/GNU-Fortran.cmake 2018-07-27 08:51:37.487583601 -0500
@@ -11,7 +11,7 @@ set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpr
# No -DNDEBUG for Fortran.
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
-string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O2")
# No -isystem for Fortran because it will not find .mod files.
unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
diff -up cmake-3.12.0/Modules/Compiler/Intel.cmake.orig cmake-3.12.0/Modules/Compiler/Intel.cmake
--- cmake-3.12.0/Modules/Compiler/Intel.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/Intel.cmake 2018-07-27 08:51:37.489583613 -0500
@@ -22,7 +22,7 @@ else()
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp")
diff -up cmake-3.12.0/Modules/Compiler/NVIDIA-CUDA.cmake.orig cmake-3.12.0/Modules/Compiler/NVIDIA-CUDA.cmake
--- cmake-3.12.0/Modules/Compiler/NVIDIA-CUDA.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/NVIDIA-CUDA.cmake 2018-07-27 08:51:37.490583619 -0500
@@ -9,7 +9,7 @@ if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STRE
set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
- string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O2 -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
endif()
diff -up cmake-3.12.0/Modules/Compiler/PathScale.cmake.orig cmake-3.12.0/Modules/Compiler/PathScale.cmake
--- cmake-3.12.0/Modules/Compiler/PathScale.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/PathScale.cmake 2018-07-27 08:51:37.490583619 -0500
@@ -16,6 +16,6 @@ macro(__compiler_pathscale lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -g -O2")
endmacro()
diff -up cmake-3.12.0/Modules/Compiler/PGI.cmake.orig cmake-3.12.0/Modules/Compiler/PGI.cmake
--- cmake-3.12.0/Modules/Compiler/PGI.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/PGI.cmake 2018-07-27 08:51:37.492583631 -0500
@@ -18,7 +18,7 @@ macro(__compiler_pgi lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O2 -s")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -fast -O2")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -gopt")
if(CMAKE_HOST_WIN32)
diff -up cmake-3.12.0/Modules/Compiler/SunPro-ASM.cmake.orig cmake-3.12.0/Modules/Compiler/SunPro-ASM.cmake
--- cmake-3.12.0/Modules/Compiler/SunPro-ASM.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/SunPro-ASM.cmake 2018-07-27 08:51:37.492583631 -0500
@@ -11,7 +11,7 @@ set(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG
string(APPEND CMAKE_ASM_FLAGS_INIT " ")
string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
-string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -xO2 -DNDEBUG")
string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
# Initialize ASM link type selection flags. These flags are used when
diff -up cmake-3.12.0/Modules/Compiler/SunPro-C.cmake.orig cmake-3.12.0/Modules/Compiler/SunPro-C.cmake
--- cmake-3.12.0/Modules/Compiler/SunPro-C.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/SunPro-C.cmake 2018-07-27 08:51:37.492583631 -0500
@@ -15,7 +15,7 @@ set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "
string(APPEND CMAKE_C_FLAGS_INIT " ")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
-string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -xO2 -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_C "-xMD -xMF <DEPFILE>")
diff -up cmake-3.12.0/Modules/Compiler/SunPro-CXX.cmake.orig cmake-3.12.0/Modules/Compiler/SunPro-CXX.cmake
--- cmake-3.12.0/Modules/Compiler/SunPro-CXX.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/SunPro-CXX.cmake 2018-07-27 08:51:37.493583637 -0500
@@ -15,7 +15,7 @@ set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG
string(APPEND CMAKE_CXX_FLAGS_INIT " ")
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
-string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -xO2 -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
set(CMAKE_DEPFILE_FLAGS_CXX "-xMD -xMF <DEPFILE>")
diff -up cmake-3.12.0/Modules/Compiler/SunPro-Fortran.cmake.orig cmake-3.12.0/Modules/Compiler/SunPro-Fortran.cmake
--- cmake-3.12.0/Modules/Compiler/SunPro-Fortran.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Compiler/SunPro-Fortran.cmake 2018-07-27 08:51:37.493583637 -0500
@@ -13,7 +13,7 @@ set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLA
string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG")
-string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -xO2 -DNDEBUG")
string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG")
set(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
set(CMAKE_Fortran_MODPATH_FLAG "-M")
diff -up cmake-3.12.0/Modules/Platform/IRIX64.cmake.orig cmake-3.12.0/Modules/Platform/IRIX64.cmake
--- cmake-3.12.0/Modules/Platform/IRIX64.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Platform/IRIX64.cmake 2018-07-27 08:51:37.492583631 -0500
@@ -37,7 +37,7 @@ if(NOT CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
- set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
+ set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
endif()
diff -up cmake-3.12.0/Modules/Platform/IRIX.cmake.orig cmake-3.12.0/Modules/Platform/IRIX.cmake
--- cmake-3.12.0/Modules/Platform/IRIX.cmake.orig 2018-07-17 06:29:00.000000000 -0500
+++ cmake-3.12.0/Modules/Platform/IRIX.cmake 2018-07-27 08:51:37.491583625 -0500
@@ -7,7 +7,7 @@ if(NOT CMAKE_COMPILER_IS_GNUCXX)
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
set (CMAKE_CXX_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
- set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG")
+ set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
set (CMAKE_C_FLAGS_INIT "")

21
cmake-findruby.patch Normal file
View File

@ -0,0 +1,21 @@
Index: cmake-3.10.0/Modules/FindRuby.cmake
===================================================================
--- cmake-3.10.0.orig/Modules/FindRuby.cmake
+++ cmake-3.10.0/Modules/FindRuby.cmake
@@ -106,14 +106,8 @@ if(RUBY_EXECUTABLE AND NOT RUBY_VERSIO
_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
cmake-init.el Normal file
View File

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

16
cmake-mingw-dl.patch Normal file
View File

@ -0,0 +1,16 @@
diff -rupN cmake-3.10.1/Modules/Platform/Windows-GNU.cmake cmake-3.10.1-new/Modules/Platform/Windows-GNU.cmake
--- cmake-3.10.1/Modules/Platform/Windows-GNU.cmake 2017-12-13 14:25:23.000000000 +0100
+++ cmake-3.10.1-new/Modules/Platform/Windows-GNU.cmake 2017-12-30 15:32:03.253515499 +0100
@@ -28,9 +28,11 @@ if(MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
+ set(CMAKE_DL_LIBS "dl")
+else()
+ set(CMAKE_DL_LIBS "")
endif()
-set(CMAKE_DL_LIBS "")
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LINK_LIBRARY_FLAG "-l")
set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough

3
cmake.attr Normal file
View File

@ -0,0 +1,3 @@
%__cmake_provides %{_rpmconfigdir}/cmake.prov
%__cmake_requires %{_rpmconfigdir}/cmake.req
%__cmake_path ^(%{_libdir}|%{_datadir})/cmake/.*/.*(Config\.cmake|-config\.cmake)$

75
cmake.prov Normal file
View File

@ -0,0 +1,75 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (C) 2015 Daniel Vrátil <dvratil@redhat.com>
# Copyright (C) 2017 Daniel Vrátil <dvratil@fedoraproject.org>
#
#
# 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])
cfgFile = paths[3]
if cfgFile.endswith("Config.cmake"):
return (modulePath, cfgFile[0:-len("Config.cmake")], False)
elif cfgFile.endswith("-config.cmake"):
return (modulePath, cfgFile[0:-len("-config.cmake")], True)
else:
return (None, None, False)
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()

70
cmake.req Normal file
View File

@ -0,0 +1,70 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
# Copyright (C) 2017 Björn Esser <besser82@fedoraproject.org>
#
# based on cmake.prov, which is
# Copyright (C) 2015 Daniel Vrátil <dvratil@redhat.com>
# Copyright (C) 2017 Daniel Vrátil <dvratil@fedoraproject.org>
#
#
# 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 subprocess
class CMakeParser:
def __init__(self, filelist = None):
if filelist == None:
filelist = sys.stdin
has_module = False
is_arched = False
isa_suf = subprocess.check_output(["/usr/bin/rpm", "-E %{?_isa}"]).decode().strip()
paths = map(lambda x: x.rstrip(), filelist.readlines())
for path in paths:
modulePath, cmakeModule, lowercase = self.parseCmakeModuleConfig(path)
if modulePath and cmakeModule:
has_module = True
if re.match(".*/usr/lib(64)?/cmake/.*", modulePath):
is_arched = True
if has_module:
if is_arched:
print("cmake-filesystem%s" % isa_suf)
else:
print("cmake-filesystem")
def parseCmakeModuleConfig(self, configFile):
paths = configFile.rsplit("/", 3)
modulePath = "%s/cmake/%s" % (paths[0], paths[2])
cfgFile = paths[3]
if cfgFile.endswith("Config.cmake"):
return (modulePath, cfgFile[0:-len("Config.cmake")], False)
elif cfgFile.endswith("-config.cmake"):
return (modulePath, cfgFile[0:-len("-config.cmake")], True)
else:
return (None, None, False)
if __name__ == "__main__":
parser = CMakeParser()

236
cmake.spec Normal file
View File

@ -0,0 +1,236 @@
%bcond_with bootstrap
%bcond_without ncurses
%bcond_without sphinx
%bcond_without X11_test
%global rpm_macros_dir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/cmake-%{version}}
%{?rcsuf:%global relsuf .%{rcsuf}}
%{?rcsuf:%global versuf -%{rcsuf}}
Name: cmake
Version: 3.12.1
Release: 2
Summary: Cross-platform make system
License: BSD and MIT and zlib
URL: http://www.cmake.org
Source0: http://www.cmake.org/files/v3.12/cmake-%{version}.tar.gz
Source1: cmake-init.el
Source2: macros.cmake
Source3: cmake.attr
Source4: cmake.prov
Source5: cmake.req
Patch0001: cmake-findruby.patch
Patch0002: cmake-fedora-flag_release.patch
Patch0003: cmake-mingw-dl.patch
BuildRequires: coreutils findutils gcc-c++ gcc-gfortran sed
BuildRequires: emacs python3-devel pkgconfig(Qt5Widgets) desktop-file-utils
%if %{with X11_test}
BuildRequires: libX11-devel
%endif
%if %{with ncurses}
BuildRequires: ncurses-devel
%endif
%if %{with sphinx}
BuildRequires: %{_bindir}/sphinx-build
%endif
%if %{without bootstrap}
BuildRequires: bzip2-devel curl-devel expat-devel jsoncpp-devel libarchive-devel
BuildRequires: libuv-devel rhash-devel xz-devel zlib-devel cmake-rpm-macros
%endif
Requires: cmake-data = %{version}-%{release} cmake-rpm-macros = %{version}-%{release}
Requires: cmake-filesystem = %{version}-%{release}
Provides: cmake3 = %{version}-%{release} bundled(md5-deutsch) bundled(kwsys)
%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 cmake
Requires: cmake = %{version}-%{release} cmake-filesystem = %{version}-%{release}
Requires: cmake-rpm-macros = %{version}-%{release}
Requires: emacs-filesystem%{?_emacs_version: >= %{_emacs_version}}
BuildArch: noarch
%description data
This package contains common data-files for cmake.
%package filesystem
Summary: Directories used by CMake modules
%description filesystem
This package owns all directories used by CMake modules.
%package gui
Summary: Qt GUI for cmake
Requires: cmake = %{version}-%{release}
Requires: hicolor-icon-theme
Requires: shared-mime-info
%description gui
The cmake-gui package contains the Qt based GUI for cmake.
%package rpm-macros
Summary: Common RPM macros for cmake
Requires: rpm
Conflicts: cmake-data < 3.10.1-2
BuildArch: noarch
%description rpm-macros
This package contains common RPM macros for cmake.
%package help
Summary: Documentation for cmake
Provides: %{name}-doc = %{version}-%{release}
Obsoletes: %{name}-doc < %{version}-%{release}
BuildArch: noarch
%description help
Documentation for cmake.
%prep
%autosetup -n cmake-%{version}%{?versuf} -p 1
sed '1c #!%{__python3}' %{SOURCE4} > cmake.prov
sed '1c #!%{__python3}' %{SOURCE5} > cmake.req
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export LDFLAGS="%{?__global_ldflags}"
mkdir build
pushd build
../bootstrap --prefix=%{_prefix} --datadir=/share/cmake \
--docdir=/share/doc/cmake --mandir=/share/man \
--%{?with_bootstrap:no-}system-libs \
--parallel=`/usr/bin/getconf _NPROCESSORS_ONLN` \
%if %{with sphinx}
--sphinx-man --sphinx-html \
%else
--sphinx-build=%{_bindir}/false \
%endif
--qt-gui \
;
%make_build VERBOSE=1
%install
install -d %{buildroot}%{_pkgdocdir}
%make_install -C build CMAKE_DOC_DIR=%{buildroot}%{_pkgdocdir}
find %{buildroot}%{_datadir}/cmake/Modules -type f | xargs chmod -x
for f in ccmake cmake cpack ctest;
do
ln -s $f %{buildroot}%{_bindir}/${f}3;
done
install -d %{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
install -d %{buildroot}%{_emacs_sitelispdir}/cmake
install -p -m 0644 Auxiliary/cmake-mode.el %{buildroot}%{_emacs_sitelispdir}/cmake/cmake-mode.el
%{_emacs_bytecompile} %{buildroot}%{_emacs_sitelispdir}/cmake/cmake-mode.el
install -d %{buildroot}%{_emacs_sitestartdir}
install -p -m 0644 %SOURCE1 %{buildroot}%{_emacs_sitestartdir}
install -p -m0644 -D %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.cmake
sed -i -e "s|@@CMAKE_VERSION@@|%{version}|" -e "s|@@CMAKE_MAJOR_VERSION@@|3|" %{buildroot}%{rpm_macros_dir}/macros.cmake
touch -r %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.cmake
install -p -m0644 -D %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/fileattrs/cmake.attr
install -p -m0755 -D cmake.prov %{buildroot}%{_prefix}/lib/rpm/cmake.prov
install -p -m0755 -D cmake.req %{buildroot}%{_prefix}/lib/rpm/cmake.req
install -d %{buildroot}%{_libdir}/cmake
find Source Utilities -type f -iname copy\*
cp -p Source/kwsys/Copyright.txt ./Copyright_kwsys
cp -p Utilities/KWIML/Copyright.txt ./Copyright_KWIML
cp -p Utilities/cmlibarchive/COPYING ./COPYING_cmlibarchive
cp -p Utilities/cmliblzma/COPYING ./COPYING_cmliblzma
cp -p Utilities/cmcurl/COPYING ./COPYING_cmcurl
cp -p Utilities/cmlibrhash/COPYING ./COPYING_cmlibrhash
cp -p Utilities/cmzlib/Copyright.txt ./Copyright_cmzlib
cp -p Utilities/cmexpat/COPYING ./COPYING_cmexpat
cp -p Utilities/cmcompress/Copyright.txt ./Copyright_cmcompress
install -d %{buildroot}%{_pkgdocdir}
cp -pr %{buildroot}%{_datadir}/cmake/Help %{buildroot}%{_pkgdocdir}
desktop-file-install --delete-original \
--dir=%{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/cmake-gui.desktop
install -d %{buildroot}%{_metainfodir}
find %{buildroot}%{_datadir}/cmake -type d | sed -e 's!^%{buildroot}!%%dir "!g' -e 's!$!"!g' > data_dirs.mf
find %{buildroot}%{_datadir}/cmake -type f | sed -e 's!^%{buildroot}!"!g' -e 's!$!"!g' > data_files.mf
find %{buildroot}%{_libdir}/cmake -type d | sed -e 's!^%{buildroot}!%%dir "!g' -e 's!$!"!g' > lib_dirs.mf
find %{buildroot}%{_libdir}/cmake -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
%check
cd build
export NO_TEST="CMake.FileDownload|CTestTestUpload|curl|RunCMake.CPack_RPM"
bin/ctest -V -E "$NO_TEST" %{?_smp_mflags}
%post gui
update-desktop-database &> /dev/null || :
touch --no-create %{_datadir}/mime || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun gui
update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/mime || :
update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans gui
update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files -f lib_files.mf
%doc %dir %{_pkgdocdir}
%license Copyright_* COPYING* Copyright.txt
%files data -f data_files.mf
%{_datadir}/aclocal/cmake.m4
%{_datadir}/bash-completion
%{_emacs_sitelispdir}/cmake
%{_emacs_sitestartdir}/cmake-init.el
%files filesystem -f data_dirs.mf -f lib_dirs.mf
%files gui
%{_bindir}/cmake-gui
%{_datadir}/applications/cmake-gui.desktop
%{_datadir}/mime/packages
%{_datadir}/icons/hicolor/*/apps/CMake%{?name_suffix}Setup.png
%files rpm-macros
%{rpm_macros_dir}/macros.cmake
%{_rpmconfigdir}/fileattrs/cmake.attr
%{_rpmconfigdir}/cmake.prov
%{_rpmconfigdir}/cmake.req
%files help
%if %{with sphinx}
%{_mandir}/man1/ccmake.1.*
%{_mandir}/man1/cmake.1.*
%{_mandir}/man1/cpack.1.*
%{_mandir}/man1/ctest.1.*
%{_mandir}/man7/*.7.*
%{_mandir}/man1/cmake-gui.1.*
%endif
%doc %{_pkgdocdir}
%exclude %{_pkgdocdir}/Copyright.txt
%changelog
* Fri Nov 29 2019 lijin Yang <yanglijin@huawei.com> - 3.12.1-2
- init package

36
macros.cmake Normal file
View File

@ -0,0 +1,36 @@
#
# Macros for cmake
#
%_cmake_lib_suffix64 -DLIB_SUFFIX=64
%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
%_cmake_version @@CMAKE_VERSION@@
%__cmake /usr/bin/cmake
# - 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
%cmake \
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 ;} \
%__cmake \\\
-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" \
%{?_cmake_lib_suffix64} \\\
%endif \
-DBUILD_SHARED_LIBS:BOOL=ON
%cmake@@CMAKE_MAJOR_VERSION@@ %cmake