--- /dev/null
+# $Id$
+
+PREFIX = /dev_hdd0/httpd
+
+CC = ppu-gcc
+AR = ppu-ar
+CFLAGS = -g -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I /usr/local/ps3dev/ppu/include
+LDFLAGS = -L /usr/local/ps3dev/ppu/lib
+LIBS = -lnet -lsysmodule -lsysutil -lrt -llv2
+EXEC = .elf
+LIB = .so
+MODULE =
+SERVADD = ppu-strip tewi.elf -o tewi_strip.elf
+TARGET = tewi.pkg
param.sfo:
mksfoex -d MEMSIZE=1 'Tewi HTTPd' $@
+tewi.self: tewi_strip$(EXEC)
+ sprxlinker tewi_strip$(EXEC)
+ make_self_npdrm tewi_strip$(EXEC) $@ UP0001-TEWI_00-0000000000000000
+ fself tewi_strip$(EXEC) tewi.fake.self
+
+tewi.pkg: tewi.self
+ mkdir -p pkg/USRDIR
+ cp /usr/local/ps3dev/bin/ICON0.PNG pkg/ICON0.PNG
+ make_self_npdrm tewi.elf pkg/USRDIR/EBOOT.BIN UP0001-TEWI_00-0000000000000000
+ sfo.py --title "Tewi HTTPd" --appid "TEWI" -f /usr/local/ps3dev/bin/sfo.xml pkg/PARAM.SFO
+ pkg.py --contentid UP0001-TEWI_00-0000000000000000 pkg/ $@
+ rm -rf pkg
+
.c.o:
$(CC) $(CFLAGS) $(EXTCFLAGS) -c -o $@ $<
$(WINDRES) tewi.rc -O coff -o $@
clean:
- rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp
+ rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg
config.server_root = cm_strdup(PREFIX);
config.server_admin = cm_strdup(SERVER_ADMIN);
config.defined[0] = NULL;
-#ifdef _PSP
+#if defined(_PSP)
strcpy(config.hostname, "psp");
+#elif defined(__PPU__)
+ strcpy(config.hostname, "ps3");
#else
gethostname(config.hostname, 1024);
#endif
#include <winsock2.h>
#else
#ifdef USE_POLL
+#ifdef __PPU__
+#include <net/poll.h>
+#else
#include <poll.h>
+#endif
#else
#include <sys/select.h>
#endif
sceKernelExitGame();
}
printf("Connected, My IP is %s\n", info.ip);
+#elif defined(__PPU__)
+ printf("PS3 Bootstrap, Tewi/%s\n", tw_get_version());
+ netInitialize();
#endif
int st = startup(argc, argv);
if(st != -1) {
extern struct tw_config config;
-#ifdef _PSP
+#if defined(_PSP) || defined(__PPU__)
void* tw_module_load(const char* path) { return NULL; }
void* tw_module_symbol(void* mod, const char* sym) { return NULL; }
#include "strptime.h"
#else
#ifdef USE_POLL
+#ifdef __PPU__
+#include <net/poll.h>
+#else
#include <poll.h>
+#endif
#else
#include <sys/select.h>
#endif
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
+#ifndef __PPU__
#include <netinet/tcp.h>
+#endif
#ifndef NO_GETADDRINFO
#include <netdb.h>
#endif
cm_log("Server", "setsockopt failure (reuseaddr)");
return 1;
}
+#ifndef __PPU__
if(setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&yes, sizeof(yes)) < 0) {
close_socket(sock);
cm_log("Server", "setsockopt failure (nodelay)");
return 1;
}
+#endif
#ifndef NO_IPV6
int no = 0;
if(setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&no, sizeof(no)) < 0) {
unsigned int WINAPI tw_server_pass(void* ptr) {
#elif defined(__HAIKU__)
int32_t tw_server_pass(void* ptr) {
-#elif defined(_PSP)
+#elif defined(_PSP) || defined(__PPU__)
int tw_server_pass(void* ptr) {
#endif
-#if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP)
+#if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__)
int sock = ((struct pass_entry*)ptr)->sock;
bool ssl = ((struct pass_entry*)ptr)->ssl;
int port = ((struct pass_entry*)ptr)->port;
} else if(cm_strcaseequ(req.headers[i], "If-Modified-Since")) {
struct tm tm;
strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm);
-#if defined(__MINGW32__) || defined(_PSP)
+#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__)
time_t t = 0;
struct tm* btm = localtime(&t);
cmtime = mktime(&tm);
socklen_t clen = sizeof(claddr);
int sock = accept(sockets[i], (struct sockaddr*)&claddr, &clen);
cm_log("Server", "New connection accepted");
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP)
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__)
struct pass_entry* e = malloc(sizeof(*e));
e->sock = sock;
e->ssl = config.ports[i] & (1ULL << 32);
break;
}
}
-#elif defined(_PSP)
+#elif defined(_PSP) || defined(__PPU__)
tw_server_pass(e);
#elif defined(__HAIKU__)
int j;
#include <winsock2.h>
#define NO_IPV6
#else
+#ifdef __PPU__
+#include <net/net.h>
+#endif
#include <netinet/in.h>
#ifdef __HAIKU__
#define NO_IPV6
"Cygwin"
#elif defined(_PSP)
"PSP"
+#elif defined(__PPU__)
+ "PS3"
#else
"Unix"
#endif
/* Windows should not have chroot */
#endif
-#if defined(_PSP) && !defined(NO_IPV6)
+#if (defined(_PSP) || defined(__PPU__)) && !defined(NO_IPV6)
#define NO_IPV6
-/* PSP does not have IPv6 */
+/* PSP/PS3 does not have IPv6 */
#endif
-#if defined(_PSP) && defined(USE_POLL)
+#if (defined(_PSP)) && defined(USE_POLL)
#undef USE_POLL
/* Force select(2) for PSP */
#endif
-#if defined(_PSP) && defined(HAS_CHROOT)
+#if (defined(_PSP) || defined(__PPU__)) && defined(HAS_CHROOT)
#undef HAS_CHROOT
-/* PSP should not have chroot */
+/* PSP/PS3 should not have chroot */
#endif
-#if defined(_PSP) && !defined(NO_GETADDRINFO)
+#if (defined(_PSP) || defined(__PPU__)) && !defined(NO_GETADDRINFO)
#define NO_GETADDRINFO
-/* PSP should not have getaddrinfo */
+/* PSP/PS3 should not have getaddrinfo */
#endif
#endif
# $Id$
export PSPDEV=/usr/local/pspdev
export PATH=$PATH:/usr/local/pspdev/bin
+cat config.h.tmpl | sed -E 's/#undef (NO_SSL)/#define \1/g' > config.h
rm -rf httpd
make PLATFORM=psp DESTDIR=httpd/ install
mv httpd/ms0:/PSP/GAME/httpd/* httpd/