diff options
author | Slava Barinov <v.barinov@samsung.com> | 2023-03-20 12:35:30 +0300 |
---|---|---|
committer | Slava Barinov <v.barinov@samsung.com> | 2023-03-21 11:20:28 +0300 |
commit | b28e77504fdbc2e3fc9bb3b85344a162064779f2 (patch) | |
tree | 3b05a2383aaf05808eb56b89cd87dd680f3a7ef6 | |
parent | 13f191761ceaf3fc7ba6b64297d6c1e43eca56b7 (diff) | |
download | cmake-accepted/tizen_base_tool_dev.tar.gz cmake-accepted/tizen_base_tool_dev.tar.bz2 cmake-accepted/tizen_base_tool_dev.zip |
Add support for ar/nm/ranlib wrappers for LTOsubmit/tizen_base_dev/20230607.110014submit/tizen_base/20230331.042222accepted/tizen/base/tool/dev/20230608.110757tizen_base_devaccepted/tizen_base_tool_dev
Switching to Binutils wrappers for ar, nm and ranlib are required for proper
functioning of Link-Time Optimization features. Currently full support of LTO
plugin is not ready in Binutils, so we need to use wrappers to prevent
"undefined reference" errors.
Change-Id: I7a944b6b26da1549aeb010c6d56120d7f172a020
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
-rw-r--r-- | packaging/cmake.spec | 11 | ||||
-rw-r--r-- | packaging/macros.cmake | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/packaging/cmake.spec b/packaging/cmake.spec index c8e46813a..1578cf856 100644 --- a/packaging/cmake.spec +++ b/packaging/cmake.spec @@ -36,6 +36,17 @@ cp %{SOURCE1001} . %build export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -pie" export CFLAGS="$CXXFLAGS" + +# Set up default CMake configuration for ranlib, ar and nm, so we can build +# both CMake and target packages with LTO +insertconfline() { + sed -e "/^' > .*InitialCacheFlags.cmake\"/i ${1}" -i bootstrap +} + +insertconfline "set (CMAKE_RANLIB \"$(which %__ranlib)\" CACHE FILEPATH \"Path to ranlib tool.\" FORCE)" +insertconfline "set (CMAKE_AR \"$(which %__ar)\" CACHE FILEPATH \"Path to ar tool.\" FORCE)" +insertconfline "set (CMAKE_NM \"$(which %__nm)\" CACHE FILEPATH \"Path to nm tool.\" FORCE)" + ./configure \ --prefix=%{_prefix} \ --datadir=/share/%{name} \ diff --git a/packaging/macros.cmake b/packaging/macros.cmake index 42ada2327..480962493 100644 --- a/packaging/macros.cmake +++ b/packaging/macros.cmake @@ -6,6 +6,9 @@ %__cmake %{_bindir}/cmake %cmake \ + AR="%__ar"; export AR ; \ + NM="%__nm"; export NM ; \ + RANLIB="%__ranlib"; export RANLIB ; \ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ |