| OLD | NEW |
| 1 diff --git a/Makefile b/Makefile | 1 diff --git a/Makefile b/Makefile |
| 2 index 133a1ef..ecd1e27 100644 | 2 index 133a1ef..ecd1e27 100644 |
| 3 --- a/Makefile | 3 --- a/Makefile |
| 4 +++ b/Makefile | 4 +++ b/Makefile |
| 5 @@ -9,8 +9,8 @@ | 5 @@ -9,8 +9,8 @@ |
| 6 | 6 |
| 7 include resources/Makefile.in-os | 7 include resources/Makefile.in-os |
| 8 | 8 |
| 9 -CPROG = civetweb | 9 -CPROG = civetweb |
| 10 #CXXPROG = civetweb | 10 #CXXPROG = civetweb |
| 11 +CPROG = civetweb | 11 +CPROG = civetweb |
| 12 | 12 |
| 13 BUILD_DIR = out | 13 BUILD_DIR = out |
| 14 | 14 |
| 15 @@ -92,7 +92,11 @@ LIB_OBJECTS = $(filter-out $(MAIN_OBJECTS), $(BUILD_OBJECTS)) | 15 @@ -92,7 +92,11 @@ LIB_OBJECTS = $(filter-out $(MAIN_OBJECTS), $(BUILD_OBJECTS)) |
| 16 | 16 |
| 17 LIBS = -lpthread -lm | 17 LIBS = -lpthread -lm |
| 18 | 18 |
| 19 -ifeq ($(TARGET_OS),LINUX) | 19 -ifeq ($(TARGET_OS),LINUX) |
| 20 +ifeq ($(TARGET_OS),NACL) | 20 +ifeq ($(TARGET_OS),NACL) |
| 21 + LIBS += -lppapi_simple -lnacl_io -lppapi_cpp -lppapi | 21 + LIBS += -lppapi_simple -lnacl_io -lppapi_cpp -lppapi |
| 22 +endif | 22 +endif |
| 23 + | 23 + |
| 24 +ifeq ($(TARGET_OS),LINUX) | 24 +ifeq ($(TARGET_OS),LINUX) |
| 25 LIBS += -ldl | 25 LIBS += -ldl |
| 26 endif | 26 endif |
| 27 | 27 |
| 28 diff --git a/src/civetweb.c b/src/civetweb.c | 28 diff --git a/src/civetweb.c b/src/civetweb.c |
| 29 index 3cc395a..d1ff233 100644 | 29 index 3cc395a..35ca367 100644 |
| 30 --- a/src/civetweb.c | 30 --- a/src/civetweb.c |
| 31 +++ b/src/civetweb.c | 31 +++ b/src/civetweb.c |
| 32 @@ -61,6 +61,13 @@ | 32 @@ -222,7 +222,7 @@ struct pollfd { |
| 33 #define IGNORE_UNUSED_RESULT(a) (void)((a) && 1) | |
| 34 #endif | |
| 35 | |
| 36 +#if defined(__native_client__) && !defined(__GLIBC__) | |
| 37 +// Newlib doesn't currently implemnt flockfile/funlockfile. | |
| 38 +// TODO(sbc): remove this once newlib is fixed. | |
| 39 +#define flockfile(x) | |
| 40 +#define funlockfile(x) | |
| 41 +#endif | |
| 42 + | |
| 43 #ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */ | |
| 44 #include <sys/types.h> | |
| 45 #include <sys/stat.h> | |
| 46 @@ -222,7 +229,7 @@ struct pollfd { | |
| 47 #else /* UNIX specific */ | 33 #else /* UNIX specific */ |
| 48 #include <sys/wait.h> | 34 #include <sys/wait.h> |
| 49 #include <sys/socket.h> | 35 #include <sys/socket.h> |
| 50 -#include <sys/poll.h> | 36 -#include <sys/poll.h> |
| 51 +#include <poll.h> | 37 +#include <poll.h> |
| 52 #include <netinet/in.h> | 38 #include <netinet/in.h> |
| 53 #include <arpa/inet.h> | 39 #include <arpa/inet.h> |
| 54 #include <sys/time.h> | 40 #include <sys/time.h> |
| 41 @@ -330,6 +330,13 @@ typedef int socklen_t; |
| 42 #define MGSQLEN 20 |
| 43 #endif |
| 44 |
| 45 +#if defined(__native_client__) && defined(_NEWLIB_VERSION) |
| 46 +// Newlib doesn't currently implemnt flockfile/funlockfile. |
| 47 +// TODO(sbc): remove this once newlib is fixed. |
| 48 +#define flockfile(x) |
| 49 +#define funlockfile(x) |
| 50 +#endif |
| 51 + |
| 52 static const char *http_500_error = "Internal Server Error"; |
| 53 |
| 54 #if defined(NO_SSL_DL) |
| 55 diff --git a/src/main.c b/src/main.c | 55 diff --git a/src/main.c b/src/main.c |
| 56 index c8dff6e..97d3264 100644 | 56 index c8dff6e..97d3264 100644 |
| 57 --- a/src/main.c | 57 --- a/src/main.c |
| 58 +++ b/src/main.c | 58 +++ b/src/main.c |
| 59 @@ -69,9 +69,17 @@ extern char *_getcwd(char *buf, size_t size); | 59 @@ -69,9 +69,17 @@ extern char *_getcwd(char *buf, size_t size); |
| 60 #include <unistd.h> | 60 #include <unistd.h> |
| 61 #define DIRSEP '/' | 61 #define DIRSEP '/' |
| 62 #define WINCDECL | 62 #define WINCDECL |
| 63 +#ifdef __native_client__ | 63 +#ifdef __native_client__ |
| 64 +// realpath is currently broken under glibc at least: | 64 +// realpath is currently broken under glibc at least: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 printf("%s started on port(s) %s with web root [%s]\n", | 123 printf("%s started on port(s) %s with web root [%s]\n", |
| 124 @@ -1067,4 +1113,8 @@ int main(int argc, char *argv[]) | 124 @@ -1067,4 +1113,8 @@ int main(int argc, char *argv[]) |
| 125 | 125 |
| 126 return EXIT_SUCCESS; | 126 return EXIT_SUCCESS; |
| 127 } | 127 } |
| 128 + | 128 + |
| 129 +#ifdef __native_client__ | 129 +#ifdef __native_client__ |
| 130 +PPAPI_SIMPLE_REGISTER_MAIN(civetweb_main) | 130 +PPAPI_SIMPLE_REGISTER_MAIN(civetweb_main) |
| 131 +#endif | 131 +#endif |
| 132 #endif /* _WIN32 */ | 132 #endif /* _WIN32 */ |
| OLD | NEW |