commit:     737b23a0af4224a9d02d23ede7f41ab6dbd97319
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  1 06:32:31 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct  1 06:33:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=737b23a0

app-editors/neovim: fix respecting CFLAGS; try avoid sandbox violation

- RelWithDebInfo sets -Og -g after our flags. (Made a local hook for now
  to try catch these in future, along with -ffast-math, although that wasn't
  being set here.)

- Use xdg_environment_reset to try avoid sandbox issues (see
  https://forums.gentoo.org/viewtopic-p-8750050.html).

  Also sent a patch to gentoo-dev ML for adding XDG_STATE_HOME to
  the unset/reset list for the eclass.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../neovim/files/neovim-9999-cmake-release-type.patch     | 15 +++++++++++++++
 .../{neovim-0.8.0.ebuild => neovim-0.8.0-r1.ebuild}       |  5 ++++-
 app-editors/neovim/neovim-9999.ebuild                     |  5 ++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/app-editors/neovim/files/neovim-9999-cmake-release-type.patch 
b/app-editors/neovim/files/neovim-9999-cmake-release-type.patch
index 1d7fb56b51c8..8114e2a92b74 100644
--- a/app-editors/neovim/files/neovim-9999-cmake-release-type.patch
+++ b/app-editors/neovim/files/neovim-9999-cmake-release-type.patch
@@ -11,3 +11,18 @@ https://bugs.gentoo.org/757744
      call health#report_ok(buildtype)
    else
      call health#report_info(buildtype)
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -137,12 +137,6 @@ else()
+   message(STATUS "MIN_LOG_LEVEL=${MIN_LOG_LEVEL}")
+ endif()
+ 
+-# Default to -O2 on release builds.
+-if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
+-  message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2")
+-  string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+-endif()
+-
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
+   check_c_compiler_flag(-Og HAS_OG_FLAG)
+ else()

diff --git a/app-editors/neovim/neovim-0.8.0.ebuild 
b/app-editors/neovim/neovim-0.8.0-r1.ebuild
similarity index 96%
rename from app-editors/neovim/neovim-0.8.0.ebuild
rename to app-editors/neovim/neovim-0.8.0-r1.ebuild
index 2e5948e10f45..fe675b291f83 100644
--- a/app-editors/neovim/neovim-0.8.0.ebuild
+++ b/app-editors/neovim/neovim-0.8.0-r1.ebuild
@@ -3,8 +3,9 @@
 
 EAPI=8
 
+# RelWithDebInfo sets -Og -g
+CMAKE_BUILD_TYPE=Release
 LUA_COMPAT=( lua5-{1..2} luajit )
-
 inherit cmake lua-single optfeature xdg
 
 DESCRIPTION="Vim-fork focused on extensibility and agility"
@@ -88,6 +89,8 @@ src_prepare() {
        sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \
                -i src/nvim/globals.h || die
 
+       # https://forums.gentoo.org/viewtopic-p-8750050.html
+       xdg_environment_reset
        cmake_src_prepare
 }
 

diff --git a/app-editors/neovim/neovim-9999.ebuild 
b/app-editors/neovim/neovim-9999.ebuild
index 2e5948e10f45..fe675b291f83 100644
--- a/app-editors/neovim/neovim-9999.ebuild
+++ b/app-editors/neovim/neovim-9999.ebuild
@@ -3,8 +3,9 @@
 
 EAPI=8
 
+# RelWithDebInfo sets -Og -g
+CMAKE_BUILD_TYPE=Release
 LUA_COMPAT=( lua5-{1..2} luajit )
-
 inherit cmake lua-single optfeature xdg
 
 DESCRIPTION="Vim-fork focused on extensibility and agility"
@@ -88,6 +89,8 @@ src_prepare() {
        sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \
                -i src/nvim/globals.h || die
 
+       # https://forums.gentoo.org/viewtopic-p-8750050.html
+       xdg_environment_reset
        cmake_src_prepare
 }
 

Reply via email to