Skip to content

Commit f2c89c2

Browse files
committed
build: progress towards bundled libbson for fallback.
1 parent 0d8e1cf commit f2c89c2

File tree

171 files changed

+9870
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+9870
-448
lines changed

AUTHORS

Lines changed: 0 additions & 2 deletions
This file was deleted.

ChangeLog

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile.am

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
EXTRA_DIST =
2-
noinst_PROGRAMS =
2+
CLEANFILES =
3+
DISTCLEANFILES =
34

4-
include mongoc/Makefile.include
5-
include examples/Makefile.include
6-
include tests/Makefile.include
7-
include tools/Makefile.include
8-
include doc/Makefile.include
5+
bin_PROGRAMS =
6+
lib_LTLIBRARIES =
7+
noinst_LTLIBRARIES =
98

10-
if HAVE_PYTHON
11-
include bindings/python/Makefile.include
12-
endif
9+
AM_CPPFLAGS = \
10+
-DMONGOC_COMPILATION \
11+
-D_BSD_SOURCE \
12+
-D_GNUC_SOURCE \
13+
-I$(top_srcdir)/src \
14+
-I$(top_srcdir)/src/mongoc \
15+
-I$(top_builddir)/src/mongoc
1316

14-
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
15-
DISTCHECK_CONFIGURE_FLAGS = --enable-silent-rules
17+
AM_CFLAGS = $(BSON_CFLAGS)
18+
19+
AM_LDFLAGS = $(BSON_LDFLAGS)
20+
21+
AM_LIBADD = \
22+
$(BSON_LIBS) \
23+
$(SHM_LIB)
1624

1725
AM_CTAGSFLAGS = --fields=+l --languages=c
1826

19-
mongocdocdir = ${docdir}
20-
mongocdoc_DATA =
21-
mongocdoc_DATA += COPYING
22-
mongocdoc_DATA += NEWS
23-
mongocdoc_DATA += README
24-
25-
pkgconfigdir = $(libdir)/pkgconfig
26-
pkgconfig_DATA =
27-
pkgconfig_DATA += $(top_builddir)/mongoc/libmongoc-1.0.pc
28-
if HAVE_SSL
29-
pkgconfig_DATA += $(top_builddir)/mongoc/libmongoc-ssl-1.0.pc
30-
endif
27+
include doc/Makefile.am
28+
include examples/Makefile.am
29+
include src/Makefile.am
30+
include tests/Makefile.am
3131

32+
ACLOCAL_AMFLAGS = -I build/autotools/m4 ${ACLOCAL_FLAGS}
33+
DISTCHECK_CONFIGURE_FLAGS = --enable-silent-rules
34+
35+
mongocdocdir = ${docdir}
36+
mongocdoc_DATA = \
37+
COPYING \
38+
NEWS \
39+
README.rst
3240
EXTRA_DIST += $(mongocdoc_DATA)
3341

3442
dist-hook:

README

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,44 @@ Security Vulnerabilities
4343
If you’ve identified a security vulnerability in a driver or any other
4444
MongoDB project, please report it according to the `instructions here
4545
<http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report>`_.
46+
47+
48+
Building From Git
49+
=================
50+
51+
The following example will install both libbson and mongo-c-driver from git.
52+
It assumes you do not yet have libbson installed and are on a 64-bit system.
53+
54+
Dependencies
55+
------------
56+
57+
Fedora::
58+
59+
$ sudo yum install git gcc automake autoconf libtool
60+
61+
FreeBSD::
62+
63+
$ pkg install git gcc automake autoconf libtool
64+
65+
66+
Clone Repositories
67+
------------------
68+
69+
You can use the following to checkout and build libbson and mongo-c-driver.::
70+
71+
$ for name in "libbson mongo-c-driver"
72+
73+
$ git clone https://github.com/mongodb/libbson.git
74+
$ git clone https://github.com/mongodb/mongo-c-driver.git
75+
76+
$ cd libbson
77+
$ ./autogen.sh --prefix=/usr --libdir=/usr/lib64
78+
$ make
79+
$ sudo make install
80+
$ cd -
81+
$ cd mongo-c-driver
82+
$ ./autogen.sh --prefix=/usr --libdir=/usr/lib64
83+
$ make
84+
$ sudo make install
85+
86+

TODO.md

Lines changed: 0 additions & 78 deletions
This file was deleted.

autogen.sh

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
1-
#!/bin/sh
1+
#! /bin/sh
22

3-
autoreconf -fiv
4-
./configure $@
3+
# Allow invocation from a separate build directory; in that case, we change
4+
# to the source directory to run the auto*, then change back before running configure
5+
srcdir=`dirname "$0"`
6+
test -z "$srcdir" && srcdir=.
7+
8+
ORIGDIR=`pwd`
9+
cd "$srcdir" || exit 1
10+
11+
if [ ! -f README ]; then
12+
ln -s README.md README
13+
fi
14+
15+
if [ ! -f COPYING ]; then
16+
ln -s LICENSE COPYING
17+
fi
18+
19+
touch ChangeLog
20+
touch AUTHORS
21+
22+
if test -z `which autoreconf`; then
23+
echo "Error: autoreconf not found, please install it."
24+
exit 1
25+
fi
26+
autoreconf --force --verbose --install -I build/autotools $ACLOCAL_FLAGS|| exit $?
27+
rm -rf autom4te.cache
28+
29+
cd "$ORIGDIR" || exit 1
30+
31+
if test -z "$NOCONFIGURE"; then
32+
"$srcdir"/configure $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
33+
fi

