Skip to content

Commit 169866a

Browse files
committed
CDRIVER-2369 don't bundle snappy
1 parent be10562 commit 169866a

Some content is hidden

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

56 files changed

+159
-55016
lines changed

.evergreen/check-release-archive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ esac
1414
which sphinx-build
1515
sphinx-build --version
1616

17-
./autogen.sh --enable-html-docs --enable-man-pages --with-snappy=bundled --with-zlib=bundled --with-libbson=bundled
17+
./autogen.sh --enable-html-docs --enable-man-pages --with-snappy=auto --with-zlib=bundled --with-libbson=bundled
1818
make distcheck
1919

2020
# Check that docs were included, but sphinx temp files weren't.

.evergreen/compile-unix.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ANALYZE=${ANALYZE:-no}
2121
COVERAGE=${COVERAGE:-no}
2222
SASL=${SASL:-no}
2323
SSL=${SSL:-no}
24-
SNAPPY=${SNAPPY:-bundled}
24+
SNAPPY=${SNAPPY:-auto}
2525
ZLIB=${ZLIB:-bundled}
2626
INSTALL_DIR=$(pwd)/install-dir
2727

@@ -129,7 +129,7 @@ case "$MARCH" in
129129
i386)
130130
CFLAGS="$CFLAGS -m32 -march=i386"
131131
CXXFLAGS="$CXXFLAGS -m32 -march=i386"
132-
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-snappy=bundled --with-zlib=bundled"
132+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-snappy=auto --with-zlib=bundled"
133133
;;
134134
s390x)
135135
CFLAGS="$CFLAGS -march=z196 -mtune=zEC12"

.evergreen/config.yml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ tasks:
513513
script: |
514514
set -o errexit
515515
set -o xtrace
516-
DEBUG=yes CC='${CC}' MARCH='${MARCH}' SNAPPY=bundled ZLIB=no sh .evergreen/compile.sh
516+
DEBUG=yes CC='${CC}' MARCH='${MARCH}' SNAPPY=system ZLIB=no sh .evergreen/compile.sh
517517
- func: "upload build"
518518

519519
- name: debug-compile-compression
@@ -526,7 +526,7 @@ tasks:
526526
script: |
527527
set -o errexit
528528
set -o xtrace
529-
DEBUG=yes CC='${CC}' MARCH='${MARCH}' SNAPPY=bundled ZLIB=bundled sh .evergreen/compile.sh
529+
DEBUG=yes CC='${CC}' MARCH='${MARCH}' SNAPPY=system ZLIB=bundled sh .evergreen/compile.sh
530530
- func: "upload build"
531531

532532
- name: test-latest-server-compression-zlib
@@ -764,7 +764,7 @@ tasks:
764764
vars:
765765
BUILD_SAMPLE_WITH_CMAKE: "1"
766766

767-
- name: link-with-cmake-mac
767+
- name: link-with-cmake-ssl
768768
depends_on:
769769
- name: "make-release-archive"
770770
variant: releng
@@ -775,19 +775,20 @@ tasks:
775775
- func: "link sample program"
776776
vars:
777777
BUILD_SAMPLE_WITH_CMAKE: "1"
778+
ENABLE_SSL: "1"
778779

779-
- name: link-with-cmake-ssl
780+
- name: link-with-cmake-snappy
780781
depends_on:
781782
- name: "make-release-archive"
782783
variant: releng
783784
commands:
784785
- func: "bootstrap mongo-orchestration"
785786
vars:
786-
VERSION: "3.4"
787+
VERSION: "latest"
787788
- func: "link sample program"
788789
vars:
789790
BUILD_SAMPLE_WITH_CMAKE: "1"
790-
ENABLE_SSL: "1"
791+
ENABLE_SNAPPY: "1"
791792

