@@ -132,26 +132,30 @@ const config = {
132
132
target : [
133
133
{
134
134
target : 'nsis' ,
135
- arch : [ 'x64' ] ,
135
+ arch : getWindowsTargetArch ( ) ,
136
136
} ,
137
137
] ,
138
- artifactName : 'MullvadVPN-${version}.${ext}' ,
138
+ artifactName : 'MullvadVPN-${version}_${arch} .${ext}' ,
139
139
publisherName : 'Mullvad VPN AB' ,
140
140
extraResources : [
141
- { from : distAssets ( 'mullvad.exe' ) , to : '.' } ,
142
- { from : distAssets ( 'mullvad-problem-report.exe' ) , to : '.' } ,
143
- { from : distAssets ( 'mullvad-daemon.exe' ) , to : '.' } ,
144
- { from : distAssets ( 'talpid_openvpn_plugin.dll' ) , to : '.' } ,
141
+ { from : distAssets ( path . join ( getWindowsDistSubdir ( ) , 'mullvad.exe' ) ) , to : '.' } ,
142
+ { from : distAssets ( path . join ( getWindowsDistSubdir ( ) , 'mullvad-problem-report.exe' ) ) , to : '.' } ,
143
+ { from : distAssets ( path . join ( getWindowsDistSubdir ( ) , 'mullvad-daemon.exe' ) ) , to : '.' } ,
144
+ { from : distAssets ( path . join ( getWindowsDistSubdir ( ) , 'talpid_openvpn_plugin.dll' ) ) , to : '.' } ,
145
145
{
146
- from : root ( path . join ( 'windows' , 'winfw' , 'bin' , 'x64 -${env.CPP_BUILD_MODE}', 'winfw.dll' ) ) ,
146
+ from : root ( path . join ( 'windows' , 'winfw' , 'bin' , getWindowsTargetArch ( ) + ' -${env.CPP_BUILD_MODE}', 'winfw.dll' ) ) ,
147
147
to : '.' ,
148
148
} ,
149
+ // TODO: OpenVPN does not have an ARM64 build yet.
149
150
{ from : distAssets ( 'binaries/x86_64-pc-windows-msvc/openvpn.exe' ) , to : '.' } ,
150
- { from : distAssets ( 'binaries/x86_64-pc-windows-msvc/apisocks5.exe' ) , to : '.' } ,
151
- { from : distAssets ( 'binaries/x86_64-pc-windows-msvc/wintun/wintun.dll' ) , to : '.' } ,
152
- { from : distAssets ( 'binaries/x86_64-pc-windows-msvc/split-tunnel/mullvad-split-tunnel.sys' ) , to : '.' } ,
151
+ { from : distAssets ( path . join ( 'binaries' , getWindowsTargetSubdir ( ) , 'apisocks5.exe' ) ) , to : '.' } ,
152
+ { from : distAssets ( path . join ( 'binaries' , getWindowsTargetSubdir ( ) , 'wintun/wintun.dll' ) ) , to : '.' } ,
153
+ {
154
+ from : distAssets ( path . join ( 'binaries' , getWindowsTargetSubdir ( ) , 'split-tunnel/mullvad-split-tunnel.sys' ) ) ,
155
+ to : '.'
156
+ } ,
153
157
{
154
- from : distAssets ( 'binaries/x86_64-pc-windows-msvc/ wireguard-nt/mullvad-wireguard.dll' ) ,
158
+ from : distAssets ( path . join ( 'binaries' , getWindowsTargetSubdir ( ) , ' wireguard-nt/mullvad-wireguard.dll') ) ,
155
159
to : '.' ,
156
160
} ,
157
161
{ from : distAssets ( 'maybenot_machines' ) , to : '.' } ,
@@ -250,6 +254,19 @@ function packWin() {
250
254
asarUnpack : [ 'build/assets/images/menubar-icons/win32/lock-*.ico' ] ,
251
255
beforeBuild : ( options ) => {
252
256
process . env . CPP_BUILD_MODE = release ? 'Release' : 'Debug' ;
257
+ process . env . CPP_BUILD_TARGET = options . arch ;
258
+ switch ( options . arch ) {
259
+ case 'x64' :
260
+ process . env . TARGET_TRIPLE = 'x86_64-pc-windows-msvc' ;
261
+ process . env . SETUP_SUBDIR = '.' ;
262
+ break ;
263
+ case 'arm64' :
264
+ process . env . TARGET_TRIPLE = 'aarch64-pc-windows-msvc' ;
265
+ process . env . SETUP_SUBDIR = 'aarch64-pc-windows-msvc' ;
266
+ break ;
267
+ default :
268
+ throw new Error ( `Invalid or unknown target (only one may be specified)` ) ;
269
+ }
253
270
return true ;
254
271
} ,
255
272
afterAllArtifactBuild : ( buildResult ) => {
@@ -392,8 +409,38 @@ function root(relativePath) {
392
409
return path . join ( path . resolve ( __dirname , '../../' ) , relativePath ) ;
393
410
}
394
411
412
+ function getWindowsDistSubdir ( ) {
413
+ if ( targets === 'aarch64-pc-windows-msvc' ) {
414
+ return targets ;
415
+ } else {
416
+ return '' ;
417
+ }
418
+ }
419
+
420
+ function getWindowsTargetArch ( ) {
421
+ if ( targets && process . platform === 'win32' ) {
422
+ if ( targets === 'aarch64-pc-windows-msvc' ) {
423
+ return 'arm64' ;
424
+ }
425
+ throw new Error ( `Invalid or unknown target (only one may be specified)` ) ;
426
+ }
427
+ // Use host architecture (we assume this is x64 since building on Arm64 isn't supported).
428
+ return 'x64' ;
429
+ }
430
+
431
+ function getWindowsTargetSubdir ( ) {
432
+ if ( targets && process . platform === 'win32' ) {
433
+ if ( targets === 'aarch64-pc-windows-msvc' ) {
434
+ return targets ;
435
+ }
436
+ throw new Error ( `Invalid or unknown target (only one may be specified)` ) ;
437
+ }
438
+ // Use host architecture (we assume this is x64 since building on Arm64 isn't supported).
439
+ return 'x86_64-pc-windows-msvc' ;
440
+ }
441
+
395
442
function getLinuxTargetArch ( ) {
396
- if ( targets ) {
443
+ if ( targets && process . platform === 'linux' ) {
397
444
if ( targets === 'aarch64-unknown-linux-gnu' ) {
398
445
return 'arm64' ;
399
446
}
@@ -404,7 +451,7 @@ function getLinuxTargetArch() {
404
451
}
405
452
406
453
function getLinuxTargetSubdir ( ) {
407
- if ( targets ) {
454
+ if ( targets && process . platform === 'linux' ) {
408
455
if ( targets === 'aarch64-unknown-linux-gnu' ) {
409
456
return targets ;
410
457
}
0 commit comments