forked from pool/cmake
1b90ba4d09
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
43 lines
1.8 KiB
Plaintext
43 lines
1.8 KiB
Plaintext
#
|
|
# 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 ..
|