summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcircl <circl.lastname@gmail.com>2022-03-19 16:59:12 +0100
committerLinus Groh <mail@linusgroh.de>2022-03-20 18:20:01 +0000
commit0865a06ef5dde9f73ed7ae314fa4aab2191763d5 (patch)
tree9ad1fb2e8304d23fd49c7bba8938a896c7fbd648
parentadcd39d92845016a845205105650c45858ab3c54 (diff)
downloadserenity-0865a06ef5dde9f73ed7ae314fa4aab2191763d5.zip
Ports: Add The Powder Toy port
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/powdertoy/package.sh25
-rw-r--r--Ports/powdertoy/patches/0001-malloc.h-doesn-t-exist-on-Serenity-but-the-code-only.patch26
-rw-r--r--Ports/powdertoy/patches/0002-Open-links-and-directories-using-open-1.patch25
-rw-r--r--Ports/powdertoy/patches/ReadMe.md12
5 files changed, 89 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index a2fa54009e..4c4843525f 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -161,6 +161,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`pfetch`](pfetch/) | pfetch | a906ff8 | https://github.com/dylanaraps/pfetch/ |
| [`php`](php/) | PHP | 8.1.1 | https://www.php.net/ |
| [`pkgconf`](pkgconf/) | pkgconf | 1.8.0 | https://github.com/pkgconf/pkgconf |
+| [`powdertoy`](powdertoy/) | The Powder Toy | 96.2.350 | https://powdertoy.co.uk/ |
| [`SDLPoP`](SDLPoP/) | Prince of Persia game | | https://github.com/NagyD/SDLPoP |
| [`sparsehash`](sparsehash/) | Google's C++ associative containers | 2.0.4 | https://github.com/sparsehash/sparsehash |
| [`printf`](printf/) | printf (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy |
diff --git a/Ports/powdertoy/package.sh b/Ports/powdertoy/package.sh
new file mode 100755
index 0000000000..1735ed997a
--- /dev/null
+++ b/Ports/powdertoy/package.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=powdertoy
+version=96.2.350
+useconfigure=true
+configopts=("--cross-file" "../cross_file-$SERENITY_ARCH.txt")
+depends=("luajit" "curl" "libfftw3f" "zlib" "SDL2")
+files="https://github.com/The-Powder-Toy/The-Powder-Toy/archive/refs/tags/v${version}.tar.gz The-Powder-Toy-${version}.tar.gz d95cbadee22632687661e8fc488bd64405d81c0dca737e16420f26e93ea5bf58"
+auth_type=sha256
+workdir="The-Powder-Toy-${version}"
+launcher_name="The Powder Toy"
+launcher_category="Games"
+launcher_command="/usr/local/bin/powder"
+launcher_run_in_terminal=false
+
+configure() {
+ run meson build-debug "${configopts[@]}"
+}
+
+build() {
+ run ninja -C build-debug
+}
+
+install() {
+ run cp build-debug/powder "${SERENITY_INSTALL_ROOT}/usr/local/bin"
+}
diff --git a/Ports/powdertoy/patches/0001-malloc.h-doesn-t-exist-on-Serenity-but-the-code-only.patch b/Ports/powdertoy/patches/0001-malloc.h-doesn-t-exist-on-Serenity-but-the-code-only.patch
new file mode 100644
index 0000000000..1e2c273283
--- /dev/null
+++ b/Ports/powdertoy/patches/0001-malloc.h-doesn-t-exist-on-Serenity-but-the-code-only.patch
@@ -0,0 +1,26 @@
+From e02111d802947f23b9424c4e50a76c55288b6fd6 Mon Sep 17 00:00:00 2001
+From: circl <circl.lastname@gmail.com>
+Date: Sun, 20 Mar 2022 17:13:21 +0100
+Subject: [PATCH 1/2] malloc.h doesn't exist on Serenity, but the code only
+ checks for macOS and BSDs
+
+---
+ src/Update.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Update.cpp b/src/Update.cpp
+index 50ef666..5996846 100644
+--- a/src/Update.cpp
++++ b/src/Update.cpp
+@@ -5,7 +5,7 @@
+ #ifndef WIN
+ #include <sys/param.h>
+ #endif
+-#if !defined(MACOSX) && !defined(BSD)
++#if !defined(MACOSX) && !defined(BSD) && !defined(__serenity__)
+ #include <malloc.h>
+ #endif
+ #include <cstring>
+--
+2.32.0
+
diff --git a/Ports/powdertoy/patches/0002-Open-links-and-directories-using-open-1.patch b/Ports/powdertoy/patches/0002-Open-links-and-directories-using-open-1.patch
new file mode 100644
index 0000000000..eb99ac6cce
--- /dev/null
+++ b/Ports/powdertoy/patches/0002-Open-links-and-directories-using-open-1.patch
@@ -0,0 +1,25 @@
+From 949ac4d0795be7467f7301f2de0a950767794067 Mon Sep 17 00:00:00 2001
+From: circl <circl.lastname@gmail.com>
+Date: Sun, 20 Mar 2022 17:16:16 +0100
+Subject: [PATCH 2/2] Open links and directories using open(1)
+
+---
+ src/common/Platform.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/Platform.cpp b/src/common/Platform.cpp
+index d341561..d32615c 100644
+--- a/src/common/Platform.cpp
++++ b/src/common/Platform.cpp
+@@ -137,7 +137,7 @@ void OpenURI(ByteString uri)
+ {
+ fprintf(stderr, "cannot open URI: ShellExecute(...) failed\n");
+ }
+-#elif defined(MACOSX)
++#elif defined(MACOSX) || defined(__serenity__)
+ if (system(("open \"" + uri + "\"").c_str()))
+ {
+ fprintf(stderr, "cannot open URI: system(...) failed\n");
+--
+2.32.0
+
diff --git a/Ports/powdertoy/patches/ReadMe.md b/Ports/powdertoy/patches/ReadMe.md
new file mode 100644
index 0000000000..9426c1881a
--- /dev/null
+++ b/Ports/powdertoy/patches/ReadMe.md
@@ -0,0 +1,12 @@
+# Patches for powdertoy on SerenityOS
+
+## `0001-malloc.h-doesn-t-exist-on-Serenity-but-the-code-only.patch`
+
+malloc.h doesn't exist on Serenity, but the code only checks for macOS and BSDs
+
+
+## `0002-Open-links-and-directories-using-open-1.patch`
+
+Open links and directories using open(1)
+
+