fork init

This commit is contained in:
NoCrypt 2024-07-24 05:49:30 +07:00
parent cf6f3093ff
commit 2e0d8ab04f
8 changed files with 6945 additions and 5086 deletions

View file

@ -6,8 +6,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:banner="@drawable/banner">
android:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name=".MainActivity"
@ -55,4 +54,4 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
</manifest>
</manifest>

View file

@ -3,7 +3,8 @@
"version": "1.1.0",
"private": true,
"scripts": {
"build:native": "cd public/nodejs/ && npm install && docker build -t android-build:latest . && docker run -v ${PWD}:/app/ -it android-build:latest /bin/bash /app/setup-deps.sh",
"build:native": "cd public/nodejs/ && pnpm install && docker build -t android-build:latest . && docker run -v ${PWD}:/app/ -it android-build:latest /bin/bash /app/setup-deps.sh",
"build:native-win": "cd public\\nodejs && for %I in (.) do docker run -v %~fI:/app/ -it android-build:latest /bin/bash /app/setup-deps-win.sh",
"build:app": "cross-env NODE_ENV=production run-s build:web build:native build:assets",
"build:web": "webpack build",
"build:assets": "capacitor-assets generate --iconBackgroundColor #e5204c --iconBackgroundColorDark #e5204c --splashBackgroundColor #e5204c --splashBackgroundColorDark #e5204c --android",

View file

@ -0,0 +1,54 @@
#!/bin/bash
# instructions
# Install Android NDK
# Set $ANDROID_NDK_PATH (example: ~/Android/Sdk/ndk/26.1.10909125)
# Download and extract android .zip for nodejs-mobile from https://github.com/nodejs-mobile/nodejs-mobile/releases/tag/v18.17.2
# Update LIBNODE_PATH
# npm install nodejs-mobile-gyp
# install other npm packages like normal
# run this script
if [ -d "node_modules" ]; then
echo "node_modules already exists, skipping npm install"
else
npm install
fi
toolchain_folder=$NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
export PATH=$toolchain_folder:$PATH
toolchain_target_archs=(armv7a aarch64 x86_64)
node_target_arch=(arm arm64 x64)
android_api_levels=(eabi24 "24" "24")
for ((i=0;i<${#toolchain_target_archs[@]};i++)); do
toolchain_target_arch=${toolchain_target_archs[i]}
node_target_arch=${node_target_arch[i]}
android_api_level=${android_api_levels[i]}
export CC=$toolchain_folder/${toolchain_target_arch}-linux-android${android_api_level}-clang
export CXX=$toolchain_folder/${toolchain_target_arch}-linux-android${android_api_level}-clang++
export LINK=$toolchain_folder/${toolchain_target_arch}-linux-android${android_api_level}-clang++
export AR=$toolchain_folder/llvm-ar
export npm_config_verbose=1
export npm_config_nodedir=${LIBNODE_PATH}
export npm_config_node_gyp=$(pwd)/node_modules/nodejs-mobile-gyp/bin/node-gyp.js
export npm_config_arch=${node_target_arch}
export npm_config_plaform=android
export npm_config_format=make-android
export npm_gyp_defines="target_arch=$node_target_arch v8_target_arch=$node_target_arch android_target_arch=$node_target_arch host_os=linux OS=android"
# --from-from-source is used by node-pre-gyp
echo "Rebuilding for $node_target_arch"
npm rebuild --build-from-source
for file in node_modules/*/build/Release/*.node; do
package=$(echo "$file" | cut -f 2 -d "/")
echo "moving prebuild for $package ($file)"
mkdir "node_modules/$package/prebuilds/android-$node_target_arch"
mv $file "node_modules/$package/prebuilds/android-$node_target_arch/node.napi.node"
rm -r "node_modules/$package/build/"
done
done

View file

@ -0,0 +1,7 @@
## This is what lacks of doc did to a newbie :<
Rename-Item -Path "android" -NewName "android_tmp"
pnpm exec cap add android
Copy-Item -Path "android_tmp\*" -Destination "android" -Recurse -Force
Remove-Item -Path "android_tmp" -Recurse -Force

View file

@ -0,0 +1,8 @@
#!/bin/bash
## This is what lacks of doc did to a newbie :<
mv android android_tmp
pnpm exec cap add android
cp -r android_tmp/* android/
rm -rf android_tmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 MiB

Binary file not shown.

File diff suppressed because it is too large Load diff