diff --git a/cross-build.sh b/cross-build.sh index a725e4eb..92dd2096 100755 --- a/cross-build.sh +++ b/cross-build.sh @@ -12,8 +12,9 @@ cross=false user=emqx smart=false clib=glibc +build_type=Release -while getopts ":a:v:b:c:u:s:l:" OPT; do +while getopts ":a:v:b:c:u:s:l:d:" OPT; do case ${OPT} in a) arch=$OPTARG @@ -36,10 +37,18 @@ while getopts ":a:v:b:c:u:s:l:" OPT; do l) clib=$OPTARG ;; + d) + build_type=$OPTARG + ;; esac done -neuron_dir=$home/$bdb/Program/$vendor +case $build_type in + (Release) + neuron_dir=$home/$bdb/Program/$vendor;; + (Debug) + neuron_dir=$home/$bdb/Program_Debug/$vendor;; +esac case $cross in (true) @@ -58,19 +67,19 @@ function compile_source_with_tag() { cd $repo git submodule update --init mkdir build && cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \ + cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \ -DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \ -DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \ -DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake case $smart in (true) - cmake .. -DSMART_LINK=1 -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \ + cmake .. -DSMART_LINK=1 -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \ -DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \ -DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \ -DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake;; (false) - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \ + cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \ -DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \ -DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \ -DCMAKE_TOOLCHAIN_FILE=../cmake/cross.cmake;; @@ -80,7 +89,7 @@ function compile_source_with_tag() { (glibc) ;; (*) - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISABLE_UT=ON \ + cmake .. -DCMAKE_BUILD_TYPE=$build_type -DDISABLE_UT=ON \ -DTOOL_DIR=$tool_dir -DCOMPILER_PREFIX=$vendor \ -DCMAKE_SYSTEM_PROCESSOR=$arch -DLIBRARY_DIR=$library \ -DCLIB=\'\"$clib\"\' \ diff --git a/cross-package.sh b/cross-package.sh index 9310fb80..4cd28b78 100755 --- a/cross-package.sh +++ b/cross-package.sh @@ -10,8 +10,9 @@ arch=? version=? cnc=false custom=default +build_type=Release -while getopts ":a:v:o:c:n:" OPT; do +while getopts ":a:v:o:c:n:d:" OPT; do case ${OPT} in a) arch=$OPTARG @@ -28,12 +29,25 @@ while getopts ":a:v:o:c:n:" OPT; do c) custom=$OPTARG ;; + d) + build_type=$OPTARG + ;; esac done -neuron_dir=$home/$branch/Program/$vendor/neuron -neuron_modules_dir=$home/$branch/Program/$vendor/neuron-modules -package_dir=$home/$branch/Program/$vendor/package/neuron + +case $build_type in + (Release) + neuron_dir=$home/$branch/Program/$vendor/neuron; + neuron_modules_dir=$home/$branch/Program/$vendor/neuron-modules; + package_dir=$home/$branch/Program/$vendor/package/neuron;; + (Debug) + neuron_dir=$home/$branch/Program_Debug/$vendor/neuron; + neuron_modules_dir=$home/$branch/Program_Debug/$vendor/neuron-modules; + package_dir=$home/$branch/Program_Debug/$vendor/package/neuron;; +esac + + library=$home/$branch/libs/$vendor script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" @@ -148,9 +162,29 @@ case $custom in echo "no custom";; esac +case $build_type in + (Debug) + if [ $vendor == "x86_64-neuron-linux-gnu" ]; then + cp /home/neuron/buildroot/$vendor/output/host/usr/$vendor/lib64/libasan.so.2.0.0 $package_dir/ + cd $package_dir + ln -s ./libasan.so.2.0.0 libasan.so.2 + fi;; + (Release) + echo "release";; +esac + cd $package_dir/.. rm -rf neuron*.tar.gz -tar czf neuron-$version-linux-$arch.tar.gz neuron -echo "neuron-$version-linux-$arch.tar.gz" + +case $build_type in + (Release) + tar czf neuron-$version-linux-$arch.tar.gz neuron; + echo "neuron-$version-linux-$arch.tar.gz";; + (Debug) + tar czf neuron-$version-debug-linux-$arch.tar.gz neuron; + echo "neuron-$version-debug-linux-$arch.tar.gz";; +esac + +