diff options
author | demostanis <demostanis@protonmail.com> | 2022-09-10 18:17:36 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-14 13:37:29 +0200 |
commit | fe94636ac3353e737299463a47e5afb0c6dd24ff (patch) | |
tree | 4ff1fba84f973c0244e40b91ba0b9ee97a086aa9 /Ports/kakoune | |
parent | 68803590643280f43532c1588bfbd4107eba3fb9 (diff) | |
download | serenity-fe94636ac3353e737299463a47e5afb0c6dd24ff.zip |
Ports: Add a kakoune port
Diffstat (limited to 'Ports/kakoune')
-rwxr-xr-x | Ports/kakoune/package.sh | 9 | ||||
-rw-r--r-- | Ports/kakoune/patches/0001-Use-proc-self-exe-on-SerenityOS.patch | 25 | ||||
-rw-r--r-- | Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch | 66 | ||||
-rw-r--r-- | Ports/kakoune/patches/ReadMe.md | 9 |
4 files changed, 109 insertions, 0 deletions
diff --git a/Ports/kakoune/package.sh b/Ports/kakoune/package.sh new file mode 100755 index 0000000000..75388e1255 --- /dev/null +++ b/Ports/kakoune/package.sh @@ -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" +) diff --git a/Ports/kakoune/patches/0001-Use-proc-self-exe-on-SerenityOS.patch b/Ports/kakoune/patches/0001-Use-proc-self-exe-on-SerenityOS.patch new file mode 100644 index 0000000000..10f18861d7 --- /dev/null +++ b/Ports/kakoune/patches/0001-Use-proc-self-exe-on-SerenityOS.patch @@ -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 + diff --git a/Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch b/Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch new file mode 100644 index 0000000000..23b591a0a3 --- /dev/null +++ b/Ports/kakoune/patches/0002-Use-bash-instead-of-bin-sh.patch @@ -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 + diff --git a/Ports/kakoune/patches/ReadMe.md b/Ports/kakoune/patches/ReadMe.md new file mode 100644 index 0000000000..ba302dae33 --- /dev/null +++ b/Ports/kakoune/patches/ReadMe.md @@ -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 |