summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2020-03-19 02:14:03 +0900
committerbiao716.wang <biao716.wang@samsung.com>2020-03-18 10:53:01 +0800
commit22838cb0059ea5d57f55774a3b7f074aa6883d56 (patch)
treeea44851bae31f9c0c5fdf674c8930c49b73615bf
parent1d6613f4446f69f63beddf2d97c201154fb35e33 (diff)
downloadcmake-22838cb0059ea5d57f55774a3b7f074aa6883d56.tar.gz
cmake-22838cb0059ea5d57f55774a3b7f074aa6883d56.tar.bz2
cmake-22838cb0059ea5d57f55774a3b7f074aa6883d56.zip
fix build error with 3.16.4 version
Change-Id: Ic0e3032869993efdc7c773f147010f0e0cd6c6d7 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
-rw-r--r--packaging/cmake.attr2
-rw-r--r--packaging/cmake.prov78
-rw-r--r--packaging/cmake.spec18
-rw-r--r--packaging/macros.cmake63
4 files changed, 144 insertions, 17 deletions
diff --git a/packaging/cmake.attr b/packaging/cmake.attr
new file mode 100644
index 000000000..2b2bbbc22
--- /dev/null
+++ b/packaging/cmake.attr
@@ -0,0 +1,2 @@
+%__cmake_provides %{_rpmconfigdir}/cmake.prov
+%__cmake_path ^/usr/lib(64)?/cmake/.*/.*(Config\.cmake|-config\.cmake)$
diff --git a/packaging/cmake.prov b/packaging/cmake.prov
new file mode 100644
index 000000000..3a45753f7
--- /dev/null
+++ b/packaging/cmake.prov
@@ -0,0 +1,78 @@
+#!/usr/bin/python3
+# -*- 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:
+ for (modulePath, cmakeModule, lowercase) in self.parseCmakeModuleConfig(path):
+ 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])
+
+ result = []
+ for configFile in glob.glob("%s/*Config.cmake" % modulePath):
+ moduleName = configFile[len(modulePath) + 1:-len("Config.cmake")]
+ result.append( (modulePath, moduleName, False) )
+
+ for configFile in glob.glob("%s/*-config.cmake" % modulePath):
+ moduleName = configFile[len(modulePath) + 1:-len("-config.cmake")]
+ if (modulePath, moduleName, False) not in result:
+ result.append( (modulePath, moduleName, True) )
+
+ return result
+
+ 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()
+
diff --git a/packaging/cmake.spec b/packaging/cmake.spec
index 733244aea..32b0ac04d 100644
--- a/packaging/cmake.spec
+++ b/packaging/cmake.spec
@@ -9,13 +9,20 @@ Source0: http://www.cmake.org/files/v3.16/cmake-%{version}.tar.gz
Source1: macros.cmake
Source2: TizenCommon.cmake
Source1001: cmake.manifest
+
BuildRequires: fdupes
-BuildRequires: expat-devel
-BuildRequires: pkgconfig(libarchive) >= 2.8.0
+BuildRequires: gcc-c++
+BuildRequires: pkgconfig
+BuildRequires: pkgconfig(expat)
+BuildRequires: pkgconfig(bzip2)
+BuildRequires: pkgconfig(openssl1.1)
+BuildRequires: pkgconfig(ncurses)
+BuildRequires: pkgconfig(liblzma)
+BuildRequires: pkgconfig(libarchive) >= 3.3.3
BuildRequires: pkgconfig(zlib)
+BuildRequires: pkgconfig(libcurl)
+#BuildRequires: pkgconfig(libzstd)
BuildRequires: procps
-BuildRequires: ncurses-devel
-BuildRequires: gcc-c++
%description
CMake is used to control the software compilation process using simple platform
@@ -45,8 +52,7 @@ export LDFLAGS="-ltinfo"
--no-system-curl \
--no-system-jsoncpp \
--no-system-librhash \
- --no-system-libuv \
- --no-system-form
+ --no-system-libuv
%__make VERBOSE=1 %{?_smp_mflags}
%install
diff --git a/packaging/macros.cmake b/packaging/macros.cmake
index 42ada2327..37ec99c12 100644
--- a/packaging/macros.cmake
+++ b/packaging/macros.cmake
@@ -1,24 +1,65 @@
#
# Macros for cmake
#
-%_cmake_lib_suffix64 -DLIB_SUFFIX=64
-%_cmake_skip_rpath -DCMAKE_SKIP_RPATH:BOOL=ON
%__cmake %{_bindir}/cmake
+%__ctest %{_bindir}/ctest
+%__builddir build
+%__builder %__make
+%__sourcedir .
%cmake \
- CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
- CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
- FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
- %__cmake \\\
- -DCMAKE_VERBOSE_MAKEFILE=ON \\\
+ find %__sourcedir -name CMakeLists.txt \\\
+ -exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \
+ mkdir -p %__builddir \
+ cd %__builddir \
+ %__cmake $OLDPWD/%__sourcedir \\\
+%if "%__builder" == "%__make" \
+ -G"Unix Makefiles" \\\
+%else \
+ -GNinja \\\
+%endif \
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
- -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
+ -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
+ -DCMAKE_C_FLAGS="${CFLAGS:-%optflags} -DNDEBUG" \\\
+ -DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags} -DNDEBUG" \\\
+ -DCMAKE_Fortran_FLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}} -DNDEBUG" \\\
+ -DCMAKE_EXE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
+ -DCMAKE_MODULE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed" \\\
+ -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
%if "%{?_lib}" == "lib64" \
- %{?_cmake_lib_suffix64} \\\
+ -DLIB_SUFFIX=64 \\\
+%endif \
+ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
+ -DBUILD_SHARED_LIBS:BOOL=ON \\\
+ -DBUILD_STATIC_LIBS:BOOL=OFF \\\
+ -DCMAKE_COLOR_MAKEFILE:BOOL=OFF \\\
+ -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \\\
+ -DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules
+
+%__builder_verbose \
+%if "%__builder" == "%__make" \
+ %{?_make_output_sync} VERBOSE=1 \\\
+%else \
+ -v \\\
%endif \
- %{?_cmake_skip_rpath} \\\
- -DBUILD_SHARED_LIBS:BOOL=ON
+%{nil}
+
+%cmake_build %__builder \\%__builder_verbose %{?_smp_mflags}
+
+%make_jobs \
+ echo "Deprecated %%make_jobs macro used, please use %%cmake_build" \
+ %cmake_build
+
+%cmake_install \
+ DESTDIR=%{buildroot} %__builder install -C %__builddir
+
+%ctest(:-:) \
+ cd %__builddir \
+ %__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %** \
+ cd ..
+