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.
This commit is contained in:
Daniel Bertalan 2021-11-05 22:32:10 +01:00 committed by Andreas Kling
parent 2530b6adf0
commit 05cb72e2c3
7 changed files with 119 additions and 134 deletions

View file

@ -128,7 +128,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`openttd-opensfx`](openttd-opensfx/) | OpenSFX audio files for OpenTTD | 1.0.1 | https://www.openttd.org/ |
| [`opentyrian`](opentyrian/) | OpenTyrian | 84b820f | https://github.com/opentyrian/opentyrian |
| [`opentyrian-data`](opentyrian-data/) | OpenTyrian graphics and audio | 1.0.0 | https://camanis.net/tyrian/tyrian21.zip |
| [`oksh`](oksh/) | oksh | 6.8.1 | https://github.com/ibara/oksh |
| [`oksh`](oksh/) | oksh | 7.0 | https://github.com/ibara/oksh |
| [`p7zip`](p7zip/) | p7zip | 17.04 | https://github.com/jinfeihan57/p7zip |
| [`patch`](patch/) | patch (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy |
| [`pcre`](pcre/) | Perl-compatible Regular Expressions (PCRE) | 8.45 | https://www.pcre.org/ |

View file

@ -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
}

View file

@ -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 */

View file

@ -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

View file

@ -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

View file

@ -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? */

View file

@ -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>