fix(main/turbopack): condense and revise#29207
fix(main/turbopack): condense and revise#29207robertkirkman wants to merge 1 commit intotermux:masterfrom
Conversation
a48a4d5 to
661ff2b
Compare
- Bulk-patch `"android"` wherever it can condense the patches using `find` on `$TERMUX_PKG_SRCDIR` and `rustls-platform-verifier`
- Organize `add_android_build.patch` into the bulk-patches plus three smaller `.patch` files that group related changes together, `disable-wasm-fallback-for-android.patch`, `modify-allocator-for-android.patch` and `modify-file-locking-for-android.patch`
- Use `CARGO_TARGET_NAME` instead of redefining a new variable with the same contents, `RUST_TARGET`
- Apply `--yes` to `npx pnpm install` for noninteractive building outside of GitHub Actions
- Remove unnecessary `ls -l` command
- Remove unnecessary `${STRIP}` commands; `termux_step_strip_elf_symbols()` does that automatically
- Reorganize `termux_step_pre_configure()` to contain all external dependency fetching and environment variable setting, and `termux_step_make()` to contain only the build command
- Implement the fallback binary using a symbolic link to the regular binary, saving space in the package.
- Apply `x86_64-linux-android` triplet to `napi` array in `packages/next-swc/package.json`
661ff2b to
0b9f52e
Compare
|
@xingguangcuican6666 @Kuldeep-Dilliwar I wanted to ask,
|
| + let env_var = std::env::var("TURBO_SSL_CERT_FILE"); | ||
| + | ||
| + // --- BRANCH A: TERMUX MODE (Fix the Crash) --- | ||
| + if termux_path.exists() { |
There was a problem hiding this comment.
I believe that my version does not require this patch in this way.
However, I have not been able to conclusively confirm that, because I do not know how to reproduce the exact error that this patch fixes.
@Kuldeep-Dilliwar do you know how to reproduce the exact error that this patch about /data/data/com.termux/files/usr/etc/tls/cert.pem fixes, so I can test my version to confirm that it is not affected by the error anymore even without having this patch?
It seems that there is no problem. I will conduct a functionality test later. |
|
After my testing, it seems that there is indeed no problem, but I found that /data/data/com.termux/files/usr/etc/profile.d/turbopack.sh does not source automatically and needs to be sourced manually. |
This is known about; I explained that it is necessary to use Maybe I should add a line to the However, that is also necessary for other things in Termux and also often on Desktop Linux as well, such as for example C# programs like |
This is the issues that i added those harcoded cert file location from Termux, in this image I have used artifect from build, and the reason about adding the env was that, because in one feature of nextjs you can use your corporate companies SSL cert which is provided by your company, so i thought I could make a env which people or user can point to and that will be added to know cert list. |
It is because you are using If we consider |
ok actually yes I can reproduce those errors, but I did not know if those were what is fixed by that patch, yes that points out that this PR currently doesn't handle that correctly. I need to change this PR until it works fully. Thank you for confirming those errors get fixed by the patch, now I can check that to see when my version is working. |
| local ENV_PREFIX=$(echo "$RUST_TARGET" | tr '[:lower:]-' '[:upper:]_') | ||
| if [ "$TERMUX_ARCH" == "aarch64" ]; then | ||
| export RUSTFLAGS="$RUSTFLAGS -Zshare-generics=y -Csymbol-mangling-version=v0" | ||
| local ENV_PREFIX=$(echo "$CARGO_TARGET_NAME" | tr '[:lower:]-' '[:upper:]_') |
There was a problem hiding this comment.
declare/local has a -u flag for this.
| local ENV_PREFIX=$(echo "$CARGO_TARGET_NAME" | tr '[:lower:]-' '[:upper:]_') | |
| local -u env_host="${CARGO_TARGET_NAME//-/_}" |
https://man.archlinux.org/man/bash.1#u~3
This is also used in the fish build, it probably makes sense to use the same variable name as well..
termux-packages/packages/fish/build.sh
Line 35 in c9ef649
| else | ||
| export "CARGO_TARGET_${ENV_PREFIX}_LINKER"="$CC" | ||
| export "CC_${RUST_TARGET//-/_}"="$CC" | ||
| export "CC_${CARGO_TARGET_NAME//-/_}"="$CC" |
There was a problem hiding this comment.
| export "CC_${CARGO_TARGET_NAME//-/_}"="$CC" | |
| export "CC_${env_host}"="$CC" |
| termux_step_make() { | ||
| cd packages/next-swc | ||
| npx pnpm run build-native-release --target "$RUST_TARGET" | ||
| npx pnpm run build-native-release --target "$CARGO_TARGET_NAME" |
There was a problem hiding this comment.
| npx pnpm run build-native-release --target "$CARGO_TARGET_NAME" | |
| npx pnpm run build-native-release --target "${env_host}" |
There was a problem hiding this comment.
This line does not need to be changed because it uses $CARGO_TARGET_NAME unmodified


Bulk-patch
"android"wherever it can condense the patches usingfindon$TERMUX_PKG_SRCDIRandrustls-platform-verifierOrganize
add_android_build.patchinto the bulk-patches plus three smaller.patchfiles that group related changes together,disable-wasm-fallback-for-android.patch,modify-allocator-for-android.patchandmodify-file-locking-for-android.patchUse
CARGO_TARGET_NAMEinstead of redefining a new variable with the same contents,RUST_TARGETApply
--yestonpx pnpm installfor noninteractive building outside of GitHub ActionsRemove unnecessary
ls -lcommandRemove unnecessary
${STRIP}commands;termux_step_strip_elf_symbols()does that automaticallyReorganize
termux_step_pre_configure()to contain all external dependency fetching and environment variable setting, andtermux_step_make()to contain only the build commandImplement the fallback binary using a symbolic link to the regular binary, saving space in the package.
Apply
x86_64-linux-androidtriplet tonapiarray inpackages/next-swc/package.json