Skip to content

Commit a2632f3

Browse files
committed
Merge pull request #947
2 parents 94d8698 + e26c3c9 commit a2632f3

File tree

112 files changed

+1706
-507
lines changed

Some content is hidden

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

112 files changed

+1706
-507
lines changed

.evergreen/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Evergreen Notes
2+
3+
## mongo-php-toolchain
4+
5+
[10gen/mongo-php-toolchain](https://github.com/10gen/mongo-php-toolchain) is
6+
responsible for building PHP binaries that will be distributed to Evergreen
7+
hosts.
8+
9+
The Debian and RHEL toolchain scripts are responsible for building individual
10+
toolchains for each variant (e.g. PHP version, architecture). Debian and RHEL
11+
are separate primarily for reasons related to OpenSSL.
12+
13+
## drivers-evergreen-tools
14+
15+
[mongodb-labs/drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools)
16+
consists of common scripts used by many drivers (e.g. Mongo Orchestration). The
17+
PHP driver clones this during the build process.
18+
19+
In some cases, we have modified scripts in the drivers-evergreen-tools
20+
repository. For instance, the PHP driver uses its own `run-orchestration.sh`
21+
script but still relies on the common `stop-orchestration.sh` script.
22+
23+
## PHP driver Evergreen configuration
24+
25+
`$PROJECT_DIRECTORY` is set by Evergreen and denotes the directory where the PHP
26+
driver is built and tested (i.e. git checkout directory).
27+
28+
Various files have been copied and modified from drivers-evergreen-tools:
29+
30+
* `compile.sh`: This is the main entry point for building the driver and will
31+
either call `compile-unix.sh` and `compile-windows.sh`; however, Windows
32+
builds use a Cygwin environment and are not yet supported.
33+
* `compile-unix.sh`: This includes architecture-specific flags and is used for
34+
both Linux and macOS builds.
35+
* `run-orchestration.sh`: This is very similar to the drivers-evergreen-tools
36+
script but it is customized to use the PHP driver's own topology configs for
37+
Mongo Orchestration.
38+
* `start-orchestration.sh`: This is modified to install an older, tagged
39+
version of Mongo Orchestration. This was necessary for a particular platform,
40+
but may be something to look into in the future.
41+
42+
The PHP driver's `config.yml` is a very stripped down and heavily modified copy
43+
of the drivers-evergreen-tools configuration. This file starts by defining
44+
several functions, which consist of one or more commands (types supported by
45+
Evergreen).
46+
47+
In the case of the `bootstrap mongo-orchestration` function, we execute our
48+
modified `run-orchestration.sh` script and assign various environment variables
49+
which have been defined by our matrix configuration (excluding the
50+
`$PROJECT_DIRECTORY`, which is set by Evergreen itself).
51+
52+
In `run tests`, we also depend on environment variables (e.g. `$MONGODB_URI`)
53+
that originates in `run-orchestration.sh` and are unpacked and assigned by the
54+
`expansions.update` command within the `bootstrap mongo-orchestration` function.
55+
Since Evergreen functions do not return values, assigning environment variables
56+
is the preferred way to communicate down the line.
57+
58+
The `pre` and `post` block define a sequence of functions to run before and
59+
after each build, respectively.
60+
61+
Build variants are the top-level scope in Evergreen. They consist of a list of
62+
tasks (i.e. a square in Evergreen output) and a matrix. The matrix specification
63+
is the combination of all included axes. For instance, the `tests-php5` matrix
64+
may consist of all OS types with PHP5, MongoDB server version 4.0 (we need not
65+
test all server versions), and lastly one or more specific PHP 5.x versions.
66+
Such a matrix might yield a dozen variants, which will be run for each task in
67+
the build variant configuration. The `display_name` option determines how the
68+
build variant (combination of matrix and all tasks) is labeled in the Evergreen
69+
UI.
70+
71+
The `axes` block defines a list of values for a specific group or ID, which is
72+
used when defining a matrix. For instance, if a matrix includes 4 axes, it will
73+
expand to all possible combinations of values within those axes. Care should be
74+
taken to not create too many redundant combinations when defining matrices.
75+
76+
The `exclude_spec` field within a build variant allows us to exclude one or more
77+
combinations from the generated matrix. We typically use this to exclude an
78+
environment we know is not supported (e.g. MongoDB 3.0 and 3.2 on zSeries).

.evergreen/compile-unix.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
set -o xtrace # Write all commands first to stderr
3+
set -o errexit # Exit the script with error if any of the commands fail
4+
5+
# Supported/used environment variables:
6+
# MARCH Machine Architecture. Defaults to lowercase uname -m
7+
# RELEASE Use the fully qualified release archive
8+
9+
RELEASE=${RELEASE:-no}
10+
11+
12+
# Automatically retrieve the machine architecture, lowercase, unless provided
13+
# as an environment variable (e.g. to force 32bit)
14+
[ -z "$MARCH" ] && MARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
15+
16+
# Get the kernel name, lowercased
17+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
18+
echo "OS: $OS"
19+
20+
# --strip-components is an GNU tar extension. Check if the platform
21+
# (e.g. Solaris) has GNU tar installed as `gtar`, otherwise we assume to be on
22+
# platform that supports it
23+
# command -v returns success error code if found and prints the path to it
24+
if command -v gtar 2>/dev/null; then
25+
TAR=gtar
26+
else
27+
TAR=tar
28+
fi
29+
30+
# Any architecture specific configuration here
31+
case "$MARCH" in
32+
i386)
33+
CFLAGS="$CFLAGS -m32 -march=i386"
34+
;;
35+
x86_64)
36+
CFLAGS="$CFLAGS -m64 -march=x86-64"
37+
;;
38+
ppc64le)
39+
CFLAGS="$CFLAGS -mcpu=power8 -mtune=power8 -mcmodel=medium"
40+
;;
41+
esac
42+
43+
44+
# Operating system specific tweaks
45+
case "$OS" in
46+
darwin)
47+
;;
48+
49+
linux)
50+
# Make linux builds a tad faster by parallelise the build
51+
cpus=$(grep -c '^processor' /proc/cpuinfo)
52+
MAKEFLAGS="-j${cpus}"
53+
;;
54+
55+
sunos)
56+
# Most normal build tools on the Solaris servers lives here
57+
PATH="/opt/mongodbtoolchain/bin:$PATH"
58+
;;
59+
esac
60+
61+
echo "MARCH: $MARCH"
62+
echo "RELEASE: $RELEASE"
63+
echo "OS: $OS"
64+
echo "PHP_VERSION: $PHP_VERSION"
65+
66+
OLD_PATH=$PATH
67+
PATH=/opt/php/${PHP_VERSION}-64bit/bin:$OLD_PATH
68+
69+
#cat `which phpize` | sed 's@/data/mci/.*/src@/opt@' > ./phpize
70+
#chmod +x ./phpize
71+
phpize
72+
./configure --enable-mongodb-developer-flags
73+
make

