summaryrefslogtreecommitdiff
path: root/Ports
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-16 11:08:32 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-16 20:08:13 +0200
commitdd35bd158e67be45b3bf839655ea13d09e12f943 (patch)
tree0bb88d5eaf9e5365d0186cd846b45fa720fc732c /Ports
parentf589acaac9e172d8d2758066b6c67b0adc771435 (diff)
downloadserenity-dd35bd158e67be45b3bf839655ea13d09e12f943.zip
Ports: Add port for SDL2_net
Diffstat (limited to 'Ports')
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/SDL2_net/package.sh12
-rw-r--r--Ports/SDL2_net/patches/configure.patch12
-rw-r--r--Ports/SDL2_net/patches/ifconf.patch14
-rw-r--r--Ports/SDL2_net/patches/select.patch11
5 files changed, 50 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 839138fdc6..6941ed93c8 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -123,6 +123,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`SDL2_gfx`](SDL2_gfx/) | SDL2\_gfx (Graphics primitives add-on for SDL2) | 1.0.4 | https://sourceforge.net/projects/sdl2gfx/ |
| [`SDL2_image`](SDL2_image/) | SDL2\_image (Image loading add-on for SDL2) | 2.0.5 | https://www.libsdl.org/projects/SDL_image/ |
| [`SDL2_mixer`](SDL2_mixer/) | SDL2\_mixer (audio mixer add-on for SDL2) | 2.0.4 | https://www.libsdl.org/projects/SDL_mixer/ |
+| [`SDL2_net`](SDL2_net/) | SDL2\_net (network add-on for SDL2) | 2.0.1 | https://www.libsdl.org/projects/SDL_net/ |
| [`SDL2_ttf`](SDL2_ttf/) | SDL2\_ttf (TrueType Font add-on for SDL2) | 2.0.15 | https://www.libsdl.org/projects/SDL_ttf/ |
| [`sed`](sed/) | GNU sed | 4.2.1 | https://www.gnu.org/software/sed/ |
| [`sl`](sl/) | Steam Locomotive (SL) | | https://github.com/mtoyoda/sl |
diff --git a/Ports/SDL2_net/package.sh b/Ports/SDL2_net/package.sh
new file mode 100755
index 0000000000..ef94c43b90
--- /dev/null
+++ b/Ports/SDL2_net/package.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=SDL2_net
+version=2.0.1
+useconfigure=true
+configopts=--with-sdl-prefix="${SERENITY_INSTALL_ROOT}/usr/local"
+files="https://www.libsdl.org/projects/SDL_net/release/SDL2_net-${version}.tar.gz SDL2_net-${version}.tar.gz 15ce8a7e5a23dafe8177c8df6e6c79b6749a03fff1e8196742d3571657609d21"
+auth_type=sha256
+depends="SDL2"
+
+post_install() {
+ run ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_net.so -Wl,-soname,libSDL2_net.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libSDL2_net.a -Wl,--no-whole-archive
+}
diff --git a/Ports/SDL2_net/patches/configure.patch b/Ports/SDL2_net/patches/configure.patch
new file mode 100644
index 0000000000..bdae3d6027
--- /dev/null
+++ b/Ports/SDL2_net/patches/configure.patch
@@ -0,0 +1,12 @@
+diff -Naur SDL2_net-2.0.1/config.sub SDL2_net-2.0.1.serenity/config.sub
+--- SDL2_net-2.0.1/config.sub 2016-01-03 08:57:09.000000000 +0100
++++ SDL2_net-2.0.1.serenity/config.sub 2021-06-16 10:40:58.771380293 +0200
+@@ -1364,7 +1364,7 @@
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
++ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* | -serenity* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
diff --git a/Ports/SDL2_net/patches/ifconf.patch b/Ports/SDL2_net/patches/ifconf.patch
new file mode 100644
index 0000000000..78c11e1e27
--- /dev/null
+++ b/Ports/SDL2_net/patches/ifconf.patch
@@ -0,0 +1,14 @@
+diff -Naur SDL2_net-2.0.1/SDLnet.c SDL2_net-2.0.1.serenity/SDLnet.c
+--- SDL2_net-2.0.1/SDLnet.c 2016-01-03 08:57:09.000000000 +0100
++++ SDL2_net-2.0.1.serenity/SDLnet.c 2021-06-16 10:48:32.073734588 +0200
+@@ -184,6 +184,10 @@
+ return inet_ntoa(in);
+ }
+
++#ifdef __serenity__
++#undef SIOCGIFCONF
++#endif
++
+ int SDLNet_GetLocalAddresses(IPaddress *addresses, int maxcount)
+ {
+ int count = 0;
diff --git a/Ports/SDL2_net/patches/select.patch b/Ports/SDL2_net/patches/select.patch
new file mode 100644
index 0000000000..997b0f0a92
--- /dev/null
+++ b/Ports/SDL2_net/patches/select.patch
@@ -0,0 +1,11 @@
+diff -Naur SDL2_net-2.0.1/SDLnetsys.h SDL2_net-2.0.1.serenity/SDLnetsys.h
+--- SDL2_net-2.0.1/SDLnetsys.h 2021-06-16 10:42:24.609750625 +0200
++++ SDL2_net-2.0.1.serenity/SDLnetsys.h 2016-01-03 08:57:09.000000000 +0100
+@@ -46,6 +46,7 @@
+ #include <iphlpapi.h>
+ #else /* UNIX */
+ #include <sys/types.h>
++#include <sys/select.h>
+ #ifdef __FreeBSD__
+ #include <sys/socket.h>
+ #endif