792793
- name: link-with-cmake-windows
793794
depends_on:
@@ -803,9 +804,9 @@ tasks:
803804
working_dir: "mongoc"
804805
script: |
805806
set -o errexit
806-
# Build libmongoc with CMake (not Autotools) and compile a program
807-
# that links dynamically or statically to it, using variables from
808-
# CMake's find_package command.
807+
# Build libmongoc with CMake and compile a program that links
808+
# dynamically or statically to it, using variables from CMake's
809+
# find_package command.
809810
LINK_STATIC= cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
810811
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
811812
@@ -824,30 +825,43 @@ tasks:
824825
working_dir: "mongoc"
825826
script: |
826827
set -o errexit
827-
# Build libmongoc with CMake (not Autotools) and compile a program
828-
# that links dynamically or statically to it, using variables from
829-
# CMake's find_package command.
828+
# Build libmongoc with CMake and compile a program that links
829+
# dynamically or statically to it, using variables from CMake's
830+
# find_package command.
830831
export ENABLE_SSL=1
831832
LINK_STATIC= cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
832833
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
833834
834-
- name: link-with-cmake-mingw
835+
- name: link-with-cmake-windows-snappy
835836
depends_on:
836837
- name: "make-release-archive"
837838
variant: releng
838839
commands:
839840
- func: "bootstrap mongo-orchestration"
840841
vars:
841-
VERSION: "3.4"
842+
VERSION: "latest"
842843
- command: shell.exec
843844
type: test
844845
params:
845846
working_dir: "mongoc"
846847
script: |
847-
# Build libmongoc with CMake (not Autotools) and compile a program
848-
# that links dynamically or statically to it, using variables from
849-
# pkg-config.exe.
850-
cmd.exe /c .\\.evergreen\\link-sample-program-mingw.cmd
848+
set -o errexit
849+
# Build libmongoc with CMake and compile a program that links
850+
# dynamically or statically to it, using variables from CMake's
851+
# find_package command.
852+
export ENABLE_SNAPPY=1
853+
LINK_STATIC= cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
854+
LINK_STATIC=1 cmd.exe /c .\\.evergreen\\link-sample-program-msvc.cmd
855+
856+
- name: link-with-cmake-mingw
857+
depends_on:
858+
- name: "make-release-archive"
859+
variant: releng
860+
commands:
861+
- func: "bootstrap mongo-orchestration"
862+
vars:
863+
VERSION: "3.4"
864+
- func: "link sample program"
851865

852866
- name: link-with-pkg-config
853867
depends_on:
@@ -6561,9 +6575,18 @@ buildvariants:
65616575
- ubuntu1604-test
65626576
- ubuntu1404-build
65636577
- ubuntu1404-test
6564-
- name: "link-with-cmake-mac"
6578+
- name: "link-with-cmake-ssl"
65656579
distros:
6566-
- macos-1012
6580+
- ubuntu1604-build
6581+
- ubuntu1604-test
6582+
- ubuntu1404-build
6583+
- ubuntu1404-test
6584+
- name: "link-with-cmake-snappy"
6585+
distros:
6586+
- ubuntu1604-build
6587+
- ubuntu1604-test
6588+
- ubuntu1404-build
6589+
- ubuntu1404-test
65676590
- name: "link-with-cmake-windows"
65686591
distros:
65696592
- windows-64-vs2015-compile
@@ -6572,6 +6595,10 @@ buildvariants:
65726595
distros:
65736596
- windows-64-vs2015-compile
65746597
- windows-64-vs2015-test
6598+
- name: "link-with-cmake-windows-snappy"
6599+
distros:
6600+
- windows-64-vs2015-compile
6601+
- windows-64-vs2015-test
65756602
- name: "link-with-cmake-mingw"
65766603
distros:
65776604
- windows-64-vs2013-compile
@@ -6581,6 +6608,12 @@ buildvariants:
65816608
- ubuntu1604-test
65826609
- ubuntu1404-build
65836610
- ubuntu1404-test
6611+
- name: "link-with-pkg-config-ssl"
6612+
distros:
6613+
- ubuntu1604-build
6614+
- ubuntu1604-test
6615+
- ubuntu1404-build
6616+
- ubuntu1404-test
65846617
- name: "link-with-pkg-config-mac"
65856618
distros:
65866619
- macos-1012

.evergreen/link-sample-program-msvc.cmd

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
REM Supported/used environment variables:
22
REM LINK_STATIC Whether to statically link to libmongoc
33
REM ENABLE_SSL Enable SSL with Microsoft Secure Channel
4+
REM ENABLE_SNAPPY Enable Snappy compression
45

56
rem Ensure Cygwin executables like sh.exe are not in PATH
67
rem set PATH=C:\Windows\system32;C:\Windows
@@ -32,13 +33,27 @@ cd src\libbson
3233
%CMAKE% -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% .
3334
msbuild.exe /m ALL_BUILD.vcxproj
3435
msbuild.exe INSTALL.vcxproj
36+
cd %BUILD_DIR%
3537

