浏览代码

add mac build scripts

/zgh-build_scripts
guanghuispark 4 年前
当前提交
01f0ba62
共有 7 个文件被更改,包括 213 次插入1 次删除
  1. 2
      engine/Build.bee.cs
  2. 45
      engine/Scripts/full_build.sh
  3. 133
      engine/Scripts/lib_build_mac.sh
  4. 21
      engine/Scripts/patches/BUILD.gn.patch
  5. 13
      engine/Scripts/patches/find_sdk.patch

2
engine/Build.bee.cs


static void Main()
{
flutterRoot = Environment.GetEnvironmentVariable("FLUTTER_ROOT");
flutterRoot = Environment.GetEnvironmentVariable("FLUTTER_ROOT_PATH");
if (string.IsNullOrEmpty(flutterRoot))
{
flutterRoot = Environment.GetEnvironmentVariable("USERPROFILE") + "/engine/src";

45
engine/Scripts/full_build.sh


engine_path=
platform=
runtime_mode
gn_params=""
optimize="--unoptimized"
ninja_params=""
bitcode=
while getopts ":r:p:m:eo" opt
do
case $opt in
r)
engine_path=$OPTARG # set engine_path, depot_tools and flutter engine folder will be put into this path
;;
p)
platform=$OPTARG
;;
m)
runtime_mode=$OPTARG
;;
e)
bitcode="--bitcode" # enable-bitcode switch
;;
o)
optimize="" # optimize code switch
;;
?)
echo "unknown param"
exit 1;;
esac
done
case $platform in
"andorid") echo 'You select android'
;;
"ios") echo 'You select ios'
;;
"mac") ./lib_build_mac.sh -m $runtime_mode -r $engine_path
;;
"windows") echo 'You select windows'
;;
*) echo "unknown platform, only support \"android\",\"ios\",\"mac\",\"windows\""
;;
esac

133
engine/Scripts/lib_build_mac.sh


work_path=$(pwd)
engine_path=
platform=
gn_params=""
optimize="--unoptimized"
ninja_params=""
while getopts ":r:p:m:eo" opt
do
case $opt in
r)
engine_path=$OPTARG # set engine_path, depot_tools and flutter engine folder will be put into this path
;;
p)
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
;;
e)
gn_params="$gn_params --bitcode" # enable-bitcode switch
;;
o)
optimize="" # optimize code switch
;;
?)
echo "unknown param"
exit 1;;
esac
done
gn_params="$gn_params $optimize"
#set environment variable
function isexist()
{
source_str=$1
test_str=$2
strings=$(echo $source_str | sed 's/:/ /g')
for str in $strings
do
if [ $test_str = $str ]; then
return 0
fi
done
return 1
}
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..."
fi
if isexist $PATH $engine_path/depot_tools; then
echo "This environment variable has been set, no need to set it again..."
else
echo "export PATH=$engine_path/depot_tools:\$PATH" >> ~/.bash_profile
fi
source ~/.bash_profile
echo "\nGetting Depot Tools..."
if [ ! -n "$engine_path" ]; then
echo "Flutter engine path is null, please set the path by using \"-r\" param to set a engine path."
exit 1
else
echo "$engine_path"
fi
cd $engine_path
if [ -d 'depot_tools' ] && [ -d "depot_tools/.git" ];
then
echo "depot_tools already installed, skip download"
else
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
gclient
fi
echo "\nGetting flutter engine..."
if [ ! -d 'engine' ];then
mkdir engine
else
echo "engine folder already exist, skip create"
fi
cd engine
#git@github.com:guanghuispark/engine.git is a temp repo, replace it later
echo "solutions = [
{
\"managed\": False,
\"name\": \"src/flutter\",
\"url\": \"git@github.com:guanghuispark/engine.git\",
\"custom_deps\": {},
\"deps_file\": \"DEPS\",
\"safesync_url\": \"\",
},
]" > .gclient
gclient sync
cd src/flutter
git checkout flutter-1.17-candidate.5
gclient sync -D
#apply patch to Build.gn
cd third_party/txt
cp -f $work_path/patches/BUILD.gn.patch BUILD.gn.patch
patch < BUILD.gn.patch -N
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
cd ../..
./flutter/tools/gn $gn_params
echo "icu_use_data_file=false" >> out/host_debug_unopt/args.gn
ninja $ninja_params
echo "\nStarting build engine..."
#run mono
cd $work_path
cd ..
echo "flutter root : $FLUTTER_ROOT"
mono bee.exe mac

21
engine/Scripts/patches/BUILD.gn.patch


--- a/third_party/txt/BUILD.gn
+++ b/third_party/txt/BUILD.gn
@@ -141,6 +141,7 @@
"//third_party/harfbuzz",
"//third_party/icu",
"//third_party/skia",
+ "//third_party/skia/modules/skottie",
]
deps = [
@@ -339,3 +340,10 @@
deps += [ "//third_party/skia/modules/skparagraph" ]
}
}
+
+static_library("txt_lib") {
+ complete_static_lib = true
+ deps = [
+ ":txt",
+ ]
+}

13
engine/Scripts/patches/find_sdk.patch


diff --git a/Users/unity/Documents/GitHub/EngineBuildTool/engine/src/build/mac/find_sdk.py b/Users/unity/Desktop/find_sdk.py
index 0534766..e503ced 100755
--- a/Users/unity/Documents/GitHub/EngineBuildTool/engine/src/build/mac/find_sdk.py
+++ b/Users/unity/Desktop/find_sdk.py
@@ -55,7 +55,7 @@ def main():
sdk_dir = xcode43_sdk_path
else:
sdk_dir = os.path.join(out.rstrip(), 'SDKs')
- sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
+ sdks = [re.findall('^MacOSX(11\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6']
sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6']
if parse_version(s) >= parse_version(min_sdk_version)]
正在加载...
取消
保存