mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
ps3netsrv: add ps3netsrv allows you to stream games and ISOs over the network to your CFW PlayStation(R) 3 system
This commit is contained in:
parent
4b97e2a826
commit
340f1bffaa
55
package/lean/ps3netsrv/Makefile
Normal file
55
package/lean/ps3netsrv/Makefile
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2012-2017 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=ps3netsrv
|
||||||
|
PKG_VERSION:=20190630
|
||||||
|
PKG_GIT_COMMIT:=3107bba17870657c5bb3f7830657838d766a296c
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_GIT_COMMIT).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://github.com/jhonathanc/ps3netsrv/releases/download/$(PKG_VERSION)
|
||||||
|
PKG_HASH:=b1df52bab6496d3008019ff76660436c4b24d05c84fc71f293719dbd608f1511
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=JCorrea
|
||||||
|
PKG_LICENSE:=GPLv3
|
||||||
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
PKG_BUILD_DEPENDS:=mbedtls
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/ps3netsrv
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
SUBMENU:=File Transfer
|
||||||
|
TITLE:=PS3 Game Server
|
||||||
|
URL:=https://github.com/jhonathanc/ps3netsrv-openwrt/
|
||||||
|
DEPENDS:=+libpthread +libstdcpp
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/ps3netsrv/description
|
||||||
|
ps3netsrv allows you to stream games and ISOs over the network to your CFW PlayStation(R) 3 system.
|
||||||
|
This may be useful if you have a modified PS3, and your router has storage options.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Install
|
||||||
|
# Do nothing
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/ps3netsrv/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ps3netsrv $(1)/usr/bin
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/ps3netsrv.init $(1)/etc/init.d/ps3netsrv
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_CONF) ./files/ps3netsrv.config $(1)/etc/config/ps3netsrv
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,ps3netsrv))
|
5
package/lean/ps3netsrv/files/ps3netsrv.config
Normal file
5
package/lean/ps3netsrv/files/ps3netsrv.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
config ps3netsrv 'main'
|
||||||
|
option enabled '0'
|
||||||
|
option user 'root'
|
||||||
|
option dir '/root'
|
||||||
|
option port '38008'
|
83
package/lean/ps3netsrv/files/ps3netsrv.init
Normal file
83
package/lean/ps3netsrv/files/ps3netsrv.init
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=99
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
NAME=ps3netsrv
|
||||||
|
PROG=/usr/bin/ps3netsrv
|
||||||
|
|
||||||
|
_info() {
|
||||||
|
logger -p daemon.info -t "$NAME" "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
_err() {
|
||||||
|
logger -p daemon.err -t "$NAME" "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
_change_owner() {
|
||||||
|
local u="$1"; shift
|
||||||
|
|
||||||
|
local d
|
||||||
|
for d in "$@"; do
|
||||||
|
if [ -f "$d" ]; then
|
||||||
|
chown "$u" "$d" 2>/dev/null || return 1
|
||||||
|
elif [ -d "$d" ]; then
|
||||||
|
chown -R "$u" "$d" 2>/dev/null || return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
ps3netsrv_validate() {
|
||||||
|
uci_validate_section "$NAME" ps3netsrv "$1" \
|
||||||
|
'enabled:bool:0' \
|
||||||
|
'dir:string:/root' \
|
||||||
|
'user:string' \
|
||||||
|
'port:range(1024,65535)'
|
||||||
|
}
|
||||||
|
|
||||||
|
ps3netsrv_start() {
|
||||||
|
local section="$1"
|
||||||
|
ps3netsrv_validate "$section" || { _err "Validation failed."; return 1; }
|
||||||
|
|
||||||
|
[ "$enabled" = "1" ] || { _info "Instance \"${section}\" disabled."; return 1; }
|
||||||
|
[ -n "$dir" ] || { _err "Please set PS3 Game dir."; return 1; }
|
||||||
|
[ -n "$port" ] || { _err "Please set bind port."; return 1; }
|
||||||
|
[ -d "$dir" ] || { _err "Please create PS3 Game dir first."; return 1; }
|
||||||
|
|
||||||
|
if [ -n "$user" ]; then
|
||||||
|
if ( user_exists "$user" && _change_owner "$user" "$log" ); then
|
||||||
|
_info "ps3netsrv will run as user '${user}'."
|
||||||
|
if [ "$user" != "root" ]; then
|
||||||
|
_info "Please make sure user '${user}' has read access to directory: ${dir}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_info "Set run user to '${user}' failed, default user will be used."
|
||||||
|
user=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
procd_open_instance "${NAME}.${section}"
|
||||||
|
procd_set_param command "$PROG" "$dir" "$port"
|
||||||
|
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
|
||||||
|
[ -n "$user" ] && \
|
||||||
|
procd_set_param user "$user"
|
||||||
|
|
||||||
|
procd_add_jail "${NAME}.${section}" log
|
||||||
|
procd_add_jail_mount "$dir"
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "$NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
config_load "$NAME"
|
||||||
|
config_foreach ps3netsrv_start "ps3netsrv"
|
||||||
|
}
|
20
package/lean/ps3netsrv/patches/001-include.common.h.patch
Normal file
20
package/lean/ps3netsrv/patches/001-include.common.h.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
diff -Naur a/include/common.h b/include/common.h
|
||||||
|
--- a/include/common.h 2019-08-03 10:48:42.000000000 -0700
|
||||||
|
+++ b/include/common.h 2020-03-01 19:26:14.000000000 -0800
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#define __COMMON_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
+#include <endian.h>
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
@@ -10,7 +11,7 @@
|
||||||
|
#define DPRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#ifdef __BIG_ENDIAN__
|
||||||
|
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
|
||||||
|
static inline uint16_t BE16(uint16_t x)
|
||||||
|
{
|
12
package/lean/ps3netsrv/patches/002-include.compat.h.patch
Normal file
12
package/lean/ps3netsrv/patches/002-include.compat.h.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -Naur a/include/compat.h b/include/compat.h
|
||||||
|
--- a/include/compat.h 2019-08-03 10:48:42.000000000 -0700
|
||||||
|
+++ b/include/compat.h 2020-03-01 19:26:14.000000000 -0800
|
||||||
|
@@ -57,7 +57,7 @@ typedef int socklen_t;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
-#include <sys/errno.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
114
package/lean/ps3netsrv/patches/003-makefile.patch
Normal file
114
package/lean/ps3netsrv/patches/003-makefile.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
diff -Naur a/Makefile b/Makefile
|
||||||
|
--- a/Makefile 2019-08-03 10:48:42.000000000 -0700
|
||||||
|
+++ b/Makefile 2020-03-01 19:26:14.000000000 -0800
|
||||||
|
@@ -1,21 +1,17 @@
|
||||||
|
-OS = windows
|
||||||
|
+OS = linux
|
||||||
|
BUILD_TYPE = release_static
|
||||||
|
|
||||||
|
OUTPUT := ps3netsrv
|
||||||
|
OBJS = src/main.o src/compat.o src/File.o src/VIsoFile.o
|
||||||
|
|
||||||
|
-CFLAGS = -Wall -I./include -I./polarssl-1.3.2/include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
|
||||||
|
-CPPFLAGS += -Wall -I./include -I./polarssl-1.3.2/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
|
||||||
|
-
|
||||||
|
-#CFLAGS += -DNOSSL
|
||||||
|
-#CPPFLAGS +=-DNOSSL
|
||||||
|
-
|
||||||
|
-LDFLAGS = -L. -L./polarssl-1.3.2/library
|
||||||
|
-LIBS = -lstdc++ -lpolarssl
|
||||||
|
+CFLAGS = -Wall -I./include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||||
|
+CPPFLAGS = -Wall -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||||
|
|
||||||
|
+LDFLAGS = -L.
|
||||||
|
+LIBS = -lstdc++
|
||||||
|
|
||||||
|
ifeq ($(OS), linux)
|
||||||
|
-LIBS += -lpthread
|
||||||
|
+LIBS += -lpthread -lgcc_eh
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS), windows)
|
||||||
|
@@ -37,28 +33,82 @@ endif
|
||||||
|
ifeq ($(BUILD_TYPE), debug)
|
||||||
|
CFLAGS += -O0 -g3 -DDEBUG
|
||||||
|
CPPFLAGS += -O0 -g3 -DDEBUG
|
||||||
|
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), debug_nossl)
|
||||||
|
+CFLAGS += -O0 -g3 -DDEBUG -DNOSSL
|
||||||
|
+CPPFLAGS += -O0 -g3 -DDEBUG -DNOSSL
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), debug_polar)
|
||||||
|
+CFLAGS += -O0 -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+CPPFLAGS += -O0 -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+LDFLAGS += -L./polarssl-1.3.2/library
|
||||||
|
+LIBS += -lpolarssl
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_TYPE), debug_static)
|
||||||
|
CFLAGS += -O0 -static -g3 -DDEBUG
|
||||||
|
CPPFLAGS += -O0 -static -g3 -DDEBUG
|
||||||
|
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), debug_static_nossl)
|
||||||
|
+CFLAGS += -O0 -static -g3 -DDEBUG -DNOSSL
|
||||||
|
+CPPFLAGS += -O0 -static -g3 -DDEBUG -DNOSSL
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), debug_static_polar)
|
||||||
|
+CFLAGS += -O0 -static -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+CPPFLAGS += -O0 -static -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+LDFLAGS += -L./polarssl-1.3.2/library
|
||||||
|
+LIBS += -lpolarssl
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_TYPE), release)
|
||||||
|
CFLAGS += -O3 -s -DNDEBUG
|
||||||
|
CPPFLAGS += -O3 -s -DNDEBUG
|
||||||
|
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), release_nossl)
|
||||||
|
+CFLAGS += -O3 -s -DNDEBUG -DNOSSL
|
||||||
|
+CPPFLAGS += -O3 -s -DNDEBUG -DNOSSL
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), release_polar)
|
||||||
|
+CFLAGS += -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+CPPFLAGS += -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+LDFLAGS += -L./polarssl-1.3.2/library
|
||||||
|
+LIBS += -lpolarssl
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_TYPE), release_static)
|
||||||
|
CFLAGS += -static -O3 -s -DNDEBUG
|
||||||
|
CPPFLAGS += -static -O3 -s -DNDEBUG
|
||||||
|
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), release_static_nossl)
|
||||||
|
+CFLAGS += -static -O3 -s -DNDEBUG -DNOSSL
|
||||||
|
+CPPFLAGS += -static -O3 -s -DNDEBUG -DNOSSL
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(BUILD_TYPE), release_static_polar)
|
||||||
|
+CFLAGS += -static -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+CPPFLAGS += -static -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
|
||||||
|
+LDFLAGS += -L./polarssl-1.3.2/library
|
||||||
|
+LIBS += -lpolarssl
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: $(OUTPUT)
|
||||||
|
rm -r -f src/*.o
|
||||||
|
+ rm -r -f polarssl-1.3.2/library/*.o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -r -f $(OUTPUT) src/*.o
|
||||||
|
+ rm -r -f polarssl-1.3.2/library/*.o
|
||||||
|
|
||||||
|
$(OUTPUT): $(OBJS)
|
||||||
|
$(LINK.c) $(LDFLAGS) -o $@ $^ $(LIBS)
|
Loading…
Reference in New Issue
Block a user