diff --git a/utils/.gitignore b/utils/.gitignore new file mode 100644 index 0000000..3996308 --- /dev/null +++ b/utils/.gitignore @@ -0,0 +1 @@ +/xege_libs \ No newline at end of file diff --git a/utils/deploy.sh b/utils/deploy.sh new file mode 100644 index 0000000..21b6683 --- /dev/null +++ b/utils/deploy.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." +EGE_DIR=$(pwd) + +cd utils + +# 先执行一遍 release.sh +./release.sh + +if [[ ! -d "xege_libs/.git" ]]; then + git clone git@github.com:wysaid/xege.org.git xege_libs +fi + +if ! cd xege_libs; then + echo "Failed to enter xege_libs" >&2 + exit 1 +fi + +git checkout master +git reset --hard origin/master +git pull + +cp -rf "$EGE_DIR/Release/lib" . +cp -rf "$EGE_DIR/include" . +cp -rf "$EGE_DIR/man" . diff --git a/utils/release.sh b/utils/release.sh index 1661896..852746f 100755 --- a/utils/release.sh +++ b/utils/release.sh @@ -4,11 +4,30 @@ cd "$(dirname "$0")/.." EGE_DIR=$(pwd) -if [[ $(uname -s) == "Darwin" ]] || [[ $(uname -s) == "Linux" ]]; then +git clean -ffdx build Release + +declare -a FAILED_TASKS=() + +if [[ $(uname -s) == "Darwin" ]]; then # macos/linux - ./tasks.sh --clean --release --load --target xege --build - mkdir -p Release/lib/macOS - cp -rf build/*.a Release/lib/macOS + if ./tasks.sh --clean --release --load --target xege --build; then + mkdir -p Release/lib/macOS + cp -rf build/*.a Release/lib/macOS + echo "Copy macOS libs done: $(pwd)/Release/lib/macOS" + else + echo "Build macOS failed!" >&2 + FAILED_TASKS+=("macOS") + fi +elif [[ $(uname -s) == "Linux" ]]; then + if ./tasks.sh --clean --release --load --target xege --build; then + # 目前暂时只提供 mingw-w64-debian 的版本, 所以默认 mingw-w64-debian. 后续如果要支持更多, 那么再改. + mkdir -p Release/lib/mingw-w64-debian + cp -rf build/*.a Release/lib/mingw-w64-debian + echo "Copy mingw-w64-debian libs done: $(pwd)/Release/lib/mingw-w64-debian" + else + echo "Build mingw-w64-debian failed!" >&2 + FAILED_TASKS+=("mingw-w64-debian") + fi else # vs2022 - 64bit if ./tasks.sh --clean --release --toolset v143 --arch x64 --target xege --load --build; then @@ -18,6 +37,7 @@ else echo "Copy vs2022 x64 libs done: $(pwd)/Release/lib/vs2022/x64" else echo "Build vs2022 x64 failed!" >&2 + FAILED_TASKS+=("vs2022 x64") fi # vs2022 - 32bit @@ -28,6 +48,7 @@ else echo "Copy vs2022 x86 libs done: $(pwd)/Release/lib/vs2022/x86" else echo "Build vs2022 x86 failed!" >&2 + FAILED_TASKS+=("vs2022 x86") fi # vs2019 - 64bit @@ -38,6 +59,7 @@ else echo "Copy vs2019 x64 libs done: $(pwd)/Release/lib/vs2019/x64" else echo "Build vs2019 x64 failed!" >&2 + FAILED_TASKS+=("vs2019 x64") fi # vs2019 - 32bit @@ -48,6 +70,7 @@ else echo "Copy vs2019 x86 libs done: $(pwd)/Release/lib/vs2019/x86" else echo "Build vs2019 x86 failed!" >&2 + FAILED_TASKS+=("vs2019 x86") fi # vs2017 - 64bit @@ -58,6 +81,7 @@ else echo "Copy vs2017 x64 libs done: $(pwd)/Release/lib/vs2017/x64" else echo "Build vs2017 x64 failed!" >&2 + FAILED_TASKS+=("vs2017 x64") fi # vs2017 - 32bit @@ -68,6 +92,7 @@ else echo "Copy vs2017 x86 libs done: $(pwd)/Release/lib/vs2017/x86" else echo "Build vs2017 x86 failed!" >&2 + FAILED_TASKS+=("vs2017 x86") fi # vs2015 - 64bit @@ -79,6 +104,7 @@ else echo "Copy vs2015 x64 libs done: $(pwd)/Release/lib/vs2015/amd64" else echo "Build vs2015 x64 failed!" >&2 + FAILED_TASKS+=("vs2015 x64") fi # vs2015 - 32bit @@ -89,6 +115,7 @@ else echo "Copy vs2015 x86 libs done: $(pwd)/Release/lib/vs2015" else echo "Build vs2015 x86 failed!" >&2 + FAILED_TASKS+=("vs2015 x86") fi # vs2010 - 64bit @@ -99,6 +126,7 @@ else echo "Copy vs2010 x64 libs done: $(pwd)/Release/lib/vs2010/amd64" else echo "Build vs2010 x64 failed!" >&2 + FAILED_TASKS+=("vs2010 x64") fi # vs2010 - 32bit @@ -109,5 +137,12 @@ else echo "Copy vs2010 x86 libs done: $(pwd)/Release/lib/vs2010" else echo "Build vs2010 x86 failed!" >&2 + FAILED_TASKS+=("vs2010 x86") fi fi + +if [[ ${#FAILED_TASKS[@]} -gt 0 ]]; then + echo "Failed tasks:" >&2 + printf " %s\n" "${FAILED_TASKS[@]}" >&2 + exit ${#FAILED_TASKS[@]} +fi