bindings/python/Makefile.include

Lines changed: 0 additions & 28 deletions
This file was deleted.

build/autotools/AutoHarden.m4

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# We want to check for compiler flag support, but there is no way to make
2+
# clang's "argument unused" warning fatal. So we invoke the compiler through a
3+
# wrapper script that greps for this message.
4+
saved_CC="$CC"
5+
saved_CXX="$CXX"
6+
saved_LD="$LD"
7+
flag_wrap="$srcdir/scripts/wrap-compiler-for-flag-check"
8+
CC="$flag_wrap $CC"
9+
CXX="$flag_wrap $CXX"
10+
LD="$flag_wrap $LD"
11+
12+
# We use the same hardening flags for C and C++. We must check that each flag
13+
# is supported by both compilers.
14+
AC_DEFUN([check_cc_cxx_flag],
15+
[AC_LANG_PUSH(C)
16+
AX_CHECK_COMPILE_FLAG([$1],
17+
[AC_LANG_PUSH(C++)
18+
AX_CHECK_COMPILE_FLAG([$1], [$2], [$3], [-Werror $4])
19+
AC_LANG_POP(C++)],
20+
[$3], [-Werror $4])
21+
AC_LANG_POP(C)])
22+
AC_DEFUN([check_link_flag],
23+
[AX_CHECK_LINK_FLAG([$1], [$2], [$3], [-Werror $4])])
24+
25+
AC_ARG_ENABLE([hardening],
26+
[AS_HELP_STRING([--enable-hardening],
27+
[Enable compiler and linker options to frustrate memory corruption exploits @<:@yes@:>@])],
28+
[enable_hardening="$enableval"],
29+
[enable_hardening="yes"])
30+
31+
HARDEN_CFLAGS=""
32+
HARDEN_LDFLAGS=""
33+
AS_IF([test x"$enable_hardening" != x"no"], [
34+
check_cc_cxx_flag([-fno-strict-overflow], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow"])
35+
36+
# This one will likely succeed, even on platforms where it does nothing.
37+
check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
38+
39+
check_cc_cxx_flag([-fstack-protector-all],
40+
[check_link_flag([-fstack-protector-all],
41+
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
42+
check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
43+
[], [-fstack-protector-all])
44+
check_cc_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
45+
[], [-fstack-protector-all])])])
46+
47+
# At the link step, we might want -pie (GCC) or -Wl,-pie (Clang on OS X)
48+
#
49+
# The linker checks also compile code, so we need to include -fPIE as well.
50+
check_cc_cxx_flag([-fPIE],
51+
[check_link_flag([-fPIE -pie],
52+
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE"
53+
HARDEN_LDFLAGS="$HARDEN_LDFLAGS -pie"],
54+
[check_link_flag([-fPIE -Wl,-pie],
55+
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE"
56+
HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-pie"])])])
57+
58+
check_link_flag([-Wl,-z,relro],
59+
[HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro"
60+
check_link_flag([-Wl,-z,now], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now"])])])
61+
AC_SUBST([HARDEN_CFLAGS])
62+
AC_SUBST([HARDEN_LDFLAGS])
63+
64+
# End of flag tests.
65+
CC="$saved_CC"
66+
CXX="$saved_CXX"
67+
LD="$saved_LD"

build/autotools/CheckCompiler.m4

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# If CFLAGS and CXXFLAGS are unset, default to empty.
2+
# This is to tell automake not to include '-g' if C{XX,}FLAGS is not set.
3+
# For more info - http://www.gnu.org/software/automake/manual/autoconf.html#C_002b_002b-Compiler
4+
if test -z "$CXXFLAGS"; then
5+
CXXFLAGS=""
6+
fi
7+
if test -z "$CFLAGS"; then
8+
CFLAGS=""
9+
fi
10+
11+
AC_PROG_CC
12+
AC_PROG_CXX
13+
14+
# Check that an appropriate C compiler is available.
15+
c_compiler="unknown"
16+
AC_LANG_PUSH([C])
17+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
18+
#if !(defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1)
19+
#error Not a supported GCC compiler
20+
#endif
21+
])], [c_compiler="gcc"], [])
22+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
23+
#if !(defined(__clang__) && __clang_major__ >= 3 && __clang_minor__ >= 3)
24+
#error Not a supported Clang compiler
25+
#endif
26+
])], [c_compiler="clang"], [])
27+
AC_LANG_POP([C])
28+
29+
if test "$c_compiler" = "unknown"; then
30+
AC_MSG_ERROR([Compiler GCC >= 4.1 or Clang >= 3.3 is required for C compilation])
31+
fi
32+
33+
AC_C_CONST
34+
AC_C_INLINE
35+
AC_C_TYPEOF

0 commit comments

Comments
 (0)