@@ -23,7 +23,7 @@ async function parseArguments() {
23
23
const options = {
24
24
gitURL : { short : 'u' , type : 'string' , default : 'https://github.com/mongodb/libmongocrypt.git' } ,
25
25
libVersion : { short : 'l' , type : 'string' , default : pkg [ 'mongodb:libmongocrypt' ] } ,
26
- 'allow-only-x64-darwin ' : { type : 'boolean' , default : false } ,
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
29
fastDownload : { type : 'boolean' , default : false } , // Potentially incorrect download, only for the brave and impatient
@@ -48,7 +48,7 @@ async function parseArguments() {
48
48
fastDownload : args . values . fastDownload ,
49
49
clean : args . values . clean ,
50
50
build : args . values . build ,
51
- allowOnlyX64Darwin : args . values [ 'allow-only-x64-darwin ' ] ,
51
+ noMacosUniversal : args . values [ 'no-macos-universal ' ] ,
52
52
pkg
53
53
} ;
54
54
}
@@ -269,31 +269,19 @@ async function main() {
269
269
await run ( 'npm' , [ 'install' , '--ignore-scripts' ] ) ;
270
270
// The prebuild command will make both a .node file in `./build` (local and CI testing will run on current code)
271
271
// it will also produce `./prebuilds/mongodb-client-encryption-vVERSION-napi-vNAPI_VERSION-OS-ARCH.tar.gz`.
272
- await run ( 'npm' , [ 'run' , 'prebuild' ] ) ;
272
+ const prebuildOptions =
273
+ process . platform === 'darwin' && args . noMacosUniversal
274
+ ? { env : { ...process . env , GYP_DEFINES : 'no_macos_universal=true' } }
275
+ : undefined ;
276
+ await run ( 'npm' , [ 'run' , 'prebuild' ] , prebuildOptions ) ;
273
277
// Compile Typescript
274
278
await run ( 'npm' , [ 'run' , 'prepare' ] ) ;
275
279
276
- if ( process . platform === 'darwin' ) {
280
+ if ( process . platform === 'darwin' && ! args . noMacosUniversal ) {
277
281
// The "arm64" build is actually a universal binary
278
- try {
279
- await fs . copyFile (
280
- resolveRoot (
281
- 'prebuilds' ,
282
- `mongodb-client-encryption-v${ pkg . version } -napi-v4-darwin-arm64.tar.gz`
283
- ) ,
284
- resolveRoot (
285
- 'prebuilds' ,
286
- `mongodb-client-encryption-v${ pkg . version } -napi-v4-darwin-x64.tar.gz`
287
- )
288
- ) ;
289
- } catch {
290
- if ( process . arch === 'x64' ) {
291
- // The user of this script is building on an x64/intel/amd64 darwin which cannot build a universal bundle
292
- // By default we exit with failure because we do not want to release an intel only build
293
- console . error ( 'Intel Darwin cannot build a universal bundle' ) ;
294
- process . exitCode = args . allowOnlyX64Darwin ? 0 : 1 ;
295
- }
296
- }
282
+ const armTar = `mongodb-client-encryption-v${ pkg . version } -napi-v4-darwin-arm64.tar.gz` ;
283
+ const x64Tar = `mongodb-client-encryption-v${ pkg . version } -napi-v4-darwin-x64.tar.gz` ;
284
+ await fs . copyFile ( resolveRoot ( 'prebuilds' , armTar ) , resolveRoot ( 'prebuilds' , x64Tar ) ) ;
297
285
}
298
286
}
299
287
0 commit comments