3 [[ "${BASH_SOURCE[0]}" != "${0}" ]] && echo "Please don't source ${BASH_SOURCE[0]}, execute it" && return
6 # TODO need more better argument parsing
9 CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10 ROOT_PATH="$CURRENT_PATH/../../"
13 # mount volume (or directory) for externals
14 if [ -n "$EXTERNAL_VOLUME" ]; then
15 DOCKER_OPTS+=" -v $EXTERNAL_VOLUME:/externals"
16 CONFIG_OPTIONS+=" -DNNAS_EXTERNALS_DIR=/externals"
18 echo "It will use default external path"
21 # mount volume (or directory) for overlay
22 if [ -n "$OVERLAY_VOLUME" ]; then
23 DOCKER_OPTS+=" -v $OVERLAY_VOLUME:/overlay"
24 CONFIG_OPTIONS+=" -DNNCC_OVERLAY_DIR=/overlay"
26 echo "It will use default overlay path"
30 if [ -n "$TENSORFLOW_PREFIX" ]; then
31 DOCKER_OPTS+=" -v $TENSORFLOW_PREFIX:/opt/tensorflow"
32 CONFIG_OPTIONS+=" -DTENSORFLOW_PREFIX=/opt/tensorflow"
36 if [ -n "$ONNXRUNTIME_PREFIX" ]; then
37 DOCKER_OPTS+=" -v $ONNXRUNTIME_PREFIX:/opt/onnxruntime"
38 CONFIG_OPTIONS+=" -DONNXRUNTIME_PREFIX=/opt/onnxruntime"
42 # - for bionic, use DOCKER_IMAGE_NAME="nnfw/one-devtools:bionic"
43 # - for focal, use DOCKER_IMAGE_NAME="nnfw/one-devtools:focal"
44 if [[ -z $DOCKER_IMAGE_NAME ]]; then
45 echo "It will use default docker image name"
48 NNAS_WORKSPACE=${NNAS_WORKSPACE:-build}
49 NNCC_INSTALL_PREFIX=${NNAS_WORKSPACE}/out
50 DOCKER_OPTS+=" -e NNAS_BUILD_PREFIX=${NNAS_WORKSPACE}"
52 if [[ -z "${ARCHIVE_PATH}" ]]; then
53 ARCHIVE_PATH=${NNAS_WORKSPACE}/archive
58 pushd $ROOT_PATH > /dev/null
60 mkdir -p ${NNCC_INSTALL_PREFIX}
61 ./nncc docker-run ./nnas create-package --prefix "${PWD}/${NNCC_INSTALL_PREFIX}" -- "${CONFIG_OPTIONS}"
63 mkdir -p ${ARCHIVE_PATH}
64 tar -zcf ${ARCHIVE_PATH}/nncc-package.tar.gz -C ${NNCC_INSTALL_PREFIX} \
65 --exclude test --exclude tflchef* --exclude circle-tensordump --exclude circledump ./
66 tar -zcf ${ARCHIVE_PATH}/nncc-test-package.tar.gz -C ${NNCC_INSTALL_PREFIX} ./test
68 if [ -z ${RELEASE_VERSION} ] || [ ${RELEASE_VERSION} == "nightly" ]; then
69 ./nncc docker-run /bin/bash -c \
70 'dch -v $($(pwd)/tools/release_tool/onert_version.sh)~$(date "+%y%m%d%H") "nightly release" -D $(lsb_release --short --codename)'
71 ./nncc docker-run dch -r ''
74 ./nncc docker-run debuild --preserve-env --no-lintian -us -uc \
75 -b --buildinfo-option=-ubuild --changes-option=-ubuild