react-native-zano 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.3 (2025-05-05)
6
+
7
+ - fixed: Shield symbols for iOS builds using partial linking and symbol encapsulation.
8
+
5
9
  ## 0.1.2 (2025-04-29)
6
10
 
7
11
  - fixed: Republish with missing .so files
package/README.md CHANGED
@@ -54,3 +54,9 @@ This script does the following tasks:
54
54
  - Compile an iOS universal static library and put it into an XCFramework.
55
55
 
56
56
  The `update-sources` script is also the place to make edits when upgrading any of the third-party dependencies. The react-native-zano repo doesn't include these third-party C++ sources, since they are enormous.
57
+
58
+ For this to work, you need:
59
+
60
+ - A recent Android SDK, installed at `$ANDROID_HOME`
61
+ - Xcode command-line tools
62
+ - `llvm-objcopy`, provided by `brew install llvm`
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libzano-module.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_x86_64-simulator</string>
11
+ <string>ios-arm64</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libzano-module.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
- <string>x86_64</string>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>libzano-module.a</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>libzano-module.a</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -32,6 +32,7 @@ const os_1 = require("os");
32
32
  const path_1 = require("path");
33
33
  const android_tools_1 = require("./utils/android-tools");
34
34
  const common_1 = require("./utils/common");
35
+ const ios_tools_1 = require("./utils/ios-tools");
35
36
  exports.srcPath = (0, path_1.join)(__dirname, '../src');
