瀏覽代碼

add .gitignore; support for building on a few BSD variants

ld
Sanjay Ghemawat 12 年之前
父節點
當前提交
015d26f8be
共有 3 個文件被更改,包括 31 次插入3 次删除
  1. +5
    -0
      .gitignore
  2. +15
    -0
      build_detect_platform
  3. +11
    -3
      port/port_posix.h

+ 5
- 0
.gitignore 查看文件

@ -0,0 +1,5 @@
build_config.mk
*.a
*.o
*_test
db_bench

+ 15
- 0
build_detect_platform 查看文件

@ -39,6 +39,21 @@ case `uname -s` in
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_FREEBSD" >> build_config.mk
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
;;
NetBSD)
PLATFORM=OS_NETBSD
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_NETBSD" >> build_config.mk
echo "PLATFORM_LDFLAGS=-lpthread -lgcc_s" >> build_config.mk
;;
OpenBSD)
PLATFORM=OS_OPENBSD
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_OPENBSD" >> build_config.mk
echo "PLATFORM_LDFLAGS=-pthread" >> build_config.mk
;;
DragonFly)
PLATFORM=OS_DRAGONFLYBSD
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_DRAGONFLYBSD" >> build_config.mk
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
;;
*)
echo "Unknown platform!"
exit 1

+ 11
- 3
port/port_posix.h 查看文件

@ -7,7 +7,7 @@
#ifndef STORAGE_LEVELDB_PORT_PORT_POSIX_H_
#define STORAGE_LEVELDB_PORT_PORT_POSIX_H_
#if defined(OS_MACOSX) || defined(OS_FREEBSD)
#if defined(OS_MACOSX)
#include <machine/endian.h>
#elif defined(OS_SOLARIS)
#include <sys/isa_defs.h>
@ -16,6 +16,10 @@
#else
#define BIG_ENDIAN
#endif
#elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
defined(OS_DRAGONFLYBSD)
#include <sys/types.h>
#include <sys/endian.h>
#else
#include <endian.h>
#endif
@ -33,13 +37,17 @@
#define IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#endif
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD)
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite
#define fflush_unlocked fflush
#endif
#if defined(OS_MACOSX) || defined(OS_FREEBSD)
#if defined(OS_MACOSX) || defined(OS_FREEBSD) ||\
defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
// Use fsync() on platforms without fdatasync()
#define fdatasync fsync
#endif

Loading…
取消
儲存