forked from pool/cmake
Accepting request 245572 from devel:tools:building
- Also pass -Wl,-z,now lets see if that is passable :) - Import some cmake handing from kf5- and kde4- filesystem to macros: * Simplify debug build handling in macros. Whether debug is on or off is known to optflags * Don't build in release mode, that cramps optimization flags; instead pass wanted flags directly * Pass -Wl,--as-needed -Wl,--no-undefined to linker, to avoid unneeded libs, and to disallow undefined symbols * Add a %make_jobs macro with verbose argument * Simplify %cmake_install invocation OBS-URL: https://build.opensuse.org/request/show/245572 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cmake?expand=0&rev=92
This commit is contained in:
commit
ddb8ad070b
@ -1,3 +1,21 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Aug 20 10:45:49 UTC 2014 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Also pass -Wl,-z,now lets see if that is passable :)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 18 23:09:38 UTC 2014 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
- Import some cmake handing from kf5- and kde4- filesystem to macros:
|
||||||
|
* Simplify debug build handling in macros. Whether debug is on
|
||||||
|
or off is known to optflags
|
||||||
|
* Don't build in release mode, that cramps optimization flags;
|
||||||
|
instead pass wanted flags directly
|
||||||
|
* Pass -Wl,--as-needed -Wl,--no-undefined to linker, to avoid
|
||||||
|
unneeded libs, and to disallow undefined symbols
|
||||||
|
* Add a %make_jobs macro with verbose argument
|
||||||
|
* Simplify %cmake_install invocation
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Aug 18 08:20:28 UTC 2014 - tchvatal@suse.com
|
Mon Aug 18 08:20:28 UTC 2014 - tchvatal@suse.com
|
||||||
|
|
||||||
|
21
cmake.macros
21
cmake.macros
@ -3,18 +3,12 @@
|
|||||||
#
|
#
|
||||||
%__cmake %{_bindir}/cmake
|
%__cmake %{_bindir}/cmake
|
||||||
%__ctest %{_bindir}/ctest
|
%__ctest %{_bindir}/ctest
|
||||||
%_cmake_debug %{?with_debug:debug}%{?!with_debug:release}
|
|
||||||
|
|
||||||
%cmake \
|
%cmake \
|
||||||
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
|
|
||||||
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
|
|
||||||
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \
|
|
||||||
find . -name CMakeLists.txt \\\
|
find . -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 /}' {} + \
|
-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 build \
|
mkdir -p build \
|
||||||
cd build \
|
cd build \
|
||||||
%define enable_debug 1 \
|
|
||||||
%{?_enable_debug: %{expand: %%global enable_debug 1}} \
|
|
||||||
%__cmake .. \\\
|
%__cmake .. \\\
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
|
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
|
||||||
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
|
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
|
||||||
@ -22,7 +16,13 @@
|
|||||||
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
|
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
|
||||||
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
|
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
|
||||||
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
|
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
|
||||||
-DCMAKE_BUILD_TYPE=%{_cmake_debug} \\\
|
-DCMAKE_BUILD_TYPE=None \\\
|
||||||
|
-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="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
||||||
|
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
||||||
|
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
||||||
%if "%{?_lib}" == "lib64" \
|
%if "%{?_lib}" == "lib64" \
|
||||||
-DLIB_SUFFIX=64 \\\
|
-DLIB_SUFFIX=64 \\\
|
||||||
%endif \
|
%endif \
|
||||||
@ -35,10 +35,11 @@
|
|||||||
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules \\\
|
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules \\\
|
||||||
-DCMAKE_USER_MAKE_RULES_OVERRIDE="%{_datadir}/cmake/Modules/opensuse_rules.cmake"
|
-DCMAKE_USER_MAKE_RULES_OVERRIDE="%{_datadir}/cmake/Modules/opensuse_rules.cmake"
|
||||||
|
|
||||||
|
%make_jobs \
|
||||||
|
%__make %{?_smp_mflags} VERBOSE=1
|
||||||
|
|
||||||
%cmake_install \
|
%cmake_install \
|
||||||
cd build \
|
%__make VERBOSE=1 DESTDIR=%{buildroot} install/fast -C build
|
||||||
make DESTDIR=%{buildroot} install/fast \
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
%ctest \
|
%ctest \
|
||||||
cd build \
|
cd build \
|
||||||
|
Loading…
Reference in New Issue
Block a user