| Index: ports/leveldb/nacl.patch
|
| diff --git a/ports/leveldb/nacl.patch b/ports/leveldb/nacl.patch
|
| index 880c5c62201f2cb46a3855c70e33f07ed88f08b3..43a6d0dcf75a7a77415df99cb9627d9d24afc2ee 100644
|
| --- a/ports/leveldb/nacl.patch
|
| +++ b/ports/leveldb/nacl.patch
|
| @@ -1,7 +1,7 @@
|
| diff --git a/Makefile b/Makefile
|
| --- a/Makefile
|
| +++ b/Makefile
|
| -@@ -90,7 +90,11 @@ endif # PLATFORM_SHARED_EXT
|
| +@@ -99,7 +99,11 @@ endif # PLATFORM_SHARED_EXT
|
|
|
| all: $(SHARED) $(LIBRARY)
|
|
|
| @@ -17,7 +17,7 @@ diff --git a/Makefile b/Makefile
|
| diff --git a/build_detect_platform b/build_detect_platform
|
| --- a/build_detect_platform
|
| +++ b/build_detect_platform
|
| -@@ -98,6 +98,22 @@ case "$TARGET_OS" in
|
| +@@ -104,6 +104,31 @@ case "$TARGET_OS" in
|
| PLATFORM_LIBS="-lpthread"
|
| PORT_FILE=port/port_posix.cc
|
| ;;
|
| @@ -27,12 +27,21 @@ diff --git a/build_detect_platform b/build_detect_platform
|
| + PLATFORM_LDFLAGS="-pthread"
|
| + PORT_FILE=port/port_posix.cc
|
| + CROSS_COMPILE=true
|
| -+ if [ "$NACL_ARCH" = arm -o "$NACL_ARCH" = pnacl ]; then
|
| ++ if [ "$TOOLCHAIN" = "pnacl" -o "$TOOLCHAIN" = "clang-newlib" ]; then
|
| + COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_ATOMIC_PRESENT"
|
| + # Would use -std=c++11 here but its broken on PNaCl:
|
| + # http://crbug.com/314944
|
| + PLATFORM_CXXFLAGS="-std=gnu++11"
|
| + fi
|
| ++ if [ "$TOOLCHAIN" = "glibc" ]; then
|
| ++ if [ "$NACL_ARCH" = "arm" ]; then
|
| ++ COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_ATOMIC_PRESENT"
|
| ++ PLATFORM_CXXFLAGS="-std=c++11"
|
| ++ else
|
| ++ COMMON_FLAGS="$COMMON_FLAGS -D__STDC_LIMIT_MACROS"
|
| ++ PLATFORM_CXXFLAGS="-std=c++0x"
|
| ++ fi
|
| ++ fi
|
| + if [ "$NACL_SHARED" != 1 ]; then
|
| + PLATFORM_SHARED_EXT=""
|
| + fi
|
| @@ -40,34 +49,10 @@ diff --git a/build_detect_platform b/build_detect_platform
|
| NetBSD)
|
| PLATFORM=OS_NETBSD
|
| COMMON_FLAGS="$MEMCMP_FLAG -D_REENTRANT -DOS_NETBSD"
|
| -diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
|
| ---- a/port/atomic_pointer.h
|
| -+++ b/port/atomic_pointer.h
|
| -@@ -20,6 +20,9 @@
|
| - #define PORT_ATOMIC_POINTER_H_
|
| -
|
| - #include <stdint.h>
|
| -+#ifdef LEVELDB_ATOMIC_PRESENT
|
| -+#include <atomic>
|
| -+#endif
|
| - #ifdef LEVELDB_CSTDATOMIC_PRESENT
|
| - #include <cstdatomic>
|
| - #endif
|
| -@@ -125,8 +128,8 @@ class AtomicPointer {
|
| - }
|
| - };
|
| -
|
| --// AtomicPointer based on <cstdatomic>
|
| --#elif defined(LEVELDB_CSTDATOMIC_PRESENT)
|
| -+// AtomicPointer based on <cstdatomic> or <atomic>
|
| -+#elif defined(LEVELDB_CSTDATOMIC_PRESENT) || defined(LEVELDB_ATOMIC_PRESENT)
|
| - class AtomicPointer {
|
| - private:
|
| - std::atomic<void*> rep_;
|
| diff --git a/port/port_posix.h b/port/port_posix.h
|
| --- a/port/port_posix.h
|
| +++ b/port/port_posix.h
|
| -@@ -37,6 +37,14 @@
|
| +@@ -34,6 +34,14 @@
|
| // See http://code.google.com/p/android/issues/detail?id=39824
|
| #include <endian.h>
|
| #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
|
| @@ -82,19 +67,19 @@ diff --git a/port/port_posix.h b/port/port_posix.h
|
| #else
|
| #include <endian.h>
|
| #endif
|
| -@@ -55,7 +63,7 @@
|
| +@@ -52,7 +60,7 @@
|
|
|
| #if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
|
| defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
|
| -- defined(OS_ANDROID) || defined(OS_HPUX)
|
| -+ defined(OS_ANDROID) || defined(OS_HPUX) || (defined(OS_NACL) && (defined(_NEWLIB_VERSION) || defined(__BIONIC__)))
|
| +- defined(OS_ANDROID) || defined(OS_HPUX) || defined(CYGWIN)
|
| ++ defined(OS_ANDROID) || defined(OS_HPUX) || defined(CYGWIN) || (defined(OS_NACL) && (defined(_NEWLIB_VERSION) || defined(__BIONIC__)))
|
| // Use fread/fwrite/fflush on platforms without _unlocked variants
|
| #define fread_unlocked fread
|
| #define fwrite_unlocked fwrite
|
| diff --git a/util/env_posix.cc b/util/env_posix.cc
|
| --- a/util/env_posix.cc
|
| +++ b/util/env_posix.cc
|
| -@@ -27,6 +27,32 @@
|
| +@@ -24,6 +24,32 @@
|
| #include "util/mutexlock.h"
|
| #include "util/posix_logger.h"
|
|
|
| @@ -127,7 +112,7 @@ diff --git a/util/env_posix.cc b/util/env_posix.cc
|
| namespace leveldb {
|
|
|
| namespace {
|
| -@@ -257,6 +283,9 @@ class PosixWritableFile : public WritableFile {
|
| +@@ -254,6 +280,9 @@ class PosixWritableFile : public WritableFile {
|
| };
|
|
|
| static int LockOrUnlock(int fd, bool lock) {
|
| @@ -137,7 +122,7 @@ diff --git a/util/env_posix.cc b/util/env_posix.cc
|
| errno = 0;
|
| struct flock f;
|
| memset(&f, 0, sizeof(f));
|
| -@@ -265,6 +294,7 @@ static int LockOrUnlock(int fd, bool lock) {
|
| +@@ -262,6 +291,7 @@ static int LockOrUnlock(int fd, bool lock) {
|
| f.l_start = 0;
|
| f.l_len = 0; // Lock/unlock entire file
|
| return fcntl(fd, F_SETLK, &f);
|
|
|