@@ -26,6 +26,7 @@ async function parseArguments() {
26
26
'no-macos-universal' : { type : 'boolean' , default : false } ,
27
27
clean : { short : 'c' , type : 'boolean' , default : false } ,
28
28
build : { short : 'b' , type : 'boolean' , default : false } ,
29
+ dynamic : { type : 'boolean' , default : false } ,
29
30
fastDownload : { type : 'boolean' , default : false } , // Potentially incorrect download, only for the brave and impatient
30
31
help : { short : 'h' , type : 'boolean' , default : false }
31
32
} ;
@@ -48,6 +49,7 @@ async function parseArguments() {
48
49
fastDownload : args . values . fastDownload ,
49
50
clean : args . values . clean ,
50
51
build : args . values . build ,
52
+ dynamic : args . values . dynamic ,
51
53
noMacosUniversal : args . values [ 'no-macos-universal' ] ,
52
54
pkg
53
55
} ;
@@ -237,7 +239,7 @@ async function main() {
237
239
238
240
const nodeDepsDir = resolveRoot ( 'deps' ) ;
239
241
240
- if ( args . build ) {
242
+ if ( args . build && ! args . dynamic ) {
241
243
const libmongocryptCloneDir = resolveRoot ( '_libmongocrypt' ) ;
242
244
243
245
const currentLibMongoCryptBranch = await fs
@@ -257,7 +259,7 @@ async function main() {
257
259
if ( args . clean || ! isBuilt ) {
258
260
await buildLibMongoCrypt ( libmongocryptCloneDir , nodeDepsDir ) ;
259
261
}
260
- } else {
262
+ } else if ( ! args . dynamic ) {
261
263
// Download
262
264
await downloadLibMongoCrypt ( nodeDepsDir , args ) ;
263
265
}
@@ -269,10 +271,17 @@ async function main() {
269
271
await run ( 'npm' , [ 'install' , '--ignore-scripts' ] ) ;
270
272
// The prebuild command will make both a .node file in `./build` (local and CI testing will run on current code)
271
273
// it will also produce `./prebuilds/mongodb-client-encryption-vVERSION-napi-vNAPI_VERSION-OS-ARCH.tar.gz`.
272
- const prebuildOptions =
273
- process . platform === 'darwin' && args . noMacosUniversal
274
- ? { env : { ...process . env , GYP_DEFINES : 'no_macos_universal=true' } }
275
- : undefined ;
274
+ let prebuildOptions ;
275
+ if ( process . platform === 'darwin' && args . noMacosUniversal ) {
276
+ prebuildOptions ??= { env : { ...process . env } } ;
277
+ prebuildOptions . env . GYP_DEFINES = ( prebuildOptions . env . GYP_DEFINES ?? '' ) + 'no_macos_universal=true '
278
+ }
279
+
280
+ if ( args . dynamic ) {
281
+ prebuildOptions ??= { env : { ...process . env } }
282
+ prebuildOptions . env . GYP_DEFINES = ( prebuildOptions . env . GYP_DEFINES ?? '' ) + 'build_type=dynamic '
283
+ }
284
+
276
285
await run ( 'npm' , [ 'run' , 'prebuild' ] , prebuildOptions ) ;
277
286
// Compile Typescript
278
287
await run ( 'npm' , [ 'run' , 'prepare' ] ) ;
0 commit comments