diff --git a/build.conf b/build.conf index 048df6323..6c0b3e322 100644 --- a/build.conf +++ b/build.conf @@ -1,2 +1,2 @@ wechat_v="0.14.140900" -nwjs_v="0.21.3" +nwjs_v="0.19.4" diff --git a/build.sh b/build.sh index b5ded5e06..bc731916f 100755 --- a/build.sh +++ b/build.sh @@ -1,34 +1,36 @@ #! /bin/sh # tar wechat-dev-tools -. ./build.conf -package_dir="./package.nw" -tmp_dir="./.tmp" -dist_dir="./dist" -build_dir="./.build" -nwjs_file="nwjs-v$nwjs_v.tar.gz" -nwjs_dir="nwjs-sdk-v${nwjs_v}-linux-x64" +cur_dir=`dirname $0` +. "$cur_dir/build.conf" +package_dir="$cur_dir/package.nw" +tmp_dir="$cur_dir/.tmp" +build_dir="$cur_dir/dist" + +nwjs_file="$tmp_dir/nwjs-v$nwjs_v.tar.gz" +nwjs_dir="$tmp_dir/nwjs-sdk-v${nwjs_v}-linux-x64" nwjs_download="https://dl.nwjs.io/v$nwjs_v/nwjs-sdk-v${nwjs_v}-linux-x64.tar.gz" -dist_wechat_dir="wechat-dev-tools" -dist_wechat_package="wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz" +dist_wechat_dir="$tmp_dir/wechat-dev-tools" +dist_wechat_package="$tmp_dir/wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz" + mkdir -p $tmp_dir -if [ ! -d "$tmp_dir/$nwjs_dir" ]; then - if [ ! -f "$tmp_dir/$nwjs_file" ]; then - wget "$nwjs_download" -O .tmp/$nwjs_file - $? -ne 0 && exit $? +if [ ! -d "$nwjs_dir" ]; then + if [ ! -f "$nwjs_file" ]; then + wget "$nwjs_download" -O $nwjs_file + $? -ne 0 && exit "$?" fi - tar -xf $tmp_dir/$nwjs_file -C $tmp_dir - $? -ne 0 && exit $? + tar -xf $nwjs_file -C $tmp_dir + $? -ne 0 && exit "$?" fi -rm -rf $dist_dir -mkdir -p $dist_dir/$dist_wechat_dir -cp -rl "$tmp_dir/$nwjs_dir"/* "$dist_dir/$dist_wechat_dir" && -cp -rl "$package_dir" "$dist_dir/$dist_wechat_dir" && -tar -zcvf "$dist_dir/$dist_wechat_package" "$dist_dir/$dist_wechat_dir" +rm -rf $dist_wechat_dir +mkdir -p $dist_wechat_dir +cp -rl "$nwjs_dir"/* "$dist_wechat_dir" && +cp -rl "$package_dir" "$dist_wechat_dir" && +tar -zcvf "$dist_wechat_package" "$dist_wechat_dir" mkdir -p $build_dir -cp -l "$dist_dir/$dist_wechat_package" "$build_dir" +mv -f "$dist_wechat_package" "$build_dir"