react-native-enriched-markdown 0.7.2 → 0.7.4
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.
|
@@ -29,6 +29,17 @@ Pod::Spec.new do |s|
|
|
|
29
29
|
# When math is enabled, consumers must use `use_frameworks! :linkage => :dynamic` (required for SPM interop).
|
|
30
30
|
enable_math = ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] != '0'
|
|
31
31
|
|
|
32
|
+
# RaTeX is wired in through React Native's `spm_dependency` helper (SPM interop).
|
|
33
|
+
# On React Native versions that don't provide it, disable math entirely so the
|
|
34
|
+
# RaTeX-importing sources under ios/math are excluded from the build. Otherwise
|
|
35
|
+
# the failure would just move from `pod install` to a build-time
|
|
36
|
+
# "missing module 'RaTeX'" error.
|
|
37
|
+
if enable_math && !defined?(spm_dependency)
|
|
38
|
+
Pod::UI.warn '[ReactNativeEnrichedMarkdown] `spm_dependency` is unavailable in this ' \
|
|
39
|
+
'React Native version; disabling LaTeX math (RaTeX). Upgrade React Native to enable it.'
|
|
40
|
+
enable_math = false
|
|
41
|
+
end
|
|
42
|
+
|
|
32
43
|
unless enable_math
|
|
33
44
|
s.exclude_files = "ios/math/**/*.swift"
|
|
34
45
|
end
|
|
@@ -36,22 +47,39 @@ Pod::Spec.new do |s|
|
|
|
36
47
|
preprocessor_defs = '$(inherited) MD4C_USE_UTF8=1'
|
|
37
48
|
if enable_math
|
|
38
49
|
preprocessor_defs += ' ENRICHED_MARKDOWN_MATH=1'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
end
|
|
50
|
+
spm_dependency(s,
|
|
51
|
+
url: 'https://github.com/erweixin/RaTeX.git',
|
|
52
|
+
requirement: {kind: 'upToNextMajorVersion', minimumVersion: '0.1.12'},
|
|
53
|
+
products: ['RaTeX']
|
|
54
|
+
)
|
|
46
55
|
end
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
pod_xcconfig = {
|
|
49
58
|
'HEADER_SEARCH_PATHS' => "\"#{cpp_root}/md4c\" \"#{cpp_root}/parser\" \"$(PODS_TARGET_SRCROOT)/ios/internals\" \"$(PODS_TARGET_SRCROOT)/ios/input/internals\"",
|
|
50
59
|
'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_defs,
|
|
51
60
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
52
61
|
'DEFINES_MODULE' => 'YES'
|
|
53
62
|
}
|
|
54
63
|
|
|
64
|
+
# Detect Apple Silicon on the host running `pod install`. `sysctl hw.optional.arm64`
|
|
65
|
+
# reports the real hardware even under a Rosetta-translated Ruby, unlike `uname -m`.
|
|
66
|
+
apple_silicon = `sysctl -n hw.optional.arm64 2>/dev/null`.strip == '1'
|
|
67
|
+
|
|
68
|
+
if enable_math && apple_silicon
|
|
69
|
+
# RaTeX's Swift wrapper is compiled from SPM source, so its RaTeX.swiftmodule
|
|
70
|
+
# is emitted only for the arch(es) the build requests. Under ONLY_ACTIVE_ARCH
|
|
71
|
+
# on Apple Silicon that is arm64 only, but universal simulator builds (archive,
|
|
72
|
+
# "Any iOS Simulator Device", Release) also compile this pod for x86_64 and then
|
|
73
|
+
# fail with "could not find module 'RaTeX' for target 'x86_64-apple-ios-simulator'".
|
|
74
|
+
# Excluding x86_64 for the simulator keeps the pod and the app target arch sets in
|
|
75
|
+
# sync. Guarded to Apple Silicon so Intel Macs (which build x86_64 simulator slices)
|
|
76
|
+
# are unaffected; `$(inherited)` preserves exclusions from the user project / other pods.
|
|
77
|
+
pod_xcconfig['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) x86_64'
|
|
78
|
+
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => '$(inherited) x86_64' }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
s.pod_target_xcconfig = pod_xcconfig
|
|
82
|
+
|
|
55
83
|
if enable_math
|
|
56
84
|
# React Native's spm_dependency generates a module.modulemap at
|
|
57
85
|
# ${BUILT_PRODUCTS_DIR}/include/ that re-declares RaTeXFFI, but the RaTeX
|
|
@@ -68,6 +96,20 @@ Pod::Spec.new do |s|
|
|
|
68
96
|
sed -i '' -E '/^(framework )?module RaTeXFFI /,/^\}/d' "$MODULEMAP"
|
|
69
97
|
SCRIPT
|
|
70
98
|
execution_position: :before_compile
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Dedupe RaTeX XCFramework Signature',
|
|
102
|
+
script: <<~'SCRIPT',
|
|
103
|
+
# Xcode 26 generates a .signature file for each signed XCFramework.
|
|
104
|
+
# When the RaTeX XCFramework is consumed via spm_dependency inside a
|
|
105
|
+
# CocoaPods target, both the SPM product and the pod target produce a
|
|
106
|
+
# copy. During archive assembly Xcode copies all signatures into a flat
|
|
107
|
+
# Signatures/ directory, and the second copy collides with the first.
|
|
108
|
+
# Removing the pod-target copy prevents the collision. This is a no-op
|
|
109
|
+
# on older Xcode versions or simulator builds where the file is absent.
|
|
110
|
+
rm -f "${CONFIGURATION_BUILD_DIR}/RaTeX.xcframework-ios.signature"
|
|
111
|
+
SCRIPT
|
|
112
|
+
execution_position: :after_compile
|
|
71
113
|
}
|
|
72
114
|
]
|
|
73
115
|
end
|