@@ -203,19 +203,25 @@ EOF
203203# Nothing is written to package.json: these are already declared there as
204204# optionalDependencies, and this only makes the ones bun skipped present.
205205fetch_native_modules () {
206- local version platform pkg dir url
206+ local version platform pkg dir url variants bun_target _label _kind _deb
207207 version=$( jq -r ' .optionalDependencies["@opentui/core-darwin-arm64"] // empty' package.json)
208208 [ -n " $version " ] || die " no @opentui/core-* version in package.json optionalDependencies"
209209 for entry in " ${TARGETS[@]} " ; do
210210 IFS=' |' read -r _label bun_target _kind _deb <<< " $entry"
211211 platform=${bun_target# bun-}
212- pkg=" core-$platform "
213- dir=" node_modules/@opentui/$pkg "
214- [ -d " $dir " ] && continue
215- url=" https://registry.npmjs.org/@opentui/$pkg /-/$pkg -$version .tgz"
216- info " fetching @opentui/$pkg @$version (cross-compile target)"
217- mkdir -p " $dir "
218- curl -fsSL " $url " | tar -xz -C " $dir " --strip-components=1 || die " could not fetch @opentui/$pkg @$version from the registry"
212+ # A Linux binary picks glibc or musl at runtime, so both variants have to
213+ # resolve at compile time.
214+ variants=" core-$platform "
215+ [ " $_kind " = linux ] && variants=" $variants core-$platform -musl"
216+ for pkg in $variants ; do
217+ dir=" node_modules/@opentui/$pkg "
218+ [ -d " $dir " ] && continue
219+ url=" https://registry.npmjs.org/@opentui/$pkg /-/$pkg -$version .tgz"
220+ info " fetching @opentui/$pkg @$version (cross-compile target)"
221+ mkdir -p " $dir "
222+ curl -fsSL " $url " | tar -xz -C " $dir " --strip-components=1 \
223+ || die " could not fetch @opentui/$pkg @$version from the registry"
224+ done
219225 done
220226}
221227
0 commit comments