提交 3700552e 编写于 作者: L lihui

[TBASE-1420]

上级 b0c839de
...@@ -41,33 +41,35 @@ IF (NOT DEFINED TD_CLUSTER) ...@@ -41,33 +41,35 @@ IF (NOT DEFINED TD_CLUSTER)
SET(TD_ARM FALSE) SET(TD_ARM FALSE)
SET(TD_ARM_64 FALSE) SET(TD_ARM_64 FALSE)
SET(TD_ARM_32 FALSE) SET(TD_ARM_32 FALSE)
SET(TD_MIPS FALSE)
SET(TD_MIPS_64 FALSE) SET(TD_MIPS_64 FALSE)
SET(TD_MIPS_32 FALSE)
SET(TD_DARWIN_64 FALSE) SET(TD_DARWIN_64 FALSE)
SET(TD_WINDOWS_64 FALSE) SET(TD_WINDOWS_64 FALSE)
# if generate ARM version: # if generate ARM version:
# cmake -DARMVER=arm32 .. or cmake -DARMVER=arm64 # cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF (${ARMVER} MATCHES "arm32") IF (${CPUTYPE} MATCHES "aarch32")
SET(TD_ARM TRUE) SET(TD_ARM TRUE)
SET(TD_ARM_32 TRUE) SET(TD_ARM_32 TRUE)
ADD_DEFINITIONS(-D_TD_ARM_) ADD_DEFINITIONS(-D_TD_ARM_)
ADD_DEFINITIONS(-D_TD_ARM_32_) ADD_DEFINITIONS(-D_TD_ARM_32_)
ELSEIF (${ARMVER} MATCHES "arm64") ELSEIF (${CPUTYPE} MATCHES "aarch64")
SET(TD_ARM TRUE) SET(TD_ARM TRUE)
SET(TD_ARM_64 TRUE) SET(TD_ARM_64 TRUE)
ADD_DEFINITIONS(-D_TD_ARM_) ADD_DEFINITIONS(-D_TD_ARM_)
ADD_DEFINITIONS(-D_TD_ARM_64_) ADD_DEFINITIONS(-D_TD_ARM_64_)
ENDIF () ELSEIF (${CPUTYPE} MATCHES "mips64")
SET(TD_MIPS TRUE)
IF (TD_ARM) SET(TD_MIPS_64 TRUE)
ADD_DEFINITIONS(-D_TD_ARM_) ADD_DEFINITIONS(-D_TD_MIPS_)
IF (TD_ARM_32) ADD_DEFINITIONS(-D_TD_MIPS_64_)
ADD_DEFINITIONS(-D_TD_ARM_32_) ELSEIF (${CPUTYPE} MATCHES "x64")
ELSEIF (TD_ARM_64) MESSAGE(STATUS "input cpuType: " ${CPUTYPE})
ADD_DEFINITIONS(-D_TD_ARM_64_) ELSEIF (${CPUTYPE} MATCHES "x86")
MESSAGE(STATUS "input cpuType: " ${CPUTYPE})
ELSE () ELSE ()
EXIT () MESSAGE(STATUS "input cpuType: " ${CPUTYPE})
ENDIF ()
ENDIF () ENDIF ()
# #
......
#!/bin/bash #!/bin/bash
# #
# Generate deb package for ubuntu # Generate deb package for ubuntu
# set -x set -e
#set -x
#curr_dir=$(pwd) #curr_dir=$(pwd)
compile_dir=$1 compile_dir=$1
output_dir=$2 output_dir=$2
tdengine_ver=$3 tdengine_ver=$3
armver=$4 cpuType=$4
osType=$5
verMode=$6
verType=$7
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)" top_dir="$(readlink -f ${script_dir}/../..)"
...@@ -64,15 +68,24 @@ debver="Version: "$tdengine_ver ...@@ -64,15 +68,24 @@ debver="Version: "$tdengine_ver
sed -i "2c$debver" ${pkg_dir}/DEBIAN/control sed -i "2c$debver" ${pkg_dir}/DEBIAN/control
#get taos version, then set deb name #get taos version, then set deb name
if [ -z "$armver" ]; then
debname="TDengine-"${tdengine_ver}".deb"
elif [ "$armver" == "arm64" ]; then if [ "$verMode" == "cluster" ]; then
debname="TDengine-"${tdengine_ver}"-arm64.deb" debname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType}
elif [ "$armver" == "arm32" ]; then elif [ "$verMode" == "lite" ]; then
debname="TDengine-"${tdengine_ver}"-arm32.deb" debname="TDengine-server-edge"-${tdengine_ver}-${osType}-${cpuType}
else
echo "unknow verMode, nor cluster or lite"
exit 1
fi
if [ "$verType" == "beta" ]; then
debname=${debname}-${verType}".deb"
elif [ "$verType" == "stable" ]; then
debname=${debname}".deb"
else else
echo "input parameter error!!!" echo "unknow verType, nor stabel or beta"
return exit 1
fi fi
# make deb package # make deb package
......
...@@ -5,7 +5,45 @@ ...@@ -5,7 +5,45 @@
set -e set -e
# set -x # set -x
armver=$1 # releash.sh -v [cluster | lite] -c [aarch32 | aarch64 | x64 | x86 | mips64 ...] -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...] -V [stable | beta]
# set parameters by default value
verMode=lite # [cluster, lite]
verType=stable # [stable, beta]
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
while getopts "hv:V:c:o:" arg
do
case $arg in
v)
#echo "verMode=$OPTARG"
verMode=$( echo $OPTARG )
;;
V)
#echo "verType=$OPTARG"
verType=$(echo $OPTARG)
;;
c)
#echo "cpuType=$OPTARG"
cpuType=$(echo $OPTARG)
;;
o)
#echo "osType=$OPTARG"
osType=$(echo $OPTARG)
;;
h)
echo "Usage: `basename $0` -v [cluster | lite] -c [aarch32 | aarch64 | x64 | x86 | mips64 ...] -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...] -V [stable | beta]"
exit 0
;;
?) #unknow option
echo "unkonw argument"
exit 1
;;
esac
done
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType}"
curr_dir=$(pwd) curr_dir=$(pwd)
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
...@@ -112,6 +150,10 @@ echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo ...@@ -112,6 +150,10 @@ echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo
echo "char gitinfoOfInternal[128] = \"\";" >> ${versioninfo} echo "char gitinfoOfInternal[128] = \"\";" >> ${versioninfo}
echo "char buildinfo[512] = \"Built by ${USER} at ${build_time}\";" >> ${versioninfo} echo "char buildinfo[512] = \"Built by ${USER} at ${build_time}\";" >> ${versioninfo}
echo "" >> ${versioninfo}
tmp_version=$(echo $version | tr -s "." "_")
echo "void libtaos_edge_${tmp_version}_${osType}_${cpuType}() {};" >> ${versioninfo}
# 2. cmake executable file # 2. cmake executable file
compile_dir="${top_dir}/debug" compile_dir="${top_dir}/debug"
...@@ -122,16 +164,12 @@ fi ...@@ -122,16 +164,12 @@ fi
${csudo} mkdir -p ${compile_dir} ${csudo} mkdir -p ${compile_dir}
cd ${compile_dir} cd ${compile_dir}
# arm only support lite ver # check support cpu type
if [ -z "$armver" ]; then if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
cmake ../ cmake ../ -DCPUTYPE=${cpuType}
elif [ "$armver" == "arm64" ]; then
cmake ../ -DARMVER=arm64
elif [ "$armver" == "arm32" ]; then
cmake ../ -DARMVER=arm32
else else
echo "input parameter error!!!" echo "input cpuType=${cpuType} error!!!"
return exit 1
fi fi
make make
...@@ -143,28 +181,28 @@ cd ${curr_dir} ...@@ -143,28 +181,28 @@ cd ${curr_dir}
#osinfo=$(cat /etc/os-release | grep "NAME" | cut -d '"' -f2) #osinfo=$(cat /etc/os-release | grep "NAME" | cut -d '"' -f2)
#echo "osinfo: ${osinfo}" #echo "osinfo: ${osinfo}"
echo "do deb package for the ubuntu system" echo "====do deb package for the ubuntu system===="
output_dir="${top_dir}/debs" output_dir="${top_dir}/debs"
if [ -d ${output_dir} ]; then if [ -d ${output_dir} ]; then
${csudo} rm -rf ${output_dir} ${csudo} rm -rf ${output_dir}
fi fi
${csudo} mkdir -p ${output_dir} ${csudo} mkdir -p ${output_dir}
cd ${script_dir}/deb cd ${script_dir}/deb
${csudo} ./makedeb.sh ${compile_dir} ${output_dir} ${version} ${armver} ${csudo} ./makedeb.sh ${compile_dir} ${output_dir} ${version} ${cpuType} ${osType} ${verMode} ${verType}
echo "do rpm package for the centos system" echo "====do rpm package for the centos system===="
output_dir="${top_dir}/rpms" output_dir="${top_dir}/rpms"
if [ -d ${output_dir} ]; then if [ -d ${output_dir} ]; then
${csudo} rm -rf ${output_dir} ${csudo} rm -rf ${output_dir}
fi fi
${csudo} mkdir -p ${output_dir} ${csudo} mkdir -p ${output_dir}
cd ${script_dir}/rpm cd ${script_dir}/rpm
${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${version} ${armver} ${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${version} ${cpuType} ${osType} ${verMode} ${verType}
echo "do tar.gz package for all systems" echo "====do tar.gz package for all systems===="
cd ${script_dir}/tools cd ${script_dir}/tools
${csudo} ./makepkg.sh ${compile_dir} ${version} "${build_time}" ${armver} ${csudo} ./makepkg.sh ${compile_dir} ${version} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType}
${csudo} ./makeclient.sh ${compile_dir} ${version} "${build_time}" ${armver} ${csudo} ./makeclient.sh ${compile_dir} ${version} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType}
# 4. Clean up temporary compile directories # 4. Clean up temporary compile directories
#${csudo} rm -rf ${compile_dir} #${csudo} rm -rf ${compile_dir}
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
compile_dir=$1 compile_dir=$1
output_dir=$2 output_dir=$2
tdengine_ver=$3 tdengine_ver=$3
armver=$4 cpuType=$4
osType=$5
verMode=$6
verType=$7
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)" top_dir="$(readlink -f ${script_dir}/../..)"
...@@ -55,15 +58,30 @@ ${csudo} mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS ...@@ -55,15 +58,30 @@ ${csudo} mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
${csudo} rpmbuild --define="_version ${tdengine_ver}" --define="_topdir ${pkg_dir}" --define="_compiledir ${compile_dir}" -bb ${spec_file} ${csudo} rpmbuild --define="_version ${tdengine_ver}" --define="_topdir ${pkg_dir}" --define="_compiledir ${compile_dir}" -bb ${spec_file}
# copy rpm package to output_dir, then clean temp dir # copy rpm package to output_dir, and modify package name, then clean temp dir
#${csudo} cp -rf RPMS/* ${output_dir} #${csudo} cp -rf RPMS/* ${output_dir}
cp_rpm_package ${pkg_dir}/RPMS cp_rpm_package ${pkg_dir}/RPMS
if [ "$armver" == "arm64" ]; then
mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/TDengine-${tdengine_ver}-arm64.rpm if [ "$verMode" == "cluster" ]; then
elif [ "$armver" == "arm32" ]; then rpmname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType}
mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/TDengine-${tdengine_ver}-arm32.rpm elif [ "$verMode" == "lite" ]; then
rpmname="TDengine-server-edge"-${tdengine_ver}-${osType}-${cpuType}
else
echo "unknow verMode, nor cluster or lite"
exit 1
fi
if [ "$verType" == "beta" ]; then
rpmname=${rpmname}-${verType}".rpm"
elif [ "$verType" == "stable" ]; then
rpmname=${rpmname}".rpm"
else
echo "unknow verType, nor stabel or beta"
exit 1
fi fi
mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/${rpmname}
cd .. cd ..
${csudo} rm -rf ${pkg_dir} ${csudo} rm -rf ${pkg_dir}
#!/bin/bash #!/bin/bash
# #
# Generate tar.gz package for linux client # Generate tar.gz package for linux client in all os system
set -e set -e
set -x #set -x
curr_dir=$(pwd) curr_dir=$(pwd)
compile_dir=$1 compile_dir=$1
version=$2 version=$2
build_time=$3 build_time=$3
armver=$4 cpuType=$4
osType=$5
verMode=$6
verType=$7
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)" top_dir="$(readlink -f ${script_dir}/../..)"
...@@ -19,7 +22,7 @@ code_dir="${top_dir}/src" ...@@ -19,7 +22,7 @@ code_dir="${top_dir}/src"
release_dir="${top_dir}/release" release_dir="${top_dir}/release"
#package_name='linux' #package_name='linux'
install_dir="${release_dir}/TDengine-client-${version}" install_dir="${release_dir}/TDengine-client"
# Directories and files. # Directories and files.
bin_files="${build_dir}/bin/taos ${build_dir}/bin/taosdump ${script_dir}/remove_client.sh" bin_files="${build_dir}/bin/taos ${build_dir}/bin/taosdump ${script_dir}/remove_client.sh"
...@@ -42,12 +45,13 @@ cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install* ...@@ -42,12 +45,13 @@ cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install*
# Copy example code # Copy example code
mkdir -p ${install_dir}/examples mkdir -p ${install_dir}/examples
cp -r ${top_dir}/tests/examples/c ${install_dir}/examples examples_dir="${top_dir}/tests/examples"
cp -r ${top_dir}/tests/examples/JDBC ${install_dir}/examples cp -r ${examples_dir}/c ${install_dir}/examples
cp -r ${top_dir}/tests/examples/matlab ${install_dir}/examples cp -r ${examples_dir}/JDBC ${install_dir}/examples
cp -r ${top_dir}/tests/examples/python ${install_dir}/examples cp -r ${examples_dir}/matlab ${install_dir}/examples
cp -r ${top_dir}/tests/examples/R ${install_dir}/examples cp -r ${examples_dir}/python ${install_dir}/examples
cp -r ${top_dir}/tests/examples/go ${install_dir}/examples cp -r ${examples_dir}/R ${install_dir}/examples
cp -r ${examples_dir}/go ${install_dir}/examples
# Copy driver # Copy driver
mkdir -p ${install_dir}/driver mkdir -p ${install_dir}/driver
...@@ -67,12 +71,25 @@ cp -r ${connector_dir}/go ${install_dir}/connector ...@@ -67,12 +71,25 @@ cp -r ${connector_dir}/go ${install_dir}/connector
# exit 1 # exit 1
cd ${release_dir} cd ${release_dir}
if [ -z "$armver" ]; then
tar -zcv -f "$(basename ${install_dir}).tar.gz" $(basename ${install_dir}) --remove-files if [ "$verMode" == "cluster" ]; then
elif [ "$armver" == "arm64" ]; then pkg_name=${install_dir}-${version}-${osType}-${cpuType}
tar -zcv -f "$(basename ${install_dir})-arm64.tar.gz" $(basename ${install_dir}) --remove-files elif [ "$verMode" == "lite" ]; then
elif [ "$armver" == "arm32" ]; then pkg_name=${install_dir}-edge-${version}-${osType}-${cpuType}
tar -zcv -f "$(basename ${install_dir})-arm32.tar.gz" $(basename ${install_dir}) --remove-files else
echo "unknow verMode, nor cluster or lite"
exit 1
fi
if [ "$verType" == "beta" ]; then
pkg_name=${pkg_name}-${verType}
elif [ "$verType" == "stable" ]; then
pkg_name=${pkg_name}
else
echo "unknow verType, nor stable or beta"
exit 1
fi fi
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files
cd ${curr_dir} cd ${curr_dir}
#!/bin/bash #!/bin/bash
# #
# Generate deb package for other os system (no unbutu or centos) # Generate tar.gz package for all os system
set -e
#set -x
curr_dir=$(pwd) curr_dir=$(pwd)
compile_dir=$1 compile_dir=$1
version=$2 version=$2
build_time=$3 build_time=$3
armver=$4 cpuType=$4
osType=$5
verMode=$6
verType=$7
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)" top_dir="$(readlink -f ${script_dir}/../..)"
...@@ -17,7 +23,7 @@ code_dir="${top_dir}/src" ...@@ -17,7 +23,7 @@ code_dir="${top_dir}/src"
release_dir="${top_dir}/release" release_dir="${top_dir}/release"
#package_name='linux' #package_name='linux'
install_dir="${release_dir}/TDengine-${version}" install_dir="${release_dir}/TDengine-server"
# Directories and files. # Directories and files.
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/taosdump ${script_dir}/remove.sh" bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/taosdump ${script_dir}/remove.sh"
...@@ -78,12 +84,25 @@ cp -r ${connector_dir}/go ${install_dir}/connector ...@@ -78,12 +84,25 @@ cp -r ${connector_dir}/go ${install_dir}/connector
# exit 1 # exit 1
cd ${release_dir} cd ${release_dir}
if [ -z "$armver" ]; then
tar -zcv -f "$(basename ${install_dir}).tar.gz" $(basename ${install_dir}) --remove-files if [ "$verMode" == "cluster" ]; then
elif [ "$armver" == "arm64" ]; then pkg_name=${install_dir}-${version}-${osType}-${cpuType}
tar -zcv -f "$(basename ${install_dir})-arm64.tar.gz" $(basename ${install_dir}) --remove-files elif [ "$verMode" == "lite" ]; then
elif [ "$armver" == "arm32" ]; then pkg_name=${install_dir}-edge-${version}-${osType}-${cpuType}
tar -zcv -f "$(basename ${install_dir})-arm32.tar.gz" $(basename ${install_dir}) --remove-files else
echo "unknow verMode, nor cluster or lite"
exit 1
fi fi
if [ "$verType" == "beta" ]; then
pkg_name=${pkg_name}-${verType}
elif [ "$verType" == "stable" ]; then
pkg_name=${pkg_name}
else
echo "unknow verType, nor stabel or beta"
exit 1
fi
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files
cd ${curr_dir} cd ${curr_dir}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册