Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor: update build docs

  • Loading branch information...
commit f7cf83ffeb88dc3689c723b5e9841203bbd68625 1 parent f322fa2
@banker banker authored
Showing with 57 additions and 10 deletions.
  1. +9 −1 Makefile
  2. +48 −9 docs/source/sphinx/source/building.rst
View
10 Makefile
@@ -24,6 +24,9 @@ BSON_MINOR=$(MONGO_MINOR)
MONGO_LIBNAME=libmongoc
BSON_LIBNAME=libbson
+# Standard or posix env.
+ENV?=posix
+
# TODO: add replica set test, cpp test, platform tests, json_test
TESTS=test/auth_test test/bson_test test/bson_subobject_test test/count_delete_test \
test/cursors_test test/endian_swap_test test/errors_test test/examples_test \
@@ -31,7 +34,12 @@ TESTS=test/auth_test test/bson_test test/bson_subobject_test test/count_delete_t
test/oid_test test/resize_test test/simple_test test/sizes_test test/update_test \
test/validate_test
MONGO_OBJECTS=src/bson.o src/encoding.o src/gridfs.o src/md5.o src/mongo.o \
- src/numbers.o src/env_posix.o
+ src/numbers.o
+ifeq ($(ENV),posix)
+ MONGO_OBJECTS+=src/env_posix.c
+else
+ MONGO_OBJECTS+=src/env_standard.c
+endif
BSON_OBJECTS=src/bson.o src/numbers.o src/encoding.o
# Compile flags
View
57 docs/source/sphinx/source/building.rst
@@ -2,11 +2,11 @@ Building the MongoDB C Driver
=============================
First checkout the version you want to build. *Always build from a particular tag, since HEAD may be
-a work in progress.* For example, to build version 0.4, run:
+a work in progress.* For example, to build version 0.5, run:
.. code-block:: bash
- git checkout v0.4
+ git checkout v0.5
Then follow the build steps below.
@@ -38,8 +38,8 @@ defining one of these:
Building with Make:
-------------------
-If you're building the driver on UNIX-like platforms, including on OS X,
-then you can build with ``make``.
+If you're building the driver on posix-compliant platforms, including on OS X
+and Linux, then you can build with ``make``.
To compile the driver, run:
@@ -54,7 +54,7 @@ This will build the following libraries:
* libmongoc.a
* lobmongoc.so (libmongoc.dylib)
-You can install the librares with make as well:
+You can install the libraries with make as well:
.. code-block:: bash
@@ -85,13 +85,13 @@ with ``gcc`` like so:
.. code-block:: bash
- gcc --std=c99 -I/usr/local/include -L/usr/local/lib -o example docs/example/example.c -lmongoc
+ gcc --std=c99 -I/usr/local/include -L/usr/local/lib -o example docs/examples/example.c -lmongoc
If you want to statically link the program, add the ``-static`` option:
.. code-block:: bash
- gcc --std=c99 -static -I/usr/local/include -L/usr/local/lib -o example docs/example/example.c -lmongoc
+ gcc --std=c99 -static -I/usr/local/include -L/usr/local/lib -o example docs/examples/example.c -lmongoc
Then run the program:
@@ -120,17 +120,56 @@ with optimizations enabled:
scons --c99
-Once you're built the libraries, you can compile a program with ``gcc`` like so:
+Once you've built the libraries, you can compile a program with ``gcc`` like so:
.. code-block:: bash
gcc --std=c99 -static -Isrc -o example docs/example/example.c libmongoc.a
+On Posix systems, you may also install the libraries with scons:
+
+.. code-block:: bash
+
+ scons install
+
+To build the docs:
+
+.. code-block:: bash
+
+ scons docs
+
Platform-specific features
--------------------------
-TODO.
+The original goal of the MongoDB C driver was to provide a very basic library
+capable of being embedded anywhere. This goal is now evolving somewhat given
+the increased use of the driver. In particular, it now makes sense to provide
+platform-specific features, such as socket timeouts and DNS resolution, and to
+return platform-specific error codes.
+
+To that end, we've organized all platform-specific code in the following files:
+
+* ``env_standard.c``: a standard, platform-agnostic implementation.
+* ``env_posix.c``: an implementation geared for Posix-compliant systems (Linux, OS X).
+* ``env_win32.c``: a Windows implementation.
+
+Each of these implements the interface defined in ``env.h``.
+
+When building with ``make``, we use ``env_posix.c``. When building with SCons_, we
+use ``env_posix.c`` or ``env_win32.c``, depending on the platform.
+
+If you want to compile with the generic, platform implementation, you have to do so
+explicity. In SCons_:
+
+.. code-block:: bash
+
+ scons --standard-env
+
+Using ``make``:
+
+.. code-block:: bash
+ make ENV=standard
Dependencies
------------
Please sign in to comment.
Something went wrong with that request. Please try again.