36-
cd ..\..
38+
if "%ENABLE_SNAPPY%"=="1" (
39+
rem Enable Snappy
40+
curl --silent --retry 5 -LO https://github.com/google/snappy/archive/1.1.7.tar.gz
41+
%TAR% xzf 1.1.7.tar.gz
42+
cd snappy-1.1.7
43+
%CMAKE% -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% .
44+
msbuild.exe /m ALL_BUILD.vcxproj
45+
msbuild.exe INSTALL.vcxproj
46+
set SNAPPY_OPTION=-DENABLE_SNAPPY=ON
47+
) else (
48+
set SNAPPY_OPTION=-DENABLE_SNAPPY=OFF
49+
)
50+
51+
cd %BUILD_DIR%
3752
rem Build libmongoc
3853
if "%ENABLE_SSL%"=="1" (
3954
%CMAKE% -G "Visual Studio 14 2015 Win64" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=WINDOWS .
4055
) else (
41-
%CMAKE% -G "Visual Studio 14 2015 Win64" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=OFF .
56+
%CMAKE% -G "Visual Studio 14 2015 Win64" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=OFF %ENABLE_SNAPPY_OPTION% .
4257
)
4358

4459
msbuild.exe /m ALL_BUILD.vcxproj

.evergreen/link-sample-program.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ set -o errexit # Exit the script with error if any of the commands fail
77
# LINK_STATIC Whether to statically link to libmongoc
88
# BUILD_SAMPLE_WITH_CMAKE Link program w/ CMake. Default: use pkg-config.
99
# ENABLE_SSL Set -DENABLE_SSL or --enable-ssl.
10+
# ENABLE_SNAPPY Set -DENABLE_SNAPPY or --with-snappy.
11+
# CMAKE Path to cmake executable.
1012

1113

1214
echo "BUILD_MONGOC_WITH_CMAKE=$BUILD_MONGOC_WITH_CMAKE LINK_STATIC=$LINK_STATIC BUILD_SAMPLE_WITH_CMAKE=$BUILD_SAMPLE_WITH_CMAKE"
@@ -18,7 +20,15 @@ else
1820
fi
1921

