浏览代码

fix build errors for mac/android/ios

/zgh-build_scripts
guanghuispark 4 年前
当前提交
ca18ed46
共有 4 个文件被更改,包括 57 次插入44 次删除
  1. 58
      engine/Scripts/lib_build_android.sh
  2. 24
      engine/Scripts/lib_build_ios.sh
  3. 4
      engine/Scripts/lib_build_mac.sh
  4. 15
      engine/Scripts/rsppatch.py

58
engine/Scripts/lib_build_android.sh


engine_path=
platform=
gn_params=""
optimize="--unoptimized"
optimize=""
while getopts ":r:p:m:eo" opt
do
case $opt in

runtime_mode=$OPTARG
gn_params="$gn_params --runtime-mode=$runtime_mode" # set runtime mode release/debug
;;
e)
gn_params="$gn_params --bitcode" # enable-bitcode switch
;;
o)
optimize="" # optimize code switch
;;
?)
echo "unknown param"
exit 1;;

if [ "$runtime_mode" == "release" ] && [ "$optimize" == "--unoptimized" ];
if [ "$runtime_mode" == "release" ];
output_path="android_release_unopt"
ninja_params=" -C out/android_release_unopt flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "release" ] && [ "$optimize" == "" ];
then
optimize=""
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "--unoptimized" ];
elif [ "$runtime_mode" == "debug" ];
optimize="--unoptimized"
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "" ];
then
output_path="android_debug"
ninja_params=" -C out/android_debug flutter/third_party/txt:txt_lib"
echo "not support profile build yet"
echo "not support profile build"
exit 1
fi

then
mono bee.exe android_release
rm -rf ../com.unity.uiwidgets/Runtime/Plugins/android/libUIWidgets.so
cp -r build_release/. ../com.unity.uiwidgets/Runtime/Plugins/android
mkdir $work_path/../artifacts/rsp/backup
cp -f $work_path/../artifacts/rsp/14590475716575637239.rsp $work_path/../artifacts/rsp/backup/14590475716575637239.rsp
cd $work_path
python -c 'import rsppatch; print rsppatch.rsp_patch()'
cd $work_path/../
"artifacts/Stevedore/android-ndk-mac/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" @"artifacts/rsp/14590475716575637239.rsp"
$FLUTTER_ROOT_PATH/buildtools/mac-x64/clang/bin/clang++ @"artifacts/rsp/14590475716575637239.rsp"
cp artifacts/libUIWidgets/release_Android_arm32/libUIWidgets.so ../com.unity.uiwidgets/Runtime/Plugins/Android/libUIWidgets.so
cp -r build_release/. ../com.unity.uiwidgets/Runtime/Plugins/android
cp -r build_debug/. ../com.unity.uiwidgets/Runtime/Plugins/android
cd $work_path/../artifacts/rsp
cp -f $work_path/patches/android/rsp.patch rsp.patch
patch < rsp.patch -N
cd $work_path/../
"artifacts/Stevedore/android-ndk-mac/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++" @"artifacts/rsp/14590475716575637239.rsp"
$FLUTTER_ROOT_PATH/buildtools/mac-x64/clang/bin/clang++ @"artifacts/rsp/14590475716575637239.rsp"
cp artifacts/libUIWidgets/release_Android_arm32/libUIWidgets.so ../com.unity.uiwidgets/Runtime/Plugins/Android/libUIWidgets.so
echo "\nRevert patches..."
cd $FLUTTER_ROOT_PATH/flutter/third_party/txt
patch -R < BUILD.gn.patch

cd $FLUTTER_ROOT_PATH/build/mac
patch -R < find_sdk.patch
patch -R < find_sdk.patch
if [ "$runtime_mode" == "release" ];
then
rm -rf $work_path/../artifacts/rsp/14590475716575637239.rsp
cp -f $work_path/../artifacts/rsp/backup/14590475716575637239.rsp $work_path/../artifacts/rsp/14590475716575637239.rsp
rm -rf $work_path/../artifacts/rsp/backup
echo "rsp reverted"
fi

24
engine/Scripts/lib_build_ios.sh


elif [ "$runtime_mode" == "debug" ];
then
optimize="--unoptimized"
output_path="ios_debug"
output_path="ios_debug_unopt"
ninja_params=" -C out/$output_path flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "profile" ];
then

rm -rf build_release/*
mono bee.exe ios_release
cp -r build_release/. ../com.unity.uiwidgets/Runtime/Plugins/ios
echo "\nStarting prlink library..."
cd Scripts/../
tundra_file="$work_path/../artifacts/tundra.dag.json"
python3 Scripts/prelink.py $tundra_file $runtime_mode $output_path $work_path $bitcode
elif [ "$runtime_mode" == "debug" ];
then
rm -rf build_debug/*

echo "\nStarting prlink library..."
cd Scripts/../
tundra_file="$work_path/../artifacts/tundra.dag.json"
python3 Scripts/prelink.py $tundra_file $runtime_mode $output_path $work_path $bitcode
echo "\nRevert patches..."
cd $FLUTTER_ROOT_PATH/flutter/third_party/txt
patch -R < BUILD.gn.patch
if [ "$runtime_mode" == "debug" ];
then
echo "\nRevert patches..."
cd $FLUTTER_ROOT_PATH/flutter/third_party/txt
patch -R < BUILD.gn.patch
cd $FLUTTER_ROOT_PATH/build/mac
patch -R < find_sdk.patch
cd $FLUTTER_ROOT_PATH/build/mac
patch -R < find_sdk.patch
fi

4
engine/Scripts/lib_build_mac.sh


elif [ "$runtime_mode" == "debug" ];
then
optimize="--unoptimized"
output_path="host_debug"
ninja_params=" -C out/host_debug flutter/third_party/txt:txt_lib"
output_path="host_debug_unopt"
ninja_params=" -C out/$output_path flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "profile" ];
then
echo "not support profile build yet"

15
engine/Scripts/rsppatch.py


import os
import sys
def rsp_patch():
file_data = ""
file = "../artifacts/rsp/14590475716575637239.rsp"
old_str = ',--icf-iterations=5'
with open(file, "r") as f:
for line in f:
if old_str in line:
line = line.replace(old_str,'')
file_data += line
with open(file,"w") as f:
f.write(file_data)
return "rsp modified"
正在加载...
取消
保存