redox/recipes/wip/text/neovim/redox.patch
2025-09-16 16:30:46 +07:00

142 lines
5.1 KiB
Diff

diff -ruwN source/runtime/CMakeLists.txt source-new/runtime/CMakeLists.txt
--- source/runtime/CMakeLists.txt 2025-07-13 01:34:12.000000000 +0700
+++ source-new/runtime/CMakeLists.txt 2025-09-16 14:46:20.134790482 +0700
@@ -24,37 +24,6 @@
file(GLOB PACKAGES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*)
-set(GENERATED_PACKAGE_TAGS)
-foreach(PACKAGE ${PACKAGES})
- get_filename_component(PACKNAME ${PACKAGE} NAME)
- file(GLOB "${PACKNAME}_DOC_FILES" CONFIGURE_DEPENDS ${PACKAGE}/doc/*.txt)
- if(${PACKNAME}_DOC_FILES)
- file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
- add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
- COMMAND $<TARGET_FILE:nvim_bin>
- -u NONE -i NONE -e --headless -c "helptags doc" -c quit
- DEPENDS
- nvim_bin
- nvim_runtime_deps
- WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
- )
-
- set("${PACKNAME}_DOC_NAMES")
- foreach(DF "${${PACKNAME}_DOC_FILES}")
- get_filename_component(F ${DF} NAME)
- list(APPEND "${PACKNAME}_DOC_NAMES" ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/${F})
- endforeach()
-
- install_helper(
- FILES ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags "${${PACKNAME}_DOC_NAMES}"
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/pack/dist/opt/${PACKNAME}/doc)
-
- list(APPEND GENERATED_PACKAGE_TAGS "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags")
- endif()
-endforeach()
-
set(BUILDDOCFILES)
foreach(DF ${DOCFILES})
get_filename_component(F ${DF} NAME)
@@ -65,8 +34,6 @@
COMMAND ${CMAKE_COMMAND} -E remove_directory doc
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/runtime/doc doc
- COMMAND $<TARGET_FILE:nvim_bin>
- -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
DEPENDS
nvim_bin
nvim_runtime_deps
@@ -78,7 +45,6 @@
DEPENDS
${GENERATED_SYN_VIM}
${GENERATED_HELP_TAGS}
- ${GENERATED_PACKAGE_TAGS}
)
# CMake is painful here. It will create the destination using the user's
@@ -88,10 +54,6 @@
# If it's preexisting, leave it alone.
install_helper(
- FILES ${GENERATED_HELP_TAGS} ${BUILDDOCFILES}
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/doc)
-
-install_helper(
FILES ${GENERATED_SYN_VIM}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/syntax/vim)
diff -ruwN source/src/nvim/channel.c source-new/src/nvim/channel.c
--- source/src/nvim/channel.c 2025-07-13 01:34:12.000000000 +0700
+++ source-new/src/nvim/channel.c 2025-09-16 13:41:27.109978099 +0700
@@ -547,8 +547,23 @@
// Redirect stdout/stdin (the UI channel) to stderr. Use fnctl(F_DUPFD_CLOEXEC) instead of dup()
// to prevent child processes from inheriting the file descriptors, which are used by UIs to
// detect when Nvim exits.
+ #ifdef __redox__
+ int new_stdin_fd = dup(STDIN_FILENO);
+ if (new_stdin_fd >= 0) {
+ fcntl(new_stdin_fd, F_SETFD, FD_CLOEXEC);
+ }
+ stdin_dup_fd = new_stdin_fd;
+
+ // 2. Duplicate STDOUT and set CLOEXEC flag
+ int new_stdout_fd = dup(STDOUT_FILENO);
+ if (new_stdout_fd >= 0) {
+ fcntl(new_stdout_fd, F_SETFD, FD_CLOEXEC);
+ }
+ stdout_dup_fd = new_stdout_fd;
+ #else
stdin_dup_fd = fcntl(STDIN_FILENO, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
stdout_dup_fd = fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
+ #endif // __redox__
dup2(STDERR_FILENO, STDOUT_FILENO);
dup2(STDERR_FILENO, STDIN_FILENO);
}
diff -ruwN source/src/nvim/CMakeLists.txt source-new/src/nvim/CMakeLists.txt
--- source/src/nvim/CMakeLists.txt 2025-07-13 01:34:12.000000000 +0700
+++ source-new/src/nvim/CMakeLists.txt 2025-09-16 16:07:40.327319085 +0700
@@ -93,19 +93,6 @@
endif()
# -fstack-protector breaks Mingw-w64 builds
-if(NOT MINGW)
- check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
- if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
- target_compile_options(main_lib INTERFACE -fstack-protector-strong)
- target_link_libraries(main_lib INTERFACE -fstack-protector-strong)
- else()
- check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
- if(HAS_FSTACK_PROTECTOR_FLAG)
- target_compile_options(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4)
- target_link_libraries(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4)
- endif()
- endif()
-endif()
# Compiler specific options
if(MSVC)
@@ -145,9 +132,6 @@
# Platform specific options
if(UNIX)
target_link_libraries(main_lib INTERFACE m)
- if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
- target_link_libraries(main_lib INTERFACE util)
- endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
diff -ruwN source/src/nvim/os/os_defs.h source-new/src/nvim/os/os_defs.h
--- source/src/nvim/os/os_defs.h 2025-07-13 01:34:12.000000000 +0700
+++ source-new/src/nvim/os/os_defs.h 2025-09-16 13:45:00.379142388 +0700
@@ -28,6 +28,8 @@
#if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX)
# define NAME_MAX _XOPEN_NAME_MAX
+#elif !defined(NAME_MAX)
+# define NAME_MAX 255
#endif
#define BASENAMELEN (NAME_MAX - 5)