diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-11-05 22:32:10 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 01:36:54 +0100 |
commit | 05cb72e2c32c7535fec0bfce71256f2d958ebf73 (patch) | |
tree | 7add6fb9a108f28d5021e08e8ca78ce5f5f8e9ad /Ports/oksh | |
parent | 2530b6adf037e19f630f5a98be4a5d70420e0d99 (diff) | |
download | serenity-05cb72e2c32c7535fec0bfce71256f2d958ebf73.zip |
Ports: Unbreak and update oksh
This port has been broken since the introduction of `sys_signame` (which
was almost 3 months ago), as oksh provided a conflicting definition for
it.
This commit also cleans up some of the patches, defining the appropriate
config macro instead of commenting out code.
When I opened this program's GitHub releases page, I noticed that a new
version was available, so I also did the update.
Diffstat (limited to 'Ports/oksh')
-rwxr-xr-x | Ports/oksh/package.sh | 9 | ||||
-rw-r--r-- | Ports/oksh/patches/add_compat_macros.patch | 29 | ||||
-rw-r--r-- | Ports/oksh/patches/add_pconfig.patch | 37 | ||||
-rw-r--r-- | Ports/oksh/patches/no_default_pconfig.patch | 47 | ||||
-rw-r--r-- | Ports/oksh/patches/remove_issetugid.patch | 28 | ||||
-rw-r--r-- | Ports/oksh/patches/remove_redeclarations.patch | 101 |
6 files changed, 118 insertions, 133 deletions
diff --git a/Ports/oksh/package.sh b/Ports/oksh/package.sh index 808a12979e..8cf138ab42 100755 --- a/Ports/oksh/package.sh +++ b/Ports/oksh/package.sh @@ -1,16 +1,17 @@ #!/usr/bin/env -S bash ../.port_include.sh port=oksh useconfigure=true -version=6.8.1 +version=7.0 depends=("ncurses") workdir=oksh-${version} -files="https://github.com/ibara/oksh/releases/download/oksh-${version}/oksh-${version}.tar.gz oksh-${version}.tar.gz ddd2b27b99009a4ee58ddf58da73edf83962018066ccf33b2fe1f570a00917b0" +files="https://github.com/ibara/oksh/releases/download/oksh-${version}/oksh-${version}.tar.gz oksh-${version}.tar.gz 21d5891f38ffea3a5d1aa8c494f0a5579c93778535e0a92275b102dec3221da1" auth_type=sha256 +export CPPFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/ncurses" + configure() { - export CC=${SERENITY_SOURCE_DIR}/Toolchain/Local/${SERENITY_ARCH}/bin/${SERENITY_ARCH}-pc-serenity-gcc export CFLAGS="" - export LDFLAGS="-lncurses" + export LDFLAGS="-lncurses" run ./configure --no-thanks } diff --git a/Ports/oksh/patches/add_compat_macros.patch b/Ports/oksh/patches/add_compat_macros.patch new file mode 100644 index 0000000000..f50285fdbb --- /dev/null +++ b/Ports/oksh/patches/add_compat_macros.patch @@ -0,0 +1,29 @@ +diff --git a/portable.h b/portable.h +index 5c86edd..6ccf7f6 100644 +--- a/portable.h ++++ b/portable.h +@@ -61,7 +61,7 @@ + #define _PW_NAME_LEN MAXLOGNAME + #elif defined(__sun) + #define _PW_NAME_LEN LOGNAME_MAX +-#elif defined(__hpux) ++#elif defined(__hpux) || defined(__serenity__) + #define _PW_NAME_LEN 8 + #else + #define _PW_NAME_LEN MAXLOGNAME - 1 +@@ -116,6 +116,15 @@ + #define nice(x) (int)0 + #endif /* __HAIKU__ */ + ++#ifdef __serenity__ ++#define _PATH_DEFPATH "/usr/bin:/usr/local/bin" ++#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" ++#define _CS_PATH 1 ++#define WCOREFLAG 0200 ++#define WCOREDUMP(x) ((x) & WCOREFLAG) ++#define nice(x) (int)0 ++#endif /* __serenity__ */ ++ + #ifndef HAVE_SETRESGID + #define setresgid(x, y, z) setgid(x); setegid(y); setgid(z) + #endif /* !HAVE_SETRESGID */ diff --git a/Ports/oksh/patches/add_pconfig.patch b/Ports/oksh/patches/add_pconfig.patch new file mode 100644 index 0000000000..c198d16b3f --- /dev/null +++ b/Ports/oksh/patches/add_pconfig.patch @@ -0,0 +1,37 @@ +diff --git a/pconfig.h b/pconfig.h +new file mode 100644 +index 0000000..2dd229b +--- /dev/null ++++ b/pconfig.h +@@ -0,0 +1,30 @@ ++#ifndef __dead ++#define __dead __attribute__((__noreturn__)) ++#endif ++ ++/* #define __attribute__(x) */ ++ ++#define HAVE_ASPRINTF ++/* #define HAVE_CONFSTR */ ++/* #define NO_CURSES */ ++#define HAVE_NCURSES ++#define issetugid(x) 0 ++/* #define HAVE_ISSETUGID */ ++#define HAVE_GETAUXVAL ++/* #define HAVE_PLEDGE */ ++/* #define HAVE_REALLOCARRAY */ ++#define HAVE_SETRESGID ++#define HAVE_SETRESUID ++/* #define HAVE_SIG_T */ ++/* #define HAVE_SRAND_DETERMINISTIC */ ++#define HAVE_ST_MTIM ++/* #define HAVE_ST_MTIMESPEC */ ++/* #define HAVE_STRAVIS */ ++/* #define HAVE_STRLCAT */ ++#define HAVE_STRLCPY ++/* #define HAVE_STRTONUM */ ++/* #define HAVE_STRUNVIS */ ++#define HAVE_SIGLIST ++#define HAVE_SIGNAME ++#define HAVE_TIMERADD ++#define HAVE_TIMERCLEAR ++#define HAVE_TIMERSUB diff --git a/Ports/oksh/patches/no_default_pconfig.patch b/Ports/oksh/patches/no_default_pconfig.patch new file mode 100644 index 0000000000..1dedac841a --- /dev/null +++ b/Ports/oksh/patches/no_default_pconfig.patch @@ -0,0 +1,47 @@ +diff --git a/configure b/configure +index 710dc3b..0625338 100755 +--- a/configure ++++ b/configure +@@ -912,42 +912,7 @@ if [ $doconfigure -eq 0 ] ; then + fi + cflags="$cflags -std=gnu99" + echo "OK, I trust you." +- echo "I'll assume you have gcc/clang and little else." +- echo "Edit Makefile and pconfig.h if needed." + echo "Good luck!" +- cat << EOF > pconfig.h +-/* This file automatically generated by configure. */ +- +-#ifndef __dead +-#define __dead __attribute__((__noreturn__)) +-#endif +- +-/* #define __attribute__(x) */ +- +-/* #define HAVE_ASPRINTF */ +-/* #define HAVE_CONFSTR */ +-#define NO_CURSES +-/* #define HAVE_ISSETUGID */ +-/* #define HAVE_GETAUXVAL */ +-/* #define HAVE_PLEDGE */ +-/* #define HAVE_REALLOCARRAY */ +-/* #define HAVE_SETRESGID */ +-/* #define HAVE_SETRESUID */ +-/* #define HAVE_SIG_T */ +-/* #define HAVE_SRAND_DETERMINISTIC */ +-#define HAVE_ST_MTIM +-/* #define HAVE_ST_MTIMESPEC */ +-/* #define HAVE_STRAVIS */ +-/* #define HAVE_STRLCAT */ +-/* #define HAVE_STRLCPY */ +-/* #define HAVE_STRTONUM */ +-/* #define HAVE_STRUNVIS */ +-/* #define HAVE_SIGLIST */ +-/* #define HAVE_SIGNAME */ +-/* #define HAVE_TIMERADD */ +-/* #define HAVE_TIMERCLEAR */ +-/* #define HAVE_TIMERSUB */ +-EOF + Makefile + + exit 0 diff --git a/Ports/oksh/patches/remove_issetugid.patch b/Ports/oksh/patches/remove_issetugid.patch deleted file mode 100644 index 99d6940030..0000000000 --- a/Ports/oksh/patches/remove_issetugid.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/misc.c b/misc.c -index b440088..1c32061 100644 ---- a/misc.c -+++ b/misc.c -@@ -291,22 +291,7 @@ change_flag(enum sh_flag f, - Flag(f) = newval; - } - } else -- /* Turning off -p? */ -- if (f == FPRIVILEGED && oldval && !newval && issetugid() && -- !dropped_privileges) { -- gid_t gid = getgid(); -- -- setresgid(gid, gid, gid); -- setgroups(1, &gid); -- setresuid(ksheuid, ksheuid, ksheuid); -- --#ifdef HAVE_PLEDGE -- if (pledge("stdio rpath wpath cpath fattr flock getpw proc " -- "exec tty", NULL) == -1) -- bi_errorf("pledge fail"); --#endif -- dropped_privileges = 1; -- } else if (f == FPOSIX && newval) { -+ if (f == FPOSIX && newval) { - Flag(FBRACEEXPAND) = 0; - } - /* Changing interactive flag? */ diff --git a/Ports/oksh/patches/remove_redeclarations.patch b/Ports/oksh/patches/remove_redeclarations.patch deleted file mode 100644 index 51c35157f2..0000000000 --- a/Ports/oksh/patches/remove_redeclarations.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff --git a/jobs.c b/jobs.c -index 121c0cf..b30d105 100644 ---- a/jobs.c -+++ b/jobs.c -@@ -30,6 +30,7 @@ - - #include "sh.h" - #include "tty.h" -+#include "portable.h" - - /* Order important! */ - #define PRUNNING 0 -diff --git a/portable.h b/portable.h -index 899c974..864e112 100644 ---- a/portable.h -+++ b/portable.h -@@ -61,10 +61,8 @@ - #define _PW_NAME_LEN MAXLOGNAME - #elif defined(__sun) - #define _PW_NAME_LEN LOGNAME_MAX --#elif defined(__hpux) --#define _PW_NAME_LEN 8 - #else --#define _PW_NAME_LEN MAXLOGNAME - 1 -+#define _PW_NAME_LEN 8 - #endif /* __linux__ || __CYGWIN__ || _AIX || __NetBSD__ || __sun || __midipix__ || __HAIKU__ */ - #endif /* !_PW_NAME_LEN */ - -@@ -116,6 +114,15 @@ - #define nice(x) (int)0 - #endif /* __HAIKU__ */ - -+#ifdef __serenity__ -+#define _PATH_DEFPATH "/usr/bin:/usr/local/bin" -+#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin:" -+#define _CS_PATH 1 -+#define WCOREFLAG 0200 -+#define WCOREDUMP(x) ((x) & WCOREFLAG) -+#define nice(x) (int)0 -+#endif -+ - #ifndef HAVE_SETRESGID - #define setresgid(x, y, z) setgid(x); setegid(y); setgid(z) - #endif /* !HAVE_SETRESGID */ -@@ -128,30 +135,6 @@ - #define srand_deterministic(x) srand(x) - #endif /* !HAVE_SRAND_DETERMINISTIC */ - --#ifndef HAVE_TIMERADD --#define timeradd(tvp, uvp, vvp) \ -- do { \ -- (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ -- (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ -- if ((vvp)->tv_usec >= 1000000) { \ -- (vvp)->tv_sec++; \ -- (vvp)->tv_usec -= 1000000; \ -- } \ -- } while (0) --#endif /* !HAVE_TIMERADD */ -- --#ifndef HAVE_TIMERSUB --#define timersub(tvp, uvp, vvp) \ -- do { \ -- (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ -- (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ -- if ((vvp)->tv_usec < 0) { \ -- (vvp)->tv_sec--; \ -- (vvp)->tv_usec += 1000000; \ -- } \ -- } while (0) --#endif /* !HAVE_TIMERSUB */ -- - /* struct stat compatibility */ - #ifndef HAVE_ST_MTIM - #ifndef HAVE_ST_MTIMESPEC -@@ -240,9 +223,9 @@ int strunvis(char *, const char *); - #undef NSIG - #endif /* NSIG */ - #define NSIG 33 --#ifndef HAVE_SIGLIST --extern const char *const sys_siglist[NSIG]; --#endif /* !HAVE_SIGLIST */ -+//#ifndef HAVE_SIGLIST -+//extern const char *const sys_siglist[NSIG]; -+//#endif /* !HAVE_SIGLIST */ - #ifndef HAVE_SIGNAME - extern const char *const sys_signame[NSIG]; - #endif /* !HAVE_SIGNAME */ -diff --git a/siglist.c b/siglist.c -index 790d7da..d8e3519 100644 ---- a/siglist.c -+++ b/siglist.c -@@ -30,7 +30,7 @@ - - #include "pconfig.h" - --#ifndef HAVE_SIGLIST -+#if 0 - - #include <signal.h> - |