From 660bc3ed56fcdf2cbee65835903bfbd657ae3576 Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 22 May 2026 10:57:41 -0300 Subject: [PATCH] ports: ksh93 --- patches/ksh93/jinx-working-patch.patch | 148 +++++++++++++++++++++++++ recipes/ksh93 | 18 +++ source-recipes/ksh93 | 11 ++ 3 files changed, 177 insertions(+) create mode 100644 patches/ksh93/jinx-working-patch.patch create mode 100644 recipes/ksh93 create mode 100644 source-recipes/ksh93 diff --git a/patches/ksh93/jinx-working-patch.patch b/patches/ksh93/jinx-working-patch.patch new file mode 100644 index 00000000..b77d98b5 --- /dev/null +++ b/patches/ksh93/jinx-working-patch.patch @@ -0,0 +1,148 @@ +diff --git ksh93-clean/src/cmd/builtin/features/pty ksh93-workdir/src/cmd/builtin/features/pty +index 335f0d6..23f3062 100644 +--- ksh93-clean/src/cmd/builtin/features/pty ++++ ksh93-workdir/src/cmd/builtin/features/pty +@@ -14,41 +14,11 @@ lib cfmakeraw termios.h + typ useconds_t = uint32_t + + tst output{ +- #include +- #if _lib_ptsname +- #include +- #endif +- #include +- #include +- #include +- #include ++ #include + int main(void) + { +- size_t i; +- struct stat statb; +- static char* pty[] = { "/dev/ptyp0000", "/dev/ptym/ptyp0", "/dev/ptyp0" }; +- #if _lib_ptsname +- int fd; +- static char* ptc[] = { "/dev/ptmx", "/dev/ptc", "/dev/ptmx_bsd" }; +- +- for (i = 0; i < sizeof(ptc) / sizeof(ptc[0]); i++) +- if((fd = open(ptc[i], 2))>=0) +- { +- if (ptsname(fd)) +- { +- sfprintf(sfstdout, "#define _pty_clone\t\"%s\"\n", ptc[i]); +- close(fd); +- break; +- } +- close(fd); +- } +- #endif +- for (i = 0;; i++) +- if(i >= (sizeof(pty) / sizeof(pty[0]) - 1) || stat(pty[i], &statb)>=0) +- { +- sfprintf(sfstdout, "#define _pty_first\t\"%s\"\n", pty[i]); +- break; +- } ++ printf("#define _pty_clone\t\"/dev/ptmx\"\n"); ++ printf("#define _pty_first\t\"/dev/ptyp0\"\n"); + return 0; + } + }end fail{ +diff --git ksh93-clean/src/cmd/ksh93/sh/init.c ksh93-workdir/src/cmd/ksh93/sh/init.c +index 34fa8e0..359bff1 100644 +--- ksh93-clean/src/cmd/ksh93/sh/init.c ++++ ksh93-workdir/src/cmd/ksh93/sh/init.c +@@ -654,7 +654,7 @@ static Sfdouble_t nget_rand(Namval_t *np, Namfun_t *fp) + sh_save_rand_seed(rp, 1); + do + /* don't use lower bits when generating large numbers */ +- cur = (nrand48(rp->rand_seed) >> 3) & RANDMASK; ++ cur = ((uint32_t)jrand48(rp->rand_seed) >> 3) & RANDMASK; + while(cur==last); + *lp = cur; + return (Sfdouble_t)cur; +diff --git ksh93-clean/src/cmd/ksh93/sh/lex.c ksh93-workdir/src/cmd/ksh93/sh/lex.c +index ab97b48..b6c6f85 100644 +--- ksh93-clean/src/cmd/ksh93/sh/lex.c ++++ ksh93-workdir/src/cmd/ksh93/sh/lex.c +@@ -37,6 +37,7 @@ + #include "shlex.h" + #include "builtins.h" + #include ++#include + + #define TEST_RE 3 + #define SYNBAD 3 /* exit value for syntax errors */ +diff --git ksh93-clean/src/lib/libast/features/fs ksh93-workdir/src/lib/libast/features/fs +index fe875ff..2378b6f 100644 +--- ksh93-clean/src/lib/libast/features/fs ++++ ksh93-workdir/src/lib/libast/features/fs +@@ -11,6 +11,10 @@ extern stat int (const char*, struct stat*) + + define FS_default "ufs" + ++cat{ ++ #include ++}end ++ + macro{ + #include + #include +diff --git ksh93-clean/src/lib/libast/features/lib ksh93-workdir/src/lib/libast/features/lib +index 7e07aca..01414e9 100644 +--- ksh93-clean/src/lib/libast/features/lib ++++ ksh93-workdir/src/lib/libast/features/lib +@@ -36,7 +36,7 @@ lib rand_r + lib rewinddir,setlocale + lib setpgrp,setpgrp2,setreuid,setuid + lib socketpair +-lib clone,spawn,spawnve ++lib spawn,spawnve + lib strlcat,strlcpy + lib strmode,strftime,symlink,sysconf,sysinfo + lib telldir,tmpnam,tzset,universe,unlink,utime,wctype +diff --git ksh93-clean/src/lib/libast/features/wchar ksh93-workdir/src/lib/libast/features/wchar +index c078fa8..8c51d8e 100644 +--- ksh93-clean/src/lib/libast/features/wchar ++++ ksh93-workdir/src/lib/libast/features/wchar +@@ -20,6 +20,7 @@ run{ + cat < ++ #define _MLIBC_INTERNAL_FILE_T_H 1 + #include /* NODEP */ + #endif + ! +@@ -137,6 +138,9 @@ run{ + #if !_lib_wcstombs + extern size_t wcstombs(char*, const wchar_t*, size_t); + #endif ++ #if _lib_wcwidth ++ extern int wcwidth(wchar_t); ++ #endif + + extern int fwprintf(FILE*, const wchar_t*, ...); + extern int fwscanf(FILE*, const wchar_t*, ...); +diff --git ksh93-clean/src/lib/libast/include/ast_std.h ksh93-workdir/src/lib/libast/include/ast_std.h +index e89ce52..93404da 100644 +--- ksh93-clean/src/lib/libast/include/ast_std.h ++++ ksh93-workdir/src/lib/libast/include/ast_std.h +@@ -55,6 +55,9 @@ struct _sfio_s; + #ifndef _FILEDEFED + #define _FILEDEFED 1 + #endif ++#ifndef _MLIBC_INTERNAL_FILE_T_H ++#define _MLIBC_INTERNAL_FILE_T_H 1 ++#endif + #endif + #endif + +@@ -93,6 +96,9 @@ struct _sfio_s; + #ifndef __DEFINED_FILE + #define __DEFINED_FILE 1 + #endif ++#ifndef _MLIBC_INTERNAL_FILE_T_H ++#define _MLIBC_INTERNAL_FILE_T_H 1 ++#endif + #endif + + /* locale stuff */ diff --git a/recipes/ksh93 b/recipes/ksh93 new file mode 100644 index 00000000..4800d2a2 --- /dev/null +++ b/recipes/ksh93 @@ -0,0 +1,18 @@ +name=ksh93 +revision=1 +from_source=ksh93 +imagedeps="build-essential" +hostdeps="xgcc xbinutils" +deps="base" + +configure() { + ksh_cv_cross_feature_cache=yes ${source_dir}/configure --host=x86_64-astral --prefix=${prefix} --enable-multibyte +} + +build() { + make -j ${parallelism} +} + +package() { + make install DESTDIR=${dest_dir} +} diff --git a/source-recipes/ksh93 b/source-recipes/ksh93 new file mode 100644 index 00000000..cdaf2783 --- /dev/null +++ b/source-recipes/ksh93 @@ -0,0 +1,11 @@ +name=ksh93 +version=1.0.10 +source_method=tarball +tarball_url="https://github.com/Mathewnd/ksh/archive/c02707d6d8c596b03d4d7407af86148cbe0329d2.tar.gz" +tarball_sha512=1baeef8f9515e23858ad52758d855ecf9cf9dff339040bd2044d7d23e0ab3e025dd0ec73c72ac00157ac42207b5f5b702f74f0ce107adc1399bba6a9c055924e +hostdeps="autoconf automake libtool pkgconfig" + +prepare() { + autoreconf -fvi + automake --copy --add-missing --force || true +}