浏览代码

update mac build script

/zgh-build_scripts
guanghuispark 4 年前
当前提交
9b272521
共有 4 个文件被更改,包括 97 次插入31 次删除
  1. 16
      engine/Scripts/full_build.sh
  2. 90
      engine/Scripts/lib_build_mac.sh
  3. 11
      engine/Scripts/patches/bee_debug.patch
  4. 11
      engine/Scripts/patches/bee_release.patch

16
engine/Scripts/full_build.sh


engine_path=
platform=
runtime_mode
runtime_mode=
optimize="--unoptimized"
optimize=""
bitcode=
bitcode=""
while getopts ":r:p:m:eo" opt
do

runtime_mode=$OPTARG
;;
e)
bitcode="--bitcode" # enable-bitcode switch
bitcode="-e" # enable-bitcode switch
optimize="" # optimize code switch
optimize="-o" # optimize code switch
;;
?)
echo "unknown param"

case $platform in
"andorid") echo 'You select android'
;;
"ios") echo 'You select ios'
"ios") ./lib_build_ios.sh -r $engine_path $optimize -p ios -m $runtime_mode $bitcode
"mac") ./lib_build_mac.sh -m $runtime_mode -r $engine_path
"mac") ./lib_build_mac.sh -m $runtime_mode -r $engine_path $optimize
;;
"all") echo 'You select all'
;;
*) echo "unknown platform, only support \"android\",\"ios\",\"mac\",\"windows\""
;;

90
engine/Scripts/lib_build_mac.sh


gn_params=""
optimize="--unoptimized"
ninja_params=""
runtime_mode=
echo "setting environment variable and other params..."
while getopts ":r:p:m:eo" opt
do

gn_params="$gn_params --$OPTARG" # set the target platform android/ios/linux
;;
m)
runtime_node=$OPTARG
gn_params="$gn_params --runtime-mode=$runtime_node" # set runtime mode release/debug/profile
if [ "$runtime_node" == "release" ];then
ninja_params=" -C out/host_release flutter/third_party/txt:txt_lib"
elif [ "$runtime_node" == "debug" ];then
ninja_params=" -C out/host_debug_unopt/ flutter/third_party/txt:txt_lib"
elif [ "$runtime_node" == "profile" ];then
echo "not support profile build yet"
exit 1
fi
runtime_mode=$OPTARG
gn_params="$gn_params --runtime-mode=$runtime_mode" # set runtime mode release/debug/profile
;;
e)
gn_params="$gn_params --bitcode" # enable-bitcode switch

esac
done
if [ "$runtime_mode" == "release" ] && [ "$optimize" == "--unoptimized" ];
then
ninja_params=" -C out/host_release_unopt flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "release" ] && [ "$optimize" == "" ];
then
echo $ninja_params
ninja_params="-C out/host_release flutter/third_party/txt:txt_lib"
echo $ninja_params
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "--unoptimized" ];
then
ninja_params=" -C out/host_debug_unopt flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "" ];
then
ninja_params=" -C out/host_debug flutter/third_party/txt:txt_lib"
elif [ "$runtime_mode" == "profile" ];
then
echo "not support profile build yet"
exit 1
fi
gn_params="$gn_params $optimize"
#set environment variable

if [ ! $FLUTTER_ROOT_PATH ];then
echo "export FLUTTER_ROOT_PATH=$engine_path/engine/src" >> ~/.bash_profile
else
echo "This environment variable has been set, no need to set it again..."
echo "This environment variable has been set, skip"
echo "This environment variable has been set, no need to set it again..."
echo "This environment variable has been set, skip"
else
echo "export PATH=$engine_path/depot_tools:\$PATH" >> ~/.bash_profile
fi

if [ ! -n "$engine_path" ]; then
echo "Flutter engine path is null, please set the path by using \"-r\" param to set a engine path."
echo "Flutter engine path is not exist, please set the path by using \"-r\" param to set a engine path."
else
echo "$engine_path"
fi
fi
echo "depot_tools already installed, skip download"
echo "depot_tools already installed, skip"
else
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
gclient

if [ ! -d 'engine' ];then
if [ -d 'engine' ];
then
echo "engine folder already exist, skip"
else
else
echo "engine folder already exist, skip create"
fi
cd engine
#git@github.com:guanghuispark/engine.git is a temp repo, replace it later

git checkout flutter-1.17-candidate.5
gclient sync -D
echo "\nSCompiling engine..."
echo "\nStarting compile engine..."
cd $engine_path/engine/src/build/mac
cp -f $work_path/patches/find_sdk.patch find_sdk.patch
patch < find_sdk.patch -N

echo "icu_use_data_file=false" >> out/host_debug_unopt/args.gn
if [ "$runtime_mode" == "release" ] && [ "$optimize" == "--unoptimized" ];
then
echo "icu_use_data_file=false" >> out/host_release_unopt/args.gn
elif [ "$runtime_mode" == "release" ] && [ "$optimize" == "" ];
then
echo "icu_use_data_file=false" >> out/host_release/args.gn
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "--unoptimized" ];
then
echo "icu_use_data_file=false" >> out/host_debug_unopt/args.gn
elif [ "$runtime_mode" == "debug" ] && [ "$optimize" == "" ];
then
echo "icu_use_data_file=false" >> out/host_debug/args.gn
elif [ "$runtime_mode" == "profile" ];
then
echo "not support profile build yet"
exit 1
fi
cd $work_path
cd $work_path
echo "flutter root : $FLUTTER_ROOT"
if [ "$runtime_mode" == "release" ];
then
cp -f $work_path/patches/bee_release.patch bee_release.patch
patch < bee_release.patch -N
elif [ "$runtime_mode" == "debug" ];
then
cp -f $work_path/patches/bee_debug.patch bee_debug.patch
patch < bee_debug.patch -N
fi
mono bee.exe mac

11
engine/Scripts/patches/bee_debug.patch


--- /Users/unity/Documents/GitHub/com.unity.uiwidgets/engine/Build.bee.cs 2021-05-17 10:44:45.000000000 +0800
+++ /Users/unity/Documents/GitHub/com.unity.uiwidgets/engine/Scripts/Build.bee.cs 2021-05-17 10:44:20.000000000 +0800
@@ -751,7 +751,7 @@
//SetupFml(np);
//SetupSkia(np);
//SetupTxt(np);
- var codegens = new[] { CodeGen.Release };
+ var codegens = new[] { CodeGen.Debug };
dependencies = new List<NPath>();
if (platform == UIWidgetsBuildTargetPlatform.windows)

11
engine/Scripts/patches/bee_release.patch


--- /Users/unity/Documents/GitHub/com.unity.uiwidgets/engine/Scripts/Build.bee.cs 2021-05-17 10:44:20.000000000 +0800
+++ /Users/unity/Documents/GitHub/com.unity.uiwidgets/engine/Build.bee.cs 2021-05-17 10:44:45.000000000 +0800
@@ -751,7 +751,7 @@
//SetupFml(np);
//SetupSkia(np);
//SetupTxt(np);
- var codegens = new[] { CodeGen.Debug };
+ var codegens = new[] { CodeGen.Release };
dependencies = new List<NPath>();
if (platform == UIWidgetsBuildTargetPlatform.windows)
正在加载...
取消
保存