2022
if [ $(uname) = "Darwin" ]; then
21-
CMAKE=${CMAKE:-/Applications/Cmake.app/Contents/bin/cmake}
23+
if [ ! "$CMAKE" ]; then
24+
if [ -f ""/Applications/cmake-3.2.2-Darwin-x86_64/CMake.app/Contents/bin/cmake" ]; then
25+
CMAKE="/Applications/cmake-3.2.2-Darwin-x86_64/CMake.app/Contents/bin/cmake"
26+
elif [ -f ""/Applications/Cmake.app/Contents/bin/cmake" ]; then
27+
CMAKE="/Applications/Cmake.app/Contents/bin/cmake"
28+
else
29+
CMAKE=cmake
30+
fi
31+
fi
2232
SO=dylib
2333
LIB_SO=libmongoc-1.0.0.dylib
2434
LDD="otool -L"
@@ -42,6 +52,14 @@ mkdir -p $INSTALL_DIR
4252
cd $BUILD_DIR
4353
$TAR xf ../../mongoc.tar.gz -C . --strip-components=1
4454

55+
if [ "$ENABLE_SNAPPY" ]; then
56+
SNAPPY_CONFIGURE_OPTION="--with-snappy=system"
57+
SNAPPY_CMAKE_OPTION="-DENABLE_SNAPPY=ON"
58+
else
59+
SNAPPY_CONFIGURE_OPTION="--with-snappy=no"
60+
SNAPPY_CMAKE_OPTION="-DENABLE_SNAPPY=OFF"
61+
fi
62+
4563
if [ "$ENABLE_SSL" ]; then
4664
SSL_CONFIGURE_OPTION="--enable-ssl"
4765
SSL_CMAKE_OPTION="-DENABLE_SSL:BOOL=ON"
@@ -67,11 +85,11 @@ if [ "$BUILD_MONGOC_WITH_CMAKE" ]; then
6785
make install
6886
cd ../..
6987

70-
$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_PREFIX_PATH=$INSTALL_DIR/lib/cmake $SSL_CMAKE_OPTION $STATIC_CMAKE_OPTION .
88+
$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_PREFIX_PATH=$INSTALL_DIR/lib/cmake $SSL_CMAKE_OPTION $SNAPPY_CMAKE_OPTION $STATIC_CMAKE_OPTION .
7189
make
7290
make install
7391
else
74-
./configure --prefix=$INSTALL_DIR --disable-examples $SSL_CONFIGURE_OPTION $STATIC_CONFIGURE_OPTION --with-libbson=bundled
92+
./configure --prefix=$INSTALL_DIR --disable-examples $SSL_CONFIGURE_OPTION $SNAPPY_CONFIGURE_OPTION $STATIC_CONFIGURE_OPTION --with-libbson=bundled
7593
make
7694
make install
7795
fi

CMakeLists.txt

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ if (NOT WIN32)
3636
message(WARNING "CMake support is experimental and may not produce production quality artifacts")
3737
endif ()
3838

39-
if (WIN32 AND ENABLE_SNAPPY STREQUAL "AUTO")
40-
project (libmongoc C CXX)
41-
set (ENABLE_SNAPPY "bundled")
42-
else ()
43-
project (libmongoc C CXX)
44-
endif ()
39+
project (libmongoc C)
4540

4641
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake)
4742

@@ -350,10 +345,10 @@ endif ()
350345

351346
set (MONGOC_INTERNAL_INCLUDE_DIRS "")
352347

353-
if (ENABLE_SNAPPY STREQUAL "bundled")
354-
set (MONGOC_ENABLE_COMPRESSION 1)
355-
set (MONGOC_ENABLE_COMPRESSION_SNAPPY 1)
356-
include(FindSnappy)
348+
# Sets SNAPPY_LIBS and SNAPPY_INCLUDE_DIRS.
349+
include (FindSnappy)
350+
if (SNAPPY_INCLUDE_DIRS)
351+
include_directories ("${SNAPPY_INCLUDE_DIRS}")
357352
endif ()
358353

359354
if (ENABLE_ZLIB STREQUAL "bundled")
@@ -624,7 +619,7 @@ if(CMAKE_USE_PTHREADS_INIT)
624619
set(THREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
625620
endif()
626621

627-
set (LIBS ${SASL_LIBS} ${SSL_LIBS} ${SHM_LIB} Threads::Threads)
622+
set (LIBS ${SASL_LIBS} ${SSL_LIBS} ${SHM_LIB} ${SNAPPY_LIBS} Threads::Threads)
628623
if(WIN32)
629624
set (LIBS ${LIBS} ws2_32)
630625
endif()
@@ -650,12 +645,6 @@ if (MONGOC_ENABLE_STATIC)
650645
set_target_properties(mongoc_static PROPERTIES OUTPUT_NAME "mongoc-static-${MONGOC_API_VERSION}")
651646
endif ()
652647

653-
if (ENABLE_SNAPPY STREQUAL "bundled")
654-
set_target_properties(mongoc_shared PROPERTIES LINKER_LANGUAGE CXX)
655-
if (MONGOC_ENABLE_STATIC)
656-
set_target_properties(mongoc_static PROPERTIES LINKER_LANGUAGE CXX)
657-
endif ()
658-
endif ()
659648
function(mongoc_add_test test use_shared)
660649
if (ENABLE_TESTS)
661650
add_executable(${test} ${ARGN})

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ endif
3838
include build/Makefile.am
3939

4040
ACLOCAL_AMFLAGS = -I build/autotools/m4 ${ACLOCAL_FLAGS}
41-
DISTCHECK_CONFIGURE_FLAGS = --enable-silent-rules --enable-man-pages --enable-html-docs --enable-sasl --enable-ssl --enable-maintainer-flags --enable-debug --with-libbson=bundled --with-snappy=bundled --with-zlib=bundled
41+
DISTCHECK_CONFIGURE_FLAGS = --enable-silent-rules --enable-man-pages --enable-html-docs --enable-sasl --enable-ssl --enable-maintainer-flags --enable-debug --with-libbson=bundled --with-snappy=auto --with-zlib=bundled
4242

4343
mongocdocdir = ${docdir}
4444
mongocdoc_DATA = \

0 commit comments

Comments
 (0)