Skip to content

Commit

Permalink
Add enet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Jun 9, 2024
1 parent 0b238b8 commit 1e98c94
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
19 changes: 19 additions & 0 deletions enet/VITABUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pkgname=enet
pkgver=1.3.18
pkgrel=1
url="https://github.com/lsalzman/enet"
source=("https://github.com/lsalzman/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('28603c895f9ed24a846478180ee72c7376b39b4bb1287b73877e5eae7d96b0dd')

build() {
cd $pkgname-$pkgver
patch unix.c "${srcdir}/enet.patch"
cmake -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake
make -j$(nproc)
}

package () {
cd $pkgname-$pkgver
cp lib$pkgname.a $pkgdir/$VITASDK/arm-vita-eabi/lib/
cp include/$pkgname $pkgdir/$VITASDK/arm-vita-eabi/include/
}
28 changes: 28 additions & 0 deletions enet/enet.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- unix.c 2024-04-15 05:06:53.000000000 +0200
+++ unix.c 2024-06-09 13:46:43.009847600 +0200
@@ -6,7 +6,9 @@

#include <sys/types.h>
#include <sys/socket.h>
+#ifndef __vita__
#include <sys/ioctl.h>
+#endif
#include <sys/time.h>
#include <netinet/tcp.h>
#include <netdb.h>
@@ -303,11 +305,15 @@
switch (option)
{
case ENET_SOCKOPT_NONBLOCK:
+#ifdef __vita__
+ result = setsockopt (socket, SOL_SOCKET, SO_NONBLOCK, (char *) & value, sizeof (int));
+#else
#ifdef HAS_FCNTL
result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK));
#else
result = ioctl (socket, FIONBIO, & value);
#endif
+#endif
break;

case ENET_SOCKOPT_BROADCAST:

0 comments on commit 1e98c94

Please sign in to comment.