mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Ports: Add cfunge
This adds the `cfunge` Befunge interpreter. An interpreter for the esoteric programming language Befunge written in C.
This commit is contained in:
parent
7ab62ecd16
commit
acdb0860b1
7 changed files with 92 additions and 0 deletions
|
@ -25,6 +25,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
|
|||
| [`cmake`](cmake/) | CMake | 3.22.1 | https://cmake.org/ |
|
||||
| [`cmatrix`](cmatrix/) | cmatrix | 3112b12 | https://github.com/abishekvashok/cmatrix |
|
||||
| [`composer`](composer/) | Composer | 2.1.3 | https://getcomposer.org/ |
|
||||
| [`cfunge`](cfunge/) | cfunge | 2bc4fb2 | https://github.com/VorpalBlade/cfunge/ |
|
||||
| [`curl`](curl/) | curl | 7.82.0 | https://curl.se/ |
|
||||
| [`dash`](dash/) | DASH | 0.5.10.2 | http://gondor.apana.org.au/~herbert/dash |
|
||||
| [`dialog`](dialog/) | Dialog | 1.3-20210324 | https://invisible-island.net/dialog/ |
|
||||
|
|
31
Ports/cfunge/package.sh
Executable file
31
Ports/cfunge/package.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env -S bash ../.port_include.sh
|
||||
|
||||
port=cfunge
|
||||
version=2bc4fb27ade2a816ca9a90a6d9f6958111123fa9
|
||||
workdir=cfunge-${version}/build
|
||||
useconfigure=true
|
||||
files="https://codeload.github.com/VorpalBlade/cfunge/zip/${version} cfunge.zip 364994a890ed1083684956db576a2a5cfb94b3117bae868910d6a75111033f55"
|
||||
auth_type=sha256
|
||||
|
||||
mkdir -p cfunge-${version}/build
|
||||
|
||||
patch_internal() {
|
||||
# patch if it was not yet patched (applying patches multiple times doesn't work!)
|
||||
if [ -z "${IN_SERENITY_PORT_DEV:-}" ] && [ -d patches ]; then
|
||||
for filepath in patches/*.patch; do
|
||||
filename=$(basename $filepath)
|
||||
if [ ! -f "$workdir"/.${filename}_applied ]; then
|
||||
run patch -d .. -p"$patchlevel" < "$filepath"
|
||||
run touch .${filename}_applied
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
configure() {
|
||||
run cmake "${configopts[@]}" ..
|
||||
}
|
||||
|
||||
install() {
|
||||
run cp cfunge "${SERENITY_INSTALL_ROOT}/bin"
|
||||
}
|
19
Ports/cfunge/patches/ReadMe.md
Normal file
19
Ports/cfunge/patches/ReadMe.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Patches for cfunge on SerenityOS
|
||||
|
||||
## `arc4random_buf.patch`
|
||||
Somewhere on the way of configuring the variable `HAVE_arc4random_buf` was set which lead to the linker complaining about not knowing a certain `arc4random_stir()` function.
|
||||
This patch just negates the define and the linker is happy.
|
||||
|
||||
|
||||
## `define-max.patch`
|
||||
It is expected that `sys/param.h` defines a `MAX` macro. We don't. So here the needed macro is just inserted instead of the include.
|
||||
|
||||
|
||||
## `posix-mapped-files.patch`
|
||||
It is expected that `_POSIX_MAPPED_FILES` is defined as at least `1`, so we do that here.
|
||||
|
||||
|
||||
## `posix-regexp.patch`
|
||||
Same as before, just for `_POSIX_REGEXP`
|
||||
|
||||
|
10
Ports/cfunge/patches/arc4random_buf.patch
Normal file
10
Ports/cfunge/patches/arc4random_buf.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- ../src/prng.c
|
||||
+++ ../src/prng.c
|
||||
@@ -29,6 +29,7 @@
|
||||
# undef HAVE_arc4random_buf
|
||||
#endif
|
||||
|
||||
+#undef HAVE_arc4random_buf
|
||||
#ifdef HAVE_arc4random_buf
|
||||
# define HAVE_ARC4RANDOM
|
||||
# ifndef ARC4RANDOM_IN_BSD
|
11
Ports/cfunge/patches/define-max.patch
Normal file
11
Ports/cfunge/patches/define-max.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- ../lib/fungestring/funge_str-two-way.h
|
||||
+++ ../lib/fungestring/funge_str-two-way.h
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
-#include <sys/param.h> /* Defines MAX. */
|
||||
+#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
/* We use the Two-Way string matching algorithm, which guarantees
|
||||
linear complexity with constant space. Additionally, for long
|
10
Ports/cfunge/patches/posix-mapped-files.patch
Normal file
10
Ports/cfunge/patches/posix-mapped-files.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- ../src/funge-space/funge-space.c
|
||||
+++ ../src/funge-space/funge-space.c
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <sys/stat.h> /* fstat, open */
|
||||
#include <fcntl.h> /* open, posix_fallocate */
|
||||
|
||||
+#define _POSIX_MAPPED_FILES 1
|
||||
#if !defined(_POSIX_MAPPED_FILES) || (_POSIX_MAPPED_FILES < 1)
|
||||
# error "cfunge needs a working mmap(), which this system claims it lacks."
|
||||
#endif
|
10
Ports/cfunge/patches/posix-regexp.patch
Normal file
10
Ports/cfunge/patches/posix-regexp.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- ../src/fingerprints/REXP/REXP.c
|
||||
+++ ../src/fingerprints/REXP/REXP.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
+#define _POSIX_REGEXP 1
|
||||
#if !defined(_POSIX_REGEXP) || (_POSIX_REGEXP < 1)
|
||||
# error "cfunge needs POSIX regular expressions, which this system claims it doesn't have."
|
||||
#endif
|
Loading…
Reference in a new issue