From b391c89a1a472fb497757322e9277f04f8521c0f0e0d8db6f396c59006fb9c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 20 Aug 2014 10:42:37 +0000 Subject: [PATCH 1/2] Accepting request 245174 from KDE:Unstable:Frameworks - 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/245174 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=169 --- cmake.changes | 13 +++++++++++++ cmake.macros | 21 +++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/cmake.changes b/cmake.changes index 7f01eec..f743d0a 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +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 diff --git a/cmake.macros b/cmake.macros index c79e2a8..85d1665 100644 --- a/cmake.macros +++ b/cmake.macros @@ -3,18 +3,12 @@ # %__cmake %{_bindir}/cmake %__ctest %{_bindir}/ctest -%_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 -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \ 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} \\\ @@ -22,7 +16,13 @@ -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\ -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\ -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" \\\ + -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\ %if "%{?_lib}" == "lib64" \ -DLIB_SUFFIX=64 \\\ %endif \ @@ -35,10 +35,11 @@ -DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules \\\ -DCMAKE_USER_MAKE_RULES_OVERRIDE="%{_datadir}/cmake/Modules/opensuse_rules.cmake" +%make_jobs \ + %{__make} %{?_smp_mflags} VERBOSE=1 + %cmake_install \ - cd build \ - make DESTDIR=%{buildroot} install/fast \ - cd .. + make VERBOSE=1 DESTDIR=%{buildroot} install/fast -C build \ %ctest \ cd build \ From 303c3d7affde82c592ba24bd90d87980921fdd50c928c67481c577c3e1b2bc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 20 Aug 2014 10:46:19 +0000 Subject: [PATCH 2/2] - Also pass -Wl,-z,now lets see if that is passable :) OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=170 --- cmake.changes | 5 +++++ cmake.macros | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake.changes b/cmake.changes index f743d0a..1eaced3 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +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 diff --git a/cmake.macros b/cmake.macros index 85d1665..7063ad0 100644 --- a/cmake.macros +++ b/cmake.macros @@ -20,9 +20,9 @@ -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" \\\ - -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\ - -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\ + -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" \ -DLIB_SUFFIX=64 \\\ %endif \ @@ -36,10 +36,10 @@ -DCMAKE_USER_MAKE_RULES_OVERRIDE="%{_datadir}/cmake/Modules/opensuse_rules.cmake" %make_jobs \ - %{__make} %{?_smp_mflags} VERBOSE=1 + %__make %{?_smp_mflags} VERBOSE=1 %cmake_install \ - make VERBOSE=1 DESTDIR=%{buildroot} install/fast -C build \ + %__make VERBOSE=1 DESTDIR=%{buildroot} install/fast -C build %ctest \ cd build \