Skip to content

Commit c4bdb65

Browse files
committed
update darwin build script
1 parent b893fbe commit c4bdb65

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

packages/sodium_libs/tool/libsodium/platforms/darwin_target.dart

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,54 @@ class DarwinTarget extends PluginTarget {
3131
static const ios_arm64 = DarwinTarget(
3232
platform: DarwinPlatform.ios,
3333
architecture: 'arm64',
34-
buildTarget: 'aarch64-apple-darwin23',
34+
buildTarget: 'aarch64-apple-darwin',
35+
hostTarget: 'aarch64-apple-darwin23',
3536
);
3637
// ignore: constant_identifier_names
3738
static const ios_arm64e = DarwinTarget(
3839
platform: DarwinPlatform.ios,
3940
architecture: 'arm64e',
40-
buildTarget: 'aarch64-apple-darwin23',
41+
buildTarget: 'aarch64-apple-darwin',
42+
hostTarget: 'aarch64-apple-darwin23',
4143
);
4244
// ignore: constant_identifier_names
4345
static const ios_simulator_arm64 = DarwinTarget(
4446
platform: DarwinPlatform.ios_simulator,
4547
architecture: 'arm64',
46-
buildTarget: 'aarch64-apple-darwin23',
48+
buildTarget: 'aarch64-apple-darwin',
49+
hostTarget: 'aarch64-apple-darwin23',
4750
);
4851
// ignore: constant_identifier_names
4952
static const ios_simulator_arm64e = DarwinTarget(
5053
platform: DarwinPlatform.ios_simulator,
5154
architecture: 'arm64e',
52-
buildTarget: 'aarch64-apple-darwin23',
55+
buildTarget: 'aarch64-apple-darwin',
56+
hostTarget: 'aarch64-apple-darwin23',
5357
);
5458
// ignore: constant_identifier_names
5559
static const ios_simulator_x86_64 = DarwinTarget(
5660
platform: DarwinPlatform.ios_simulator,
5761
architecture: 'x86_64',
58-
buildTarget: 'x86_64-apple-darwin23',
62+
buildTarget: 'aarch64-apple-darwin',
63+
hostTarget: 'x86_64-apple-darwin23',
5964
);
6065
// ignore: constant_identifier_names
6166
static const macos_arm64 = DarwinTarget(
6267
platform: DarwinPlatform.macos,
6368
architecture: 'arm64',
64-
buildTarget: 'aarch64-apple-darwin23',
69+
hostTarget: 'aarch64-apple-darwin23',
6570
);
6671
// ignore: constant_identifier_names
6772
static const macos_arm64e = DarwinTarget(
6873
platform: DarwinPlatform.macos,
6974
architecture: 'arm64e',
70-
buildTarget: 'aarch64-apple-darwin23',
75+
hostTarget: 'aarch64-apple-darwin23',
7176
);
7277
// ignore: constant_identifier_names
7378
static const macos_x86_64 = DarwinTarget(
7479
platform: DarwinPlatform.macos,
7580
architecture: 'x86_64',
76-
buildTarget: 'x86_64-apple-darwin23',
81+
hostTarget: 'x86_64-apple-darwin23',
7782
);
7883
static const iosValues = [
7984
ios_arm64,
@@ -85,11 +90,12 @@ class DarwinTarget extends PluginTarget {
8590
static const macosValues = [macos_arm64, macos_arm64e, macos_x86_64];
8691
static const values = [...iosValues, ...macosValues];
8792

93+
// Check here: https://github.com/jedisct1/libsodium/blob/master/dist-build/apple-xcframework.sh
8894
// get hash: curl -sSL https://raw.githubusercontent.com/jedisct1/libsodium/refs/heads/master/dist-build/apple-xcframework.sh | b2sum
8995
// last update: 2024-12-31
9096
static const _appleXcframeworkScriptHash =
9197
// ignore: lines_longer_than_80_chars
92-
'5aa4efd30f914f85da881e4cb4eeeeb8cc65864c0ecfaba854e96326e790e6151ee53f962c25532548c1f2ecbc2d9c514a4238750e74ee57c5eaee0e603bbe38';
98+
'df5a8478558938660f926d25e12066e6e8afe7cebd234f334b989c3bdf17fbb1c0d2fa8be924757753f49767152e53cc2f13aa00b2032cae5ffa2f3d09d9c4e6';
9399

94100
static final _frameworkInfoPlist =
95101
'''
@@ -123,12 +129,14 @@ class DarwinTarget extends PluginTarget {
123129

124130
final DarwinPlatform platform;
125131
final String architecture;
126-
final String buildTarget;
132+
final String? buildTarget;
133+
final String hostTarget;
127134

128135
const DarwinTarget({
129136
required this.platform,
130137
required this.architecture,
131-
required this.buildTarget,
138+
this.buildTarget,
139+
required this.hostTarget,
132140
});
133141

134142
@override
@@ -151,7 +159,11 @@ class DarwinTarget extends PluginTarget {
151159

152160
await Github.exec(
153161
'./configure',
154-
['--host=$buildTarget', '--prefix=${prefixDir.path}'],
162+
[
163+
if (buildTarget != null) '--build=$buildTarget',
164+
'--host=$hostTarget',
165+
'--prefix=${prefixDir.path}',
166+
],
155167
workingDirectory: buildDir,
156168
environment: environment,
157169
);

0 commit comments

Comments
 (0)