mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Ports: Add a kakoune port
This commit is contained in:
parent
6880359064
commit
fe94636ac3
Notes:
sideshowbarker
2024-07-17 05:49:44 +09:00
Author: https://github.com/demostanis Commit: https://github.com/SerenityOS/serenity/commit/fe94636ac3 Pull-request: https://github.com/SerenityOS/serenity/pull/15195 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/Xexxa ✅ Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/timschumi ✅
5 changed files with 110 additions and 0 deletions
|
@ -98,6 +98,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
|
|||
| [`joe`](joe/) | joe's own editor | 4.6 | https://joe-editor.sourceforge.io/ |
|
||||
| [`jot`](jot/) | jot (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy |
|
||||
| [`jq`](jq/) | jq | 1.6 | https://stedolan.github.io/jq/ |
|
||||
| [`kakoune`](kakoune/) | Modal text editor | 24d6072 | https://github.com/mawww/kakoune |
|
||||
| [`klong`](klong/) | Klong | 20220315 | https://t3x.org/klong/ |
|
||||
| [`less`](less/) | less | 590 | https://www.greenwoodsoftware.com/less/ |
|
||||
| [`libarchive`](libarchive/) | libarchive | 3.6.1 | https://libarchive.org/ |
|
||||
|
|
9
Ports/kakoune/package.sh
Executable file
9
Ports/kakoune/package.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env -S bash ../.port_include.sh
|
||||
port='kakoune'
|
||||
version='24d6072353f7c7e7cac84b4eb085036a8c852f96'
|
||||
files="https://github.com/mawww/kakoune/archive/${version}.tar.gz ${version}.tar.gz 16440b204770972f318e24e4e178ada474b7cfeb029cefa69e9ff035700a129e"
|
||||
auth_type='sha256'
|
||||
depends=("bash" "sed")
|
||||
makeopts+=(
|
||||
"LDFLAGS=-L${DESTDIR}/usr/local/lib"
|
||||
)
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: demostanis <demostanis@protonmail.com>
|
||||
Date: Sat, 10 Sep 2022 20:19:23 +0200
|
||||
Subject: [PATCH] Use /proc/self/exe on SerenityOS
|
||||
|
||||
---
|
||||
src/file.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/file.cc b/src/file.cc
|
||||
index d38c956..9c74364 100644
|
||||
--- a/src/file.cc
|
||||
+++ b/src/file.cc
|
||||
@@ -603,7 +603,7 @@ FsStatus get_fs_status(StringView filename)
|
||||
String get_kak_binary_path()
|
||||
{
|
||||
char buffer[2048];
|
||||
-#if defined(__linux__) or defined(__CYGWIN__) or defined(__gnu_hurd__)
|
||||
+#if defined(__linux__) or defined(__CYGWIN__) or defined(__gnu_hurd__) or defined(__serenity__)
|
||||
ssize_t res = readlink("/proc/self/exe", buffer, 2048);
|
||||
kak_assert(res != -1);
|
||||
buffer[res] = '\0';
|
||||
--
|
||||
2.37.3
|
||||
|
66
Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch
Normal file
66
Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch
Normal file
|
@ -0,0 +1,66 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: demostanis <demostanis@protonmail.com>
|
||||
Date: Sat, 10 Sep 2022 23:32:51 +0200
|
||||
Subject: [PATCH] Use bash instead of /bin/sh
|
||||
|
||||
---
|
||||
src/shell_manager.cc | 43 +++++--------------------------------------
|
||||
1 file changed, 5 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/shell_manager.cc b/src/shell_manager.cc
|
||||
index 96cfb06..4eb71db 100644
|
||||
--- a/src/shell_manager.cc
|
||||
+++ b/src/shell_manager.cc
|
||||
@@ -34,44 +34,11 @@ namespace Kakoune
|
||||
ShellManager::ShellManager(ConstArrayView<EnvVarDesc> builtin_env_vars)
|
||||
: m_env_vars{builtin_env_vars}
|
||||
{
|
||||
- auto is_executable = [](StringView path) {
|
||||
- struct stat st;
|
||||
- if (stat(path.zstr(), &st))
|
||||
- return false;
|
||||
-
|
||||
- bool executable = (st.st_mode & S_IXUSR)
|
||||
- | (st.st_mode & S_IXGRP)
|
||||
- | (st.st_mode & S_IXOTH);
|
||||
- return S_ISREG(st.st_mode) and executable;
|
||||
- };
|
||||
-
|
||||
- if (const char* shell = getenv("KAKOUNE_POSIX_SHELL"))
|
||||
- {
|
||||
- if (not is_executable(shell))
|
||||
- throw runtime_error{format("KAKOUNE_POSIX_SHELL '{}' is not executable", shell)};
|
||||
- m_shell = shell;
|
||||
- }
|
||||
- else // Get a guaranteed to be POSIX shell binary
|
||||
- {
|
||||
- #if defined(_CS_PATH)
|
||||
- auto size = confstr(_CS_PATH, nullptr, 0);
|
||||
- String path; path.resize(size-1, 0);
|
||||
- confstr(_CS_PATH, path.data(), size);
|
||||
- #else
|
||||
- StringView path = "/bin:/usr/bin";
|
||||
- #endif
|
||||
- for (auto dir : StringView{path} | split<StringView>(':'))
|
||||
- {
|
||||
- auto candidate = format("{}/sh", dir);
|
||||
- if (is_executable(candidate))
|
||||
- {
|
||||
- m_shell = std::move(candidate);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- if (m_shell.empty())
|
||||
- throw runtime_error{format("unable to find a posix shell in {}", path)};
|
||||
- }
|
||||
+ // We hardcode bash since /bin/sh (/bin/Shell) is not
|
||||
+ // a POSIX-compliant shell, that will error out when
|
||||
+ // fed with Kakoune's scripts. It is expected to be
|
||||
+ // installed along with the port.
|
||||
+ m_shell = "/usr/local/bin/bash";
|
||||
|
||||
// Add Kakoune binary location to the path to guarantee that %sh{ ... }
|
||||
// have access to the kak command regardless of if the user installed it
|
||||
--
|
||||
2.37.3
|
||||
|
9
Ports/kakoune/patches/ReadMe.md
Normal file
9
Ports/kakoune/patches/ReadMe.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Patches for Kakoune on SerenityOS
|
||||
|
||||
## `0001-Use-proc-self-exe-on-SerenityOS.patch`
|
||||
|
||||
Use /proc/self/exe on SerenityOS
|
||||
|
||||
## `0002-Use-bash-instead-of-bin-sh.patch`
|
||||
|
||||
Use bash instead of /bin/sh
|
Loading…
Reference in a new issue