Skip to content

Commit 09018b8

Browse files
[CDRIVER-5961] Renaming of binaries, packages, and install paths (#1965)
Resolves CDRIVER-5961 and CDRIVER-2086 * Add CTest cases to test pkg-config importing These use the TestProject module to define test cases that run a CMake build, but that CMake project uses `pkg-config` to import the libraries rather than `find_package`. This allows us to test `pkg-config` while relying on CMake to do the heavy lifting around compiler detection and search path handling. * Set CMAKE_PREFIX_PATH in TestProject When building a TestProject, we want to set CMAKE_PREFIX_PATH to point to the directory that received the parent project installation. * Change the link line for pkg-config static libs Previously, pkg-config generated a `-l` with a library stem, and it would only coincidentally name a static library with a `.a` suffix. Instead, for static libraries, specify the path to the actual static library archive file. Only rely on `-l` searching for shared libraries. * Rename pkg-config files * Update file names and install paths This change is BREAKING and changes the names of generated files for libbson and libmongoc. * Headers are installed in a directory qualified by the project version. * The generated dynamic library has a property version suffix now (instead of 0.0.0). * We set the SOVERSION property to generate a new SONAME for the emitted bson library. * The bson-1.0 and mongoc-1.0 CMake packages are removed. * The pkg-config files are now named `bson1` / `bson1-static` and `mongoc1` / `mongoc1-static`. * Both the static and dynamic library file stems are now `libbson1` / `libmongoc1` (no `-static` suffix). * The project now imports the system libbson using the name "bson" instead of `bson-1.0` * Remove fragile installed-files tests, revise some for new filenames * Give DLL implibs a different file extension on Windows * Remove install code for Apple frameworks and modulemaps * Remove libmongoc-ssl .pc files * Add NEWS entries regarding package renames * Qualify installation of docs and licenses * Major-version qualify the `mongoc-stat` tool
1 parent d33d253 commit 09018b8

39 files changed

+526
-903
lines changed

.evergreen/scripts/check-installed-files-bson.bat

-76
This file was deleted.

.evergreen/scripts/check-installed-files.bat

-66
This file was deleted.

.evergreen/scripts/install-uninstall-check-windows.cmd

+13-34
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set CMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bi
1515
rem Ensure Cygwin executables like sh.exe are not in PATH
1616
set PATH=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin;C:\mongoc;src\libbson;src\libmongoc
1717

18+
set version=1.31.0
19+
set major=1
20+
1821
if "%BSON_ONLY%"=="1" (
1922
set BUILD_DIR=%CD%\build-dir-bson
2023
set INSTALL_DIR=%CD%\install-dir-bson
@@ -120,29 +123,11 @@ echo.%CC%| findstr /I "gcc">Nul && (
120123
)
121124
)
122125

123-
if exist %INSTALL_DIR%\lib\pkgconfig\libbson-1.0.pc (
124-
echo libbson-1.0.pc found!
125-
exit /B 1
126-
) else (
127-
echo libbson-1.0.pc check ok
128-
)
129-
if exist %INSTALL_DIR%\lib\cmake\bson-1.0\bson-1.0-config.cmake (
130-
echo bson-1.0-config.cmake found!
131-
exit /B 1
132-
) else (
133-
echo bson-1.0-config.cmake check ok
134-
)
135-
if exist %INSTALL_DIR%\lib\cmake\bson-1.0\bson-1.0-config-version.cmake (
136-
echo bson-1.0-config-version.cmake found!
126+
if exist %INSTALL_DIR%\lib\pkgconfig\bson%major%.pc (
127+
echo bson%major%.pc found!
137128
exit /B 1
138129
) else (
139-
echo bson-1.0-config-version.cmake check ok
140-
)
141-
if exist %INSTALL_DIR%\lib\cmake\bson-1.0\bson-targets.cmake (
142-
echo bson-targets.cmake found!
143-
exit /B 1
144-
) else (
145-
echo bson-targets.cmake check ok
130+
echo bson%major%.pc check ok
146131
)
147132
if not exist %INSTALL_DIR%\lib\canary.txt (
148133
echo canary.txt not found!
@@ -157,11 +142,11 @@ if not exist %INSTALL_DIR%\lib (
157142
echo %INSTALL_DIR%\lib check ok
158143
)
159144
if "%BSON_ONLY%" NEQ "1" (
160-
if exist %INSTALL_DIR%\lib\pkgconfig\libmongoc-1.0.pc (
161-
echo libmongoc-1.0.pc found!
145+
if exist %INSTALL_DIR%\lib\pkgconfig\mongoc%major%.pc (
146+
echo mongoc%major%.pc found!
162147
exit /B 1
163148
) else (
164-
echo libmongoc-1.0.pc check ok
149+
echo mongoc%major%.pc check ok
165150
)
166151
if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config.cmake (
167152
echo mongoc-1.0-config.cmake found!
@@ -182,23 +167,17 @@ if "%BSON_ONLY%" NEQ "1" (
182167
echo mongoc-targets.cmake check ok
183168
)
184169
)
185-
if exist %INSTALL_DIR%\include\libbson-1.0\bson\bson.h (
170+
if exist %INSTALL_DIR%\include\bson-%version%\bson\bson.h (
186171
echo bson\bson.h found!
187172
exit /B 1
188173
) else (
189174
echo bson\bson.h check ok
190175
)
191-
if exist %INSTALL_DIR%\include\libbson-1.0\bson.h (
192-
echo bson.h found!
193-
exit /B 1
194-
) else (
195-
echo bson.h check ok
196-
)
197-
if exist %INSTALL_DIR%\include\libbson-1.0 (
198-
echo $INSTALL_DIR\include\libbson-1.0 found!
176+
if exist %INSTALL_DIR%\include\bson-%version% (
177+
echo $INSTALL_DIR\include\bson-%version% found!
199178
exit /B 1
200179
) else (
201-
echo $INSTALL_DIR\include\libbson-1.0 check ok
180+
echo $INSTALL_DIR\include\bson-%version% check ok
202181
)
203182
if "%BSON_ONLY%" NEQ "1" (
204183
if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc\mongoc.h (

.evergreen/scripts/install-uninstall-check.sh

+26-25
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@ CMAKE=$(find_cmake_latest)
1313
. $DIR/check-symlink.sh
1414
SRCROOT=$(pwd)
1515

16+
# The major version of the project. Appears in certain install filenames.
17+
_full_version=$(cat "$DIR/../../VERSION_CURRENT")
18+
version="${_full_version%-*}" # 1.2.3-dev → 1.2.3
19+
major="${version%%.*}" # 1.2.3 → 1
20+
echo "major version: $major"
21+
echo " full version: $version"
22+
1623
# Use ccache if able.
1724
. $DIR/find-ccache.sh
1825
find_ccache_and_export_vars "$(pwd)" || true
1926

2027
SCRATCH_DIR=$(pwd)/.scratch
2128
rm -rf "$SCRATCH_DIR"
2229
mkdir -p "$SCRATCH_DIR"
23-
cp -vr -- "$SRCROOT"/* "$SCRATCH_DIR"
30+
cp -r -- "$SRCROOT"/* "$SCRATCH_DIR"
2431

2532
if [ "$BSON_ONLY" ]; then
2633
BUILD_DIR=$SCRATCH_DIR/build-dir-bson
@@ -58,8 +65,8 @@ if [[ -f $DIR/find-ccache.sh ]]; then
5865
find_ccache_and_export_vars "$SCRATCH_DIR" || true
5966
fi
6067

61-
$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_PREFIX_PATH=$INSTALL_DIR/lib/cmake $BSON_ONLY_OPTION "$SCRATCH_DIR"
62-
$CMAKE --build .
68+
$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DBUILD_TESTING=OFF -DCMAKE_PREFIX_PATH=$INSTALL_DIR/lib/cmake $BSON_ONLY_OPTION "$SCRATCH_DIR"
69+
$CMAKE --build . --parallel
6370
if [ "$DESTDIR" ]; then
6471
DESTDIR=$DESTDIR $CMAKE --build . --target install
6572
else
@@ -93,29 +100,23 @@ $CMAKE --build . --target uninstall
93100

94101
set +o xtrace
95102

96-
if test -f $INSTALL_DIR/lib/pkgconfig/libbson-1.0.pc; then
97-
echo "libbson-1.0.pc found!"
98-
exit 1
99-
else
100-
echo "libbson-1.0.pc check ok"
101-
fi
102-
if test -f $INSTALL_DIR/lib/cmake/bson-1.0/bson-1.0-config.cmake; then
103-
echo "bson-1.0-config.cmake found!"
103+
if test -f $INSTALL_DIR/lib/pkgconfig/bson$major.pc; then
104+
echo "bson$major.pc found!"
104105
exit 1
105106
else
106-
echo "bson-1.0-config.cmake check ok"
107+
echo "bson$major.pc check ok"
107108
fi
108-
if test -f $INSTALL_DIR/lib/cmake/bson-1.0/bson-1.0-config-version.cmake; then
109-
echo "bson-1.0-config-version.cmake found!"
109+
if test -f $INSTALL_DIR/lib/cmake/bson-$version/bsonConfig.cmake; then
110+
echo "bsonConfig.cmake found!"
110111
exit 1
111112
else
112-
echo "bson-1.0-config-version.cmake check ok"
113+
echo "bsonConfig.cmake check ok"
113114
fi
114-
if test -f $INSTALL_DIR/lib/cmake/bson-1.0/bson-targets.cmake; then
115-
echo "bson-targets.cmake found!"
115+
if test -f $INSTALL_DIR/lib/cmake/bson-$version/bsonConfigVersion.cmake; then
116+
echo "bsonConfigVersion.cmake found!"
116117
exit 1
117118
else
118-
echo "bson-targets.cmake check ok"
119+
echo "bsonConfigVersion.cmake check ok"
119120
fi
120121
if test ! -f $INSTALL_DIR/lib/canary.txt; then
121122
echo "canary.txt not found!"
@@ -130,11 +131,11 @@ else
130131
echo "$INSTALL_DIR/lib check ok"
131132
fi
132133
if [ -z "$BSON_ONLY" ]; then
133-
if test -f $INSTALL_DIR/lib/pkgconfig/libmongoc-1.0.pc; then
134-
echo "libmongoc-1.0.pc found!"
134+
if test -f $INSTALL_DIR/lib/pkgconfig/mongoc$major.pc; then
135+
echo "mongoc$major.pc found!"
135136
exit 1
136137
else
137-
echo "libmongoc-1.0.pc check ok"
138+
echo "mongoc$major.pc check ok"
138139
fi
139140
if test -f $INSTALL_DIR/lib/cmake/mongoc-1.0/mongoc-1.0-config.cmake; then
140141
echo "mongoc-1.0-config.cmake found!"
@@ -155,17 +156,17 @@ if [ -z "$BSON_ONLY" ]; then
155156
echo "mongoc-targets.cmake check ok"
156157
fi
157158
fi
158-
if test -f $INSTALL_DIR/include/libbson-1.0/bson/bson.h; then
159+
if test -f $INSTALL_DIR/include/bson-$version/bson/bson.h; then
159160
echo "bson/bson.h found!"
160161
exit 1
161162
else
162163
echo "bson/bson.h check ok"
163164
fi
164-
if test -d $INSTALL_DIR/include/libbson-1.0; then
165-
echo "$INSTALL_DIR/include/libbson-1.0 found!"
165+
if test -d $INSTALL_DIR/include/bson-$version; then
166+
echo "$INSTALL_DIR/include/bson-$version found!"
166167
exit 1
167168
else
168-
echo "$INSTALL_DIR/include/libbson-1.0 check ok"
169+
echo "$INSTALL_DIR/include/bson-$version check ok"
169170
fi
170171
if [ -z "$BSON_ONLY" ]; then
171172
if test -f $INSTALL_DIR/include/libmongoc-1.0/mongoc/mongoc.h; then

0 commit comments

Comments
 (0)