浏览代码

copy output libs in shell scripts

/zgh-build_scripts
guanghuispark 4 年前
当前提交
d8e1eb9e
共有 4 个文件被更改,包括 38 次插入37 次删除
  1. 36
      engine/Scripts/lib_build_ios.sh
  2. 33
      engine/Scripts/lib_build_mac.sh
  3. 2
      engine/Scripts/patches/find_sdk.patch
  4. 4
      engine/Scripts/prelink.py

36
engine/Scripts/lib_build_ios.sh


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
gn_params="$gn_params --$OPTARG" # set the target platform android/ios
gn_params="$gn_params --runtime-mode=$runtime_mode" # set runtime mode release/debug/profile
gn_params="$gn_params --runtime-mode=$runtime_mode" # set runtime mode release/debug
;;
e)
bitcode="-bitcode_bundle -bitcode_verify"

gclient sync
cd src/flutter
cd $FLUTTER_ROOT_PATH/flutter
cd third_party/txt
cd $FLUTTER_ROOT_PATH/flutter/third_party/txt
cd $engine_path/engine/src/build/mac
cp -f $work_path/patches/find_sdk.patch find_sdk.patch
patch < find_sdk.patch -N
cd ../..
cd $FLUTTER_ROOT_PATH
./flutter/tools/gn $gn_params

echo "\nStarting build engine..."
cd $work_path
cd ..
cd $work_path/../
if [ -d '../com.unity.uiwidgets/Runtime/Plugins/ios' ];
then
echo "ios folder already exist, skip create folder"
else
mkdir ../com.unity.uiwidgets/Runtime/Plugins/ios
fi
rm -rf build_release/*
rm -rf ../com.unity.uiwidgets/Runtime/Plugins/ios/*
cp -r build_release/. ../com.unity.uiwidgets/Runtime/Plugins/ios
rm -rf build_debug/*
rm -rf ../com.unity.uiwidgets/Runtime/Plugins/ios/*
cp -r build_debug/. ../com.unity.uiwidgets/Runtime/Plugins/ios
cd Scripts
xcode_path=""
xcode_path=`python -c 'import prelink; print prelink.get_xcode_path()'`
target_files=""
cd Scripts/../
cd ..
python3 Scripts/prelink.py $tundra_file $runtime_mode $output_path $work_path $bitcode

33
engine/Scripts/lib_build_mac.sh


gclient sync
cd src/flutter
cd $FLUTTER_ROOT_PATH/flutter
cd third_party/txt
cd $FLUTTER_ROOT_PATH/flutter/third_party/txt
cd $engine_path/engine/src/build/mac
cd $FLUTTER_ROOT_PATH/build/mac
cd ../..
cd $FLUTTER_ROOT_PATH
./flutter/tools/gn $gn_params
echo "icu_use_data_file=false" >> out/$output_path/args.gn

cd $work_path
cd ..
cd $work_path/../
if [ -d '../com.unity.uiwidgets/Runtime/Plugins/osx' ];
then
echo "osx folder already exist, skip create folder"
else
mkdir ../com.unity.uiwidgets/Runtime/Plugins/osx
fi
rm -rf build_release/*
if [ -d '../com.unity.uiwidgets/Runtime/Plugins/osx' ];
then
echo "engine folder already exist, skip"
else
mkdir ../com.unity.uiwidgets/Runtime/Plugins/osx
fi
rm -rf build_debug/*
if [ -d '../com.unity.uiwidgets/Runtime/Plugins/osx' ];
then
echo "engine folder already exist, skip create folder"
else
mkdir ../com.unity.uiwidgets/Runtime/Plugins/osx
fi
rm -rf ../com.unity.uiwidgets/Runtime/Plugins/osx/*
cp -r build_debug/. ../com.unity.uiwidgets/Runtime/Plugins/osx
fi

2
engine/Scripts/patches/find_sdk.patch


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 = [re.findall('^MacOSX(1[0-1]\.\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)]

4
engine/Scripts/prelink.py


json_list = temp['Nodes']
target_files=''
for item in json_list:
if item['Annotation'].startswith('Lib_iOS_arm64') and item['Annotation'].find("release_iOS_arm64") != -1:
if item['Annotation'].startswith('Lib_iOS_arm64') and item['Annotation'].find(runtime_mode) != -1:
action = item['Action']
o_file_list = action.split("\"")
for o in o_file_list:

os.system('\"' + xcode_path + '/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -r -arch arm64 ' + bitcode + ' -syslibroot ' + xcode_path + '/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -unexported_symbols_list third.symbol ' + target_files + ' ' + flutter_root_path + '/out/' + output_path + '/obj/flutter/third_party/txt/libtxt_lib.a -o "libUIWidgets.o"')
os.system('\"' + xcode_path + '/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool" -arch_only arm64 -static "libUIWidgets.o" -o "libUIWidgets.a"')
os.system('\"' + xcode_path + '/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" -x "libUIWidgets.a"')
os.system('cp -r libUIWidgets.a ' + '../com.unity.uiwidgets/Runtime/Plugins/'+ output_path + '/libUIWidgets.a')
os.system('cp -r libUIWidgets.a ' + '../com.unity.uiwidgets/Runtime/Plugins/ios/libUIWidgets.a')
if __name__ == "__main__":
if len(sys.argv) > 5:

正在加载...
取消
保存