36
37
  async function main() {
37
38
  await (0, promises_1.mkdir)(common_1.tmpPath, { recursive: true });
@@ -50,6 +51,11 @@ async function main() {
50
51
  async function downloadSources() {
51
52
  await (0, common_1.getRepo)('zano_native_lib', 'https://github.com/hyle-team/zano_native_lib.git', '391a965d1d609f917cc97908b9d354a7f54e0258');
52
53
  await (0, common_1.getRepo)('Boost-for-Android', 'https://github.com/moritz-wundke/Boost-for-Android.git', '51924ec5533a4fefb5edf99feaeded794c06a4fb');
54
+ // Rename the compress function in RIPEMD160.c,
55
+ // since that conflicts with Zlib:
56
+ const mdPath = (0, path_1.join)(common_1.tmpPath, 'zano_native_lib/Zano/src/crypto/RIPEMD160.h');
57
+ const mdText = await (0, promises_1.readFile)(mdPath, 'utf8');
58
+ await (0, promises_1.writeFile)(mdPath, '#define compress md_compress\n' + mdText);
53
59
  }
54
60
  // Compiler options:
55
61
  const includePaths = ['zano_native_lib/Zano/src/wallet'];
@@ -86,8 +92,8 @@ const iosPlatforms = [
86
92
  // { sdk: 'iphoneos', arch: 'armv7s' },
87
93
  ];
88
94
  const iosSdkTriples = {
89
- iphoneos: '%arch%-apple-ios9.0',
90
- iphonesimulator: '%arch%-apple-ios9.0-simulator'
95
+ iphoneos: '%arch%-apple-ios13.0',
96
+ iphonesimulator: '%arch%-apple-ios13.0-simulator'
91
97
  };
92
98
  /**
93
99
  * We compile our own Boost for Android,
@@ -183,6 +189,8 @@ async function buildIosZano(platform) {
183
189
  const ar = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'ar']);
184
190
  const cc = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'clang']);
185
191
  const cxx = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'clang++']);
192
+ const ld = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'ld']);
193
+ const objcopy = await (0, ios_tools_1.getObjcopyPath)();
186
194
  const sdkFlags = [
187
195
  '-arch',
188
196
  arch,
@@ -193,7 +201,7 @@ async function buildIosZano(platform) {
193
201
  ];
194
202
  const cflags = [
195
203
  ...includePaths.map(path => `-I${(0, path_1.join)(common_1.tmpPath, path)}`),
196
- '-miphoneos-version-min=9.0',
204
+ '-miphoneos-version-min=13.0',
197
205
  '-O2',
198
206
  '-Werror=partial-availability'
199
207
  ];
@@ -247,30 +255,31 @@ async function buildIosZano(platform) {
247
255
  '--target',
248
256
  'install'
249
257
  ]);
250
- // Explode Zano archives and gather the objects:
251
- async function unpackLib(libPath, name) {
252
- console.log(`Unpacking lib${name}.a`);
253
- const outPath = (0, path_1.join)(working, `unpack/${name}`);
254
- await (0, promises_1.rm)(outPath, { recursive: true, force: true });
255
- await (0, promises_1.mkdir)(outPath, { recursive: true });
256
- await (0, common_1.loudExec)('ar', ['-x', libPath], { cwd: outPath });
257
- // Add object files to the list:
258
- for (const file of await (0, promises_1.readdir)(outPath)) {
259
- if (file.endsWith('.o'))
260
- objects.push((0, path_1.join)(outPath, file));
261
- }
262
- }
263
- for (const lib of zanoLibs) {
264
- await unpackLib((0, path_1.join)(working, `lib/lib${lib}.a`), lib);
265
- }
266
- for (const lib of boostLibs) {
267
- await unpackLib((0, path_1.join)(common_1.tmpPath, `zano_native_lib/_libs_ios/boost/stage/${sdk}/${arch}/libboost_${lib}.a`), `boost_${lib}`);
268
- }
258
+ // Link everything together into a single giant .o file:
259
+ console.log(`Linking zano-module.o for ${sdk} ${arch}`);
260
+ const objectPath = (0, path_1.join)(working, 'zano-module.o');
261
+ await (0, common_1.loudExec)(ld, [
262
+ '-r',
263
+ '-o',
264
+ objectPath,
265
+ ...objects,
266
+ ...boostLibs.map(name => (0, path_1.join)(boostPath, `stage/${sdk}/${arch}/libboost_${name}.a`)),
267
+ ...zanoLibs.map(name => (0, path_1.join)(working, `lib/lib${name}.a`))
268
+ ]);
269
+ // Localize all symbols except the ones we really want,
270
+ // hiding them from future linking steps:
271
+ await (0, common_1.loudExec)(objcopy, [
272
+ objectPath,
273
+ '-w',
274
+ '-L*',
275
+ '-L!_zanoMethods',
276
+ '-L!_zanoMethodCount'
277
+ ]);
269
278
  // Generate a static library:
270
279
  console.log(`Building static library for ${sdk}-${arch}...`);
271
280
  const library = (0, path_1.join)(working, `libzano-module.a`);
272
281
  await (0, promises_1.rm)(library, { force: true });
273
- await (0, common_1.loudExec)(ar, ['rcs', library, ...objects]);
282
+ await (0, common_1.loudExec)(ar, ['rcs', library, objectPath]);
274
283
  }
275
284
  /**
276
285
  * Creates a unified xcframework file out of the per-platform
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Finds llvm-objcopy in Homebrew.
3
+ *
4
+ * Homebrew doesn't symlink LLVM into the normal location,
5
+ * to avoid conflicting with Xcode's built-in tools.
6
+ * We can get around this by looking in the right places.
7
+ */
8
+ export declare function getObjcopyPath(): Promise<string>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getObjcopyPath = void 0;
4
+ const common_1 = require("./common");
5
+ /**
6
+ * Finds llvm-objcopy in Homebrew.
7
+ *
8
+ * Homebrew doesn't symlink LLVM into the normal location,
9
+ * to avoid conflicting with Xcode's built-in tools.
10
+ * We can get around this by looking in the right places.
11
+ */
12
+ async function getObjcopyPath() {
13
+ const whichPath = await (0, common_1.quietExec)('which', ['llvm-objcopy']).catch(() => { });
14
+ if (whichPath != null)
15
+ return whichPath;
16
+ const paths = [
17
+ '/opt/homebrew/opt/llvm/bin/llvm-objcopy',
18
+ '/usr/local/opt/llvm/bin/llvm-objcopy' // for Intel Macs
19
+ ];
20
+ for (const path of paths) {
21
+ if (await (0, common_1.fileExists)(path))
22
+ return path;
23
+ }
24
+ throw new Error('Please install `llvm-objcopy` using `brew install llvm`.');
25
+ }
26
+ exports.getObjcopyPath = getObjcopyPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-zano",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "React Native bindings for the Zano blockchain",
5
5
  "homepage": "https://github.com/EdgeApp/react-native-zano",
6
6
  "repository": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "license": "BSD-3-Clause",
11
11
  "author": "Airbitz, Inc.",
12
- "main": "lib/index.js",
12
+ "main": "lib/src/index.js",
13
13
  "types": "lib/src/index.d.ts",
14
14
  "files": [
15
15
  "/android/build.gradle",
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.authors = package['author']
12
12
 
13
- s.platform = :ios, "9.0"
13
+ s.platform = :ios, "13.0"
14
14
  s.requires_arc = true
15
15
  s.source = {
16
16
  :git => "https://github.com/EdgeApp/react-native-zano.git",