forked from pool/cmake
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
This commit is contained in:
parent
c644d0d55b
commit
1b90ba4d09
@ -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
|
Sat Aug 3 12:23:35 UTC 2013 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
42
cmake.macros
Normal file
42
cmake.macros
Normal file
@ -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 ..
|
12
cmake.spec
12
cmake.spec
@ -21,6 +21,8 @@ Version: 2.8.11.2
|
|||||||
Release: 0
|
Release: 0
|
||||||
Url: http://www.cmake.org/
|
Url: http://www.cmake.org/
|
||||||
Source0: http://www.cmake.org/files/v2.8/%{name}-%{version}.tar.gz
|
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
|
Patch2: cmake-fix-ruby-test.patch
|
||||||
Patch3: cmake-fix-ImageMagick6.patch
|
Patch3: cmake-fix-ImageMagick6.patch
|
||||||
Patch4: cmake-cmCustomCommand_add_operator=.patch
|
Patch4: cmake-cmCustomCommand_add_operator=.patch
|
||||||
@ -80,13 +82,21 @@ make DESTDIR=%{buildroot} install
|
|||||||
mkdir -p %{buildroot}%{_libdir}/cmake
|
mkdir -p %{buildroot}%{_libdir}/cmake
|
||||||
find %{buildroot}/usr/share/cmake -type f -print0 | xargs -0 chmod 644
|
find %{buildroot}/usr/share/cmake -type f -print0 | xargs -0 chmod 644
|
||||||
cp ChangeLog.manual %{buildroot}/usr/share/doc/packages/%{name}/Changelog
|
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}
|
%if 0%{?suse_version}
|
||||||
%fdupes %buildroot/usr/share/cmake
|
%fdupes %{buildroot}/usr/share/cmake
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
|
%{_sysconfdir}/rpm/macros.cmake
|
||||||
%{_bindir}/cpack
|
%{_bindir}/cpack
|
||||||
%{_bindir}/cmake
|
%{_bindir}/cmake
|
||||||
%{_bindir}/ctest
|
%{_bindir}/ctest
|
||||||
|
8
opensuse_rules.cmake
Normal file
8
opensuse_rules.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SET (CMAKE_AR /usr/bin/ar CACHE FILEPATH "Archive manager" FORCE)
|
||||||
|
SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> OPTFLAGS <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
|
||||||
|
SET (CMAKE_C_COMPILER /usr/bin/gcc CACHE FILEPATH "C compiler" FORCE)
|
||||||
|
SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
|
||||||
|
SET (CMAKE_CXX_COMPILER /usr/bin/c++ CACHE FILEPATH "C++ compiler" FORCE)
|
||||||
|
SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>" 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)
|
Loading…
Reference in New Issue
Block a user