Index: /trunk/Platform/ps3.mk
===================================================================
--- /trunk/Platform/ps3.mk	(revision 187)
+++ /trunk/Platform/ps3.mk	(revision 187)
@@ -0,0 +1,14 @@
+# $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
Index: /trunk/Server/Makefile
===================================================================
--- /trunk/Server/Makefile	(revision 186)
+++ /trunk/Server/Makefile	(revision 187)
@@ -22,4 +22,17 @@
 	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 $@ $<
@@ -29,3 +42,3 @@
 
 clean:
-	rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp
+	rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg
Index: /trunk/Server/config.c
===================================================================
--- /trunk/Server/config.c	(revision 186)
+++ /trunk/Server/config.c	(revision 187)
@@ -102,6 +102,8 @@
 	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);
Index: /trunk/Server/http.c
===================================================================
--- /trunk/Server/http.c	(revision 186)
+++ /trunk/Server/http.c	(revision 187)
@@ -20,5 +20,9 @@
 #else
 #ifdef USE_POLL
+#ifdef __PPU__
+#include <net/poll.h>
+#else
 #include <poll.h>
+#endif
 #else
 #include <sys/select.h>
Index: /trunk/Server/main.c
===================================================================
--- /trunk/Server/main.c	(revision 186)
+++ /trunk/Server/main.c	(revision 187)
@@ -241,4 +241,7 @@
 	}
 	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);
Index: /trunk/Server/module.c
===================================================================
--- /trunk/Server/module.c	(revision 186)
+++ /trunk/Server/module.c	(revision 187)
@@ -16,5 +16,5 @@
 extern struct tw_config config;
 
-#ifdef _PSP
+#if defined(_PSP) || defined(__PPU__)
 void* tw_module_load(const char* path) { return NULL; }
 
Index: /trunk/Server/server.c
===================================================================
--- /trunk/Server/server.c	(revision 186)
+++ /trunk/Server/server.c	(revision 187)
@@ -43,5 +43,9 @@
 #else
 #ifdef USE_POLL
+#ifdef __PPU__
+#include <net/poll.h>
+#else
 #include <poll.h>
+#endif
 #else
 #include <sys/select.h>
@@ -50,5 +54,7 @@
 #include <arpa/inet.h>
 #include <netinet/in.h>
+#ifndef __PPU__
 #include <netinet/tcp.h>
+#endif
 #ifndef NO_GETADDRINFO
 #include <netdb.h>
@@ -136,4 +142,5 @@
 			return 1;
 		}
+#ifndef __PPU__
 		if(setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&yes, sizeof(yes)) < 0) {
 			close_socket(sock);
@@ -141,4 +148,5 @@
 			return 1;
 		}
+#endif
 #ifndef NO_IPV6
 		int no = 0;
@@ -431,8 +439,8 @@
 #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;
@@ -514,5 +522,5 @@
 					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);
@@ -919,5 +927,5 @@
 					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;
@@ -945,5 +953,5 @@
 						}
 					}
-#elif defined(_PSP)
+#elif defined(_PSP) || defined(__PPU__)
 						tw_server_pass(e);
 #elif defined(__HAIKU__)
Index: /trunk/Server/tw_config.h
===================================================================
--- /trunk/Server/tw_config.h	(revision 186)
+++ /trunk/Server/tw_config.h	(revision 187)
@@ -19,4 +19,7 @@
 #define NO_IPV6
 #else
+#ifdef __PPU__
+#include <net/net.h>
+#endif
 #include <netinet/in.h>
 #ifdef __HAIKU__
Index: /trunk/Server/version.c
===================================================================
--- /trunk/Server/version.c	(revision 186)
+++ /trunk/Server/version.c	(revision 187)
@@ -22,4 +22,6 @@
 #elif defined(_PSP)
     "PSP"
+#elif defined(__PPU__)
+    "PS3"
 #else
     "Unix"
Index: /trunk/config.h.tmpl
===================================================================
--- /trunk/config.h.tmpl	(revision 186)
+++ /trunk/config.h.tmpl	(revision 187)
@@ -28,22 +28,22 @@
 #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
 
Index: /trunk/psp.sh
===================================================================
--- /trunk/psp.sh	(revision 186)
+++ /trunk/psp.sh	(revision 187)
@@ -3,4 +3,5 @@
 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
