2013-08-16 11:35:44 +02:00
|
|
|
#
|
|
|
|
# Macros for cmake
|
|
|
|
#
|
|
|
|
%__cmake %{_bindir}/cmake
|
2014-08-18 10:21:42 +02:00
|
|
|
%__ctest %{_bindir}/ctest
|
2016-03-08 08:29:07 +01:00
|
|
|
%__builddir build
|
2016-08-26 12:34:52 +02:00
|
|
|
%__builder %__make
|
2016-09-26 13:02:24 +02:00
|
|
|
%__sourcedir .
|
2013-08-16 11:35:44 +02:00
|
|
|
|
|
|
|
%cmake \
|
2016-09-10 08:48:32 +02:00
|
|
|
find %__sourcedir -name CMakeLists.txt \\\
|
2014-07-02 10:57:25 +02:00
|
|
|
-exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \
|
2016-03-08 08:29:07 +01:00
|
|
|
mkdir -p %__builddir \
|
|
|
|
cd %__builddir \
|
2016-09-26 13:02:24 +02:00
|
|
|
%__cmake $OLDPWD/%__sourcedir \\\
|
2016-08-26 12:34:52 +02:00
|
|
|
%if "%__builder" == "%__make" \
|
|
|
|
-G"Unix Makefiles" \\\
|
|
|
|
%else \
|
|
|
|
-GNinja \\\
|
|
|
|
%endif \
|
2013-08-16 11:35:44 +02:00
|
|
|
-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} \\\
|
2015-11-13 10:24:59 +01:00
|
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
|
2016-08-26 12:34:52 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
|
2016-07-11 19:29:16 +02:00
|
|
|
-DCMAKE_C_FLAGS="${CFLAGS:-%optflags} -DNDEBUG" \\\
|
|
|
|
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags} -DNDEBUG" \\\
|
|
|
|
-DCMAKE_Fortran_FLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}} -DNDEBUG" \\\
|
2019-06-18 09:15:56 +02:00
|
|
|
-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" \\\
|
2013-08-16 11:35:44 +02:00
|
|
|
%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 \\\
|
2015-12-03 10:46:18 +01:00
|
|
|
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules
|
2013-08-16 11:35:44 +02:00
|
|
|
|
2019-03-14 15:07:22 +01:00
|
|
|
%__builder_verbose \
|
2016-08-26 12:34:52 +02:00
|
|
|
%if "%__builder" == "%__make" \
|
2019-03-14 15:07:22 +01:00
|
|
|
%{?_make_output_sync} VERBOSE=1 \\\
|
2016-08-26 12:34:52 +02:00
|
|
|
%else \
|
2019-03-14 15:07:22 +01:00
|
|
|
-v \\\
|
|
|
|
%endif \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%cmake_build %__builder \\%__builder_verbose %{?_smp_mflags}
|
2014-08-20 12:42:37 +02:00
|
|
|
|
2019-01-29 11:09:31 +01:00
|
|
|
%make_jobs \
|
|
|
|
echo "Deprecated %%make_jobs macro used, please use %%cmake_build" \
|
|
|
|
%cmake_build
|
|
|
|
|
2013-08-16 11:35:44 +02:00
|
|
|
%cmake_install \
|
2016-08-26 12:34:52 +02:00
|
|
|
DESTDIR=%{buildroot} %__builder install -C %__builddir
|
2014-08-18 10:21:42 +02:00
|
|
|
|
2019-02-18 09:54:21 +01:00
|
|
|
%ctest(:-:) \
|
2016-03-08 08:29:07 +01:00
|
|
|
cd %__builddir \
|
2019-02-18 09:54:21 +01:00
|
|
|
%__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} %** \
|
2014-08-18 10:21:42 +02:00
|
|
|
cd ..
|