diff options
author | Nicolas Noble <pixel@nobis-crew.org> | 2015-03-15 20:05:24 -0700 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-03-16 04:27:02 +0100 |
commit | f358573091ef9c14c39ea56d9d9883410a533992 (patch) | |
tree | 74e7d4a57f255241dc5f285445157b131ce2a4d8 | |
parent | 764971354c530598c32ca2fc133a5350283eeb57 (diff) |
FreeBSD preliminary work.
-) You can't assume bash is installed. Scripts needs to be cleaned out of bashisms.
-) You can't assume python is in /usr/bin. Use env instead.
-) AF_INET is in sys/socket.h
-) Added port_platform's basic structure for FreeBSD, based off Darwin.
-) FreeBSD doesn't have and doesn't need libdl for OpenSSL.
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | include/grpc/support/port_platform.h | 24 | ||||
-rw-r--r-- | templates/Makefile.template | 12 | ||||
-rwxr-xr-x | test/core/end2end/gen_build_json.py | 2 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.c | 1 | ||||
-rwxr-xr-x | tools/buildgen/build-cleaner.py | 2 | ||||
-rwxr-xr-x | tools/buildgen/generate_projects.sh | 8 | ||||
-rwxr-xr-x | tools/buildgen/mako_renderer.py | 2 | ||||
-rwxr-xr-x | tools/run_tests/run_tests.py | 2 |
9 files changed, 53 insertions, 12 deletions
@@ -272,7 +272,10 @@ else IS_GIT_FOLDER = true endif -OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS) +OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c -lssl -lcrypto $(LDFLAGS) +ifeq ($(SYSTEM),Linux) +OPENSSL_ALPN_CHECK_CMD += -ldl +endif ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -344,12 +347,17 @@ OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/o # need to prefix these to ensure overriding system libraries CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS) LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS) +ifeq ($(SYSTEM),Linux) LIBS_SECURE = dl +endif else NO_SECURE = true endif else -LIBS_SECURE = ssl crypto dl +LIBS_SECURE = ssl crypto +ifeq ($(SYSTEM),Linux) +LIBS_SECURE += dl +endif endif LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index f04c2e76af..17f2851f92 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -137,6 +137,30 @@ #else /* _LP64 */ #define GPR_ARCH_32 1 #endif /* _LP64 */ +#elif defined(__FreeBSD__) +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#define GPR_CPU_POSIX 1 +#define GPR_GCC_ATOMIC 1 +#define GPR_POSIX_LOG 1 +#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 +#define GPR_POSIX_WAKEUP_FD 1 +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_ENV 1 +#define GPR_POSIX_FILE 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 +#ifdef _LP64 +#define GPR_ARCH_64 1 +#else /* _LP64 */ +#define GPR_ARCH_32 1 +#endif /* _LP64 */ #else #error Could not auto-detect platform #endif diff --git a/templates/Makefile.template b/templates/Makefile.template index a69c7a7f2f..621b008161 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -289,7 +289,10 @@ else IS_GIT_FOLDER = true endif -OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS) +OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c -lssl -lcrypto $(LDFLAGS) +ifeq ($(SYSTEM),Linux) +OPENSSL_ALPN_CHECK_CMD += -ldl +endif ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -361,12 +364,17 @@ OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/o # need to prefix these to ensure overriding system libraries CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS) LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS) +ifeq ($(SYSTEM),Linux) LIBS_SECURE = dl +endif else NO_SECURE = true endif else -LIBS_SECURE = ssl crypto dl +LIBS_SECURE = ssl crypto +ifeq ($(SYSTEM),Linux) +LIBS_SECURE += dl +endif endif LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index 67fc0a6e53..23349daafe 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 2689c3f38e..708444a287 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -38,6 +38,7 @@ #include <grpc/support/time.h> #include "test/core/util/test_config.h" +#include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <unistd.h> diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 1d9157aad7..6c5355bce3 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh index 7a12440db2..45f08df38f 100755 --- a/tools/buildgen/generate_projects.sh +++ b/tools/buildgen/generate_projects.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright 2015, Google Inc. # All rights reserved. # @@ -31,7 +31,7 @@ set -e -if [ "x$TEST" == "x" ] ; then +if [ "x$TEST" = "x" ] ; then TEST=false fi @@ -61,12 +61,12 @@ for dir in . ; do out=${out%.*} # strip template extension json_files="build.json $end2end_test_build" data=`for i in $json_files; do echo -n "-d $i "; done` - if [ $TEST == true ] ; then + if [ "x$TEST" = "xtrue" ] ; then actual_out=$out out=`mktemp /tmp/gentXXXXXX` fi $mako_renderer $plugins $data -o $out $file - if [ $TEST == true ] ; then + if [ "x$TEST" = "xtrue" ] ; then diff -q $out $actual_out rm $out fi diff --git a/tools/buildgen/mako_renderer.py b/tools/buildgen/mako_renderer.py index f0dc818c0c..534377e69e 100755 --- a/tools/buildgen/mako_renderer.py +++ b/tools/buildgen/mako_renderer.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index aee19cdc42..338f564948 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python # Copyright 2015, Google Inc. # All rights reserved. # |