1#!/bin/bash 2# Copyright 2020-2021 Huawei Technologies Co., Ltd 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================ 16 17set -e 18 19function android_release_package() 20{ 21 arch=$1 22 device=$2 23 pkg_name="mindspore-lite-${version}-android-${arch}" 24 25 rm -rf ${pkg_name} 26 tar -xzf ${input_path}/android_${arch}/${device}/${pkg_name}.tar.gz 27 # Copy java runtime to Android package 28 cp ${input_path}/aar/mindspore-lite-*maven*.zip ${pkg_name} 29 30 mkdir -p ${output_path}/release/android/${device}/ 31 tar -czf ${output_path}/release/android/${device}/${pkg_name}.tar.gz ${pkg_name} 32 rm -rf ${pkg_name} 33 cd ${output_path}/release/android/${device}/ 34 sha256sum ${pkg_name}.tar.gz > ${pkg_name}.tar.gz.sha256 35} 36 37function ios_release_package() 38{ 39 mkdir -p ${output_path}/release/ios/ 40 cp ${input_path}/ios_aarch64/*.tar.gz* ${output_path}/release/ios/ 41 cp ${input_path}/ios_aarch32/*.tar.gz* ${output_path}/release/ios/ 42} 43 44function linux_release_package() 45{ 46 mkdir -p ${output_path}/release/linux/nnie/ 47 cp ${input_path}/ubuntu_x86/avx/*.tar.gz* ${output_path}/release/linux/ 48 49 cp ${input_path}/linux_aarch32/*.tar.gz* ${output_path}/release/linux/ 50 cp ${input_path}/ubuntu_x86/nnie/3516D/*.tar.gz* ${output_path}/release/linux/nnie/ 51} 52 53function windows_release_package() 54{ 55 mkdir -p ${output_path}/release/windows/ 56 cp ${input_path}/windows_x64/avx/*.zip* ${output_path}/release/windows/ 57 cp ${input_path}/windows_x32/sse/*.zip* ${output_path}/release/windows/ 58} 59 60function openharmony_release_package() 61{ 62 mkdir -p ${output_path}/release/openharmony/ 63 cp ${input_path}/ohos_aarch32/*.tar.gz* ${output_path}/release/openharmony/ 64} 65 66echo "============================== begin ==============================" 67echo "Usage: bash lite_release_package.sh input_path output_path" 68 69input_path=$1 70output_path=$2 71version=`ls ${input_path}/android_aarch64/npu/mindspore-lite-*-*.tar.gz | awk -F'/' '{print $NF}' | cut -d"-" -f3` 72 73android_release_package aarch32 npu 74android_release_package aarch32 cpu 75android_release_package aarch64 npu 76android_release_package aarch64 gpu 77 78ios_release_package 79linux_release_package 80windows_release_package 81openharmony_release_package 82 83echo "Create release package success!" 84echo "=============================== end ===============================" 85