.evergreen/compile-windows.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
set -o igncr # Ignore CR in this script
3+
set -o xtrace # Write all commands first to stderr
4+
set -o errexit # Exit the script with error if any of the commands fail
5+
6+
# Supported/used environment variables:
7+
# CC Which compiler to use
8+
9+
10+
case "$CC" in
11+
# 64bit specific configuration
12+
*Win64)
13+
;;
14+
# 32bit specific configuration
15+
*)
16+
;;
17+
esac
18+
19+
# Resolve the compiler name to correct MSBuild location
20+
case "$CC" in
21+
"Visual Studio 10 2010")
22+
BUILD="/cygdrive/c/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe"
23+
;;
24+
"Visual Studio 10 2010 Win64")
25+
BUILD="/cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319/MSBuild.exe"
26+
;;
27+
"Visual Studio 12 2013")
28+
BUILD="/cygdrive/c/Program Files (x86)/MSBuild/12.0/Bin/MSBuild.exe"
29+
;;
30+
"Visual Studio 12 2013 Win64")
31+
BUILD="/cygdrive/c/Program Files (x86)/MSBuild/12.0/Bin/MSBuild.exe"
32+
;;
33+
"Visual Studio 14 2015")
34+
BUILD="/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe"
35+
;;
36+
"Visual Studio 14 2015 Win64")
37+
BUILD="/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe"
38+
;;
39+
esac
40+
41+
export PATH=$PATH:`pwd`/tests:`pwd`/Debug:`pwd`/src/libbson/Debug
42+
CMAKE="/cygdrive/c/cmake/bin/cmake"
43+
INSTALL_DIR="C:/install-dir"
44+
45+
46+
"$CMAKE" -G "$CC" "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}" "-DBSON_ROOT_DIR=${INSTALL_DIR}" $CONFIGURE_FLAGS
47+
"$BUILD" /m ALL_BUILD.vcxproj
48+
"$BUILD" /m INSTALL.vcxproj
49+

.evergreen/compile.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
set -o xtrace # Write all commands first to stderr
3+
set -o errexit # Exit the script with error if any of the commands fail
4+
5+
6+
DIR=$(dirname $0)
7+
8+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
9+
BUILDTOOL=${BUILDTOOL:-autotools}
10+
11+
case "$OS" in
12+
cygwin*)
13+
sh $DIR/compile-windows.sh
14+
;;
15+
16+
*)
17+
# If compiling using multiple different build tools or variants
18+
# that require wildly different scripting,
19+
# this would be a good place to call the different scripts
20+
case "$BUILDTOOL" in
21+
cmake)
22+
sh $DIR/compile-unix-cmake.sh
23+
;;
24+
autotools)
25+
sh $DIR/compile-unix.sh
26+
;;
27+
esac
28+
;;
29+
esac
30+

0 commit comments

Comments
 (0)