diff options
author | Roderick Sheeter <rsheeter@google.com> | 2013-12-12 10:43:05 -0800 |
---|---|---|
committer | Roderick Sheeter <rsheeter@google.com> | 2013-12-12 10:43:05 -0800 |
commit | 2e5995bd9628953ebd8bfdadbfbc3af0c8296167 (patch) | |
tree | 52a560460b6b770f4f29adce096db97145be6728 | |
parent | e70949119a5540e62ef3b9aae797f797a8d8b44b (diff) | |
download | src-2e5995bd9628953ebd8bfdadbfbc3af0c8296167.tar.gz |
Support for OSX build; tested using OSX 10.9/clang-500.2.79
-rw-r--r-- | brotli/enc/entropy_encode.cc | 1 | ||||
-rw-r--r-- | brotli/enc/hash.h | 1 | ||||
-rw-r--r-- | brotli/enc/write_bits.h | 6 | ||||
-rw-r--r-- | shared.mk | 9 | ||||
-rw-r--r-- | woff2/ots.h | 21 |
5 files changed, 17 insertions, 21 deletions
diff --git a/brotli/enc/entropy_encode.cc b/brotli/enc/entropy_encode.cc index 5d53da7..ad9f0f5 100644 --- a/brotli/enc/entropy_encode.cc +++ b/brotli/enc/entropy_encode.cc @@ -20,6 +20,7 @@ #include <algorithm> #include <limits> #include <vector> +#include <cstdlib> #include "./histogram.h" diff --git a/brotli/enc/hash.h b/brotli/enc/hash.h index c11e3a5..b45d71c 100644 --- a/brotli/enc/hash.h +++ b/brotli/enc/hash.h @@ -23,6 +23,7 @@ #include <string.h> #include <sys/types.h> #include <algorithm> +#include <cstdlib> #include "./fast_log.h" #include "./find_match_length.h" diff --git a/brotli/enc/write_bits.h b/brotli/enc/write_bits.h index ce888e6..cf6f53e 100644 --- a/brotli/enc/write_bits.h +++ b/brotli/enc/write_bits.h @@ -18,7 +18,11 @@ #define BROTLI_ENC_WRITE_BITS_H_ #include <assert.h> -#include <endian.h> +#if defined(OS_MACOSX) + #include <machine/endian.h> +#else + #include <endian.h> +#endif #include <stdint.h> #include <stdio.h> @@ -1,10 +1,17 @@ +OS := $(shell uname) IDIRS=-I../brotli/dec/ -I../brotli/enc/ -I../ -GFLAGS=-no-canonical-prefixes -fno-omit-frame-pointer -fno-tree-vrp -m64 +GFLAGS=-no-canonical-prefixes -fno-omit-frame-pointer -m64 CPP = g++ LFLAGS = CPPFLAGS = -c $(IDIRS) -std=c++0x $(GFLAGS) +ifeq ($(OS), Darwin) + CPPFLAGS += -DOS_MACOSX +else + CPPFLAGS += -fno-tree-vrp +endif + %.o : %.c $(CPP) $(CPPFLAGS) $< -o $@ diff --git a/woff2/ots.h b/woff2/ots.h index 65b0d8c..4eac1cb 100644 --- a/woff2/ots.h +++ b/woff2/ots.h @@ -18,31 +18,14 @@ #ifndef BROTLI_WOFF2_OTS_H_ #define BROTLI_WOFF2_OTS_H_ +#include <stdint.h> +#include <arpa/inet.h> #include <cstdlib> #include <cstring> #include <limits> namespace ots { -#if defined(_WIN32) -#include <stdlib.h> -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#define ntohl(x) _byteswap_ulong (x) -#define ntohs(x) _byteswap_ushort (x) -#define htonl(x) _byteswap_ulong (x) -#define htons(x) _byteswap_ushort (x) -#else -#include <arpa/inet.h> -#include <stdint.h> -#endif - #if defined(_MSC_VER) || !defined(OTS_DEBUG) #define OTS_FAILURE() false #else |