From 1b90ba4d09b4ed1e03ade5ebebe80cc9487ccc899b55289d71132347efd83c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Fri, 16 Aug 2013 09:35:44 +0000 Subject: [PATCH] Accepting request 195426 from home:scarabeus_iv This change is followup for the discussion at ml: http://lists.opensuse.org/opensuse-factory/2013-08/msg00174.html I would propose proceed by the schedule I mentioned there. Most of this stuff is taken from what I did in Gentoo cmake system. - One more backslash here. - Backshlashes were missing in macros. - Add opensuse_rules.cmake to set the default compiler and linker opts. Tweak a bit the macro to not let upstreams twerk with the cmake files too much. - Provide macros.cmake which contains %cmake macro to reduce mess in the spec files. OBS-URL: https://build.opensuse.org/request/show/195426 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=122 --- cmake.changes | 23 +++++++++++++++++++++++ cmake.macros | 42 ++++++++++++++++++++++++++++++++++++++++++ cmake.spec | 12 +++++++++++- opensuse_rules.cmake | 8 ++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 cmake.macros create mode 100644 opensuse_rules.cmake diff --git a/cmake.changes b/cmake.changes index d50135c..e17b7c1 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Mon Aug 12 19:21:05 UTC 2013 - tchvatal@suse.com + +- One more backslash here. + +------------------------------------------------------------------- +Mon Aug 12 19:03:31 UTC 2013 - tchvatal@suse.com + +- Backshlashes were missing in macros. + +------------------------------------------------------------------- +Mon Aug 12 18:51:14 UTC 2013 - tchvatal@suse.com + +- Add opensuse_rules.cmake to set the default compiler and linker + opts. Tweak a bit the macro to not let upstreams twerk with the + cmake files too much. + +------------------------------------------------------------------- +Sun Aug 11 11:20:12 UTC 2013 - tchvatal@suse.com + +- Provide macros.cmake which contains %cmake macro to reduce + mess in the spec files. + ------------------------------------------------------------------- Sat Aug 3 12:23:35 UTC 2013 - hrvoje.senjan@gmail.com diff --git a/cmake.macros b/cmake.macros new file mode 100644 index 0000000..c58b5a0 --- /dev/null +++ b/cmake.macros @@ -0,0 +1,42 @@ +# +# Macros for cmake +# +%__cmake %{_bindir}/cmake +%_cmake_debug %{?with_debug:debug}%{?!with_debug:release} + +%cmake \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \ + find . -name CMakeLists.txt \\\ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \\\ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \\\ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \\\ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \ + mkdir -p build \ + cd build \ + %define enable_debug 1 \ + %{?_enable_debug: %{expand: %%global enable_debug 1}} \ + %__cmake .. \\\ + -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_BUILD_TYPE=%{_cmake_debug} \\\ +%if "%{?_lib}" == "lib64" \ + -DLIB_SUFFIX=64 \\\ +%endif \ + -DCMAKE_SKIP_RPATH:BOOL=ON \\\ + -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_USER_MAKE_RULES_OVERRIDE="/usr/share/cmake/Modules/opensuse_rules.cmake" + +%cmake_install \ + cd build \ + make DESTDIR=%{buildroot} install/fast \ + cd .. diff --git a/cmake.spec b/cmake.spec index 5ebd92b..8c63b85 100644 --- a/cmake.spec +++ b/cmake.spec @@ -21,6 +21,8 @@ Version: 2.8.11.2 Release: 0 Url: http://www.cmake.org/ Source0: http://www.cmake.org/files/v2.8/%{name}-%{version}.tar.gz +Source1: cmake.macros +Source2: opensuse_rules.cmake Patch2: cmake-fix-ruby-test.patch Patch3: cmake-fix-ImageMagick6.patch Patch4: cmake-cmCustomCommand_add_operator=.patch @@ -80,13 +82,21 @@ make DESTDIR=%{buildroot} install mkdir -p %{buildroot}%{_libdir}/cmake find %{buildroot}/usr/share/cmake -type f -print0 | xargs -0 chmod 644 cp ChangeLog.manual %{buildroot}/usr/share/doc/packages/%{name}/Changelog +# rpm macros +install -m644 %{SOURCE1} -D %{buildroot}%{_sysconfdir}/rpm/macros.cmake +# buildrules +install -m644 %{SOURCE2} -D %{buildroot}%{_datadir}/cmake/Modules/opensuse_rules.cmake +sed -i \ + -e 's:OPTFLAGS:%{optflags}:g' \ + %{buildroot}%{_datadir}/cmake/Modules/opensuse_rules.cmake %if 0%{?suse_version} -%fdupes %buildroot/usr/share/cmake +%fdupes %{buildroot}/usr/share/cmake %endif %files %defattr(-,root,root) +%{_sysconfdir}/rpm/macros.cmake %{_bindir}/cpack %{_bindir}/cmake %{_bindir}/ctest diff --git a/opensuse_rules.cmake b/opensuse_rules.cmake new file mode 100644 index 0000000..a44a800 --- /dev/null +++ b/opensuse_rules.cmake @@ -0,0 +1,8 @@ +SET (CMAKE_AR /usr/bin/ar CACHE FILEPATH "Archive manager" FORCE) +SET (CMAKE_ASM_COMPILE_OBJECT " OPTFLAGS -o -c " CACHE STRING "ASM compile command" FORCE) +SET (CMAKE_C_COMPILER /usr/bin/gcc CACHE FILEPATH "C compiler" FORCE) +SET (CMAKE_C_COMPILE_OBJECT " -o -c " CACHE STRING "C compile command" FORCE) +SET (CMAKE_CXX_COMPILER /usr/bin/c++ CACHE FILEPATH "C++ compiler" FORCE) +SET (CMAKE_CXX_COMPILE_OBJECT " -o -c " CACHE STRING "C++ compile command" FORCE) +SET (CMAKE_RANLIB /usr/bin/ranlib CACHE FILEPATH "Archive index generator" FORCE) +SET (PKG_CONFIG_EXECUTABLE /usr/bin/pkg-config CACHE FILEPATH "pkg-config executable" FORCE)