Skip to content

Instantly share code, notes, and snippets.

@0x1306a94
Last active February 16, 2019 15:26
Show Gist options
  • Save 0x1306a94/0f88203624beb69e27a9cf7d4845e0b0 to your computer and use it in GitHub Desktop.
Save 0x1306a94/0f88203624beb69e27a9cf7d4845e0b0 to your computer and use it in GitHub Desktop.
提取chromium net base url 模块相关头文件
#!/bin/sh
set -e
# $1 源码根目录
# $2 编译输出目录
# $3 模块名
# $4 头文件输出根目录
function print_usage_and_exit() {
echo "${0} [chromium_src_root] [build_out_dir] [target_name] [targetroot]"
exit 1
}
function get_fullpath() {
_PWD=`pwd`
if [ -d $1 ]; then
cd $1
elif [ -f $1 ]; then
cd `dirname $1`
else
cd
fi
echo $(cd ..; cd -)
cd ${_PWD} >/dev/null
}
__PWD__=`pwd`
SCR_ROOT=`get_fullpath ${1}`
BUILD_ROOT=`get_fullpath ${2}`
MODULE_NAME=${3}
HEADER_ROOT=`get_fullpath ${4}`
echo "SCR_ROOT: ${SCR_ROOT}"
echo "BUILD_ROOT: ${BUILD_ROOT}"
echo "MODULE_NAME: ${MODULE_NAME}"
echo "HEADER_ROOT: ${HEADER_ROOT}"
cd $SCR_ROOT
for line in `gn desc ${BUILD_ROOT} ${MODULE_NAME}`
do
if [[ "${line}" == *.h ]];
then
file=${line#//}
dir=`dirname $HEADER_ROOT/include/$file`
mkdir -p $dir
cp -f $SCR_ROOT/$file $dir
echo "cp $SCR_ROOT/$file to $dir"
fi
done
cd $__PWD__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment