Skip to content

Commit

Permalink
build.sh完善
Browse files Browse the repository at this point in the history
  • Loading branch information
炒饭 committed Mar 25, 2017
1 parent dcd9f9a commit 36128cc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
wechat_v="0.14.140900"
nwjs_v="0.21.3"
nwjs_v="0.19.4"
44 changes: 23 additions & 21 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 36128cc

Please sign in to comment.