653
Copyright Notice.doc
Normal file
653
Copyright Notice.doc
Normal file
File diff suppressed because one or more lines are too long
@ -981,7 +981,7 @@ necessary. Here is a sample; alter the names:
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
Software: unixODBC 2.3.6
|
||||
Software: unixODBC 2.3.9
|
||||
Copyright notice��copyright (c) 1999 Nick Gorham
|
||||
Copyright Patrick Powell 1995
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
320
build.sh
320
build.sh
@ -1,9 +1,82 @@
|
||||
#!/bin/bash
|
||||
# description: the script that make install PSQLODBC
|
||||
#######################################################################
|
||||
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
|
||||
# descript: Compile and pack MPPDB
|
||||
# Return 0 means OK.
|
||||
# Return 1 means failed.
|
||||
# version: 2.0
|
||||
# date: 2020-08-09
|
||||
#######################################################################
|
||||
declare install_package_format='tar'
|
||||
declare serverlib_dir='None'
|
||||
|
||||
#detect platform information.
|
||||
PLATFORM=32
|
||||
bit=$(getconf LONG_BIT)
|
||||
if [ "$bit" -eq 64 ]; then
|
||||
PLATFORM=64
|
||||
fi
|
||||
|
||||
#get OS distributed version.
|
||||
kernel=""
|
||||
version=""
|
||||
if [ -f "/etc/euleros-release" ]; then
|
||||
kernel=$(cat /etc/euleros-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
|
||||
version=$(cat /etc/euleros-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
|
||||
elif [ -f "/etc/openEuler-release" ]; then
|
||||
kernel=$(cat /etc/openEuler-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
|
||||
version=$(cat /etc/openEuler-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
|
||||
elif [ -f "/etc/centos-release" ]; then
|
||||
kernel=$(cat /etc/centos-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
|
||||
version=$(cat /etc/centos-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
|
||||
else
|
||||
kernel=$(lsb_release -d | awk -F ' ' '{print $2}'| tr A-Z a-z)
|
||||
version=$(lsb_release -r | awk -F ' ' '{print $2}')
|
||||
fi
|
||||
|
||||
if [ X"$kernel" == X"euleros" ]; then
|
||||
dist_version="EULER"
|
||||
elif [ X"$kernel" == X"centos" ]; then
|
||||
dist_version="CENTOS"
|
||||
elif [ X"$kernel" == X"openeuler" ]; then
|
||||
dist_version="OPENEULER"
|
||||
else
|
||||
echo "We only support EulerOS, OPENEULER(aarch64) and CentOS platform."
|
||||
echo "Kernel is $kernel"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NOTICE_FILE='Copyright Notice.doc'
|
||||
|
||||
plat=$(uname -p)
|
||||
if [ x$kernel$version$plat != x"eulerossp5x86_64" ] && [ x$kernel$version$plat != x"eulerossp8aarch64" ] && [ x$kernel$version$plat != x"eulerossp2x86_64" ]
|
||||
then
|
||||
echo "Only support to build unixODBC on EulerOS_SP5_x86_64 and EulerOS_SP8_aarch64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
##default install version storage path
|
||||
declare mppdb_version='GaussDB Kernel'
|
||||
declare mppdb_name_for_package="$(echo ${mppdb_version} | sed 's/ /-/g')"
|
||||
declare version_number='V500R001C20'
|
||||
#######################################################################
|
||||
## print help information
|
||||
#######################################################################
|
||||
function print_help()
|
||||
{
|
||||
echo "Usage: $0 [OPTION]
|
||||
-h|--help show help information.
|
||||
-bd|--serverlib_dir the directory of sever binarylibs.
|
||||
"
|
||||
}
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
echo "missing option"
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
######################################################################
|
||||
# Parameter setting
|
||||
######################################################################
|
||||
LOCAL_PATH=${0}
|
||||
FIRST_CHAR=$(expr substr "$LOCAL_PATH" 1 1)
|
||||
if [ "$FIRST_CHAR" = "/" ]; then
|
||||
@ -13,30 +86,54 @@ else
|
||||
fi
|
||||
|
||||
LOCAL_DIR=$(dirname "${LOCAL_PATH}")
|
||||
BUILD_OPTION=
|
||||
TAR_FILE_NAME=unixODBC-2.3.6.tar.gz
|
||||
SOURCE_CODE_PATH=unixODBC-2.3.6
|
||||
LOG_FILE=${LOCAL_DIR}/build_PSQLODBC.log
|
||||
BUILD_FAILED=1
|
||||
|
||||
#########################################################################
|
||||
##read command line paramenters
|
||||
#######################################################################
|
||||
## print help information
|
||||
#######################################################################
|
||||
function print_help()
|
||||
{
|
||||
echo "Usage: $0 [OPTION]
|
||||
-h|--help show help information
|
||||
-m|--build_option provode the path of GAUSSHOME
|
||||
"
|
||||
}
|
||||
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
log "missing option"
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-bd|--serverlib_dir)
|
||||
if [ "$2"X = X ]; then
|
||||
echo "no given binarylib directory values"
|
||||
exit 1
|
||||
fi
|
||||
serverlib_dir=$2
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Internal Error: option processing error: $1" 1>&2
|
||||
echo "please input right paramtenter, the following command may help you"
|
||||
echo "./mpp_package.sh --help or ./mpp_package.sh -h"
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
#######################################################################
|
||||
## declare all package name
|
||||
#######################################################################
|
||||
declare version_string="${mppdb_name_for_package}-${version_number}"
|
||||
declare package_pre_name="${version_string}-${dist_version}-${PLATFORM}bit"
|
||||
declare odbc_package_name="${package_pre_name}-Odbc.${install_package_format}.gz"
|
||||
declare windows_odbc_package_name="${version_string}-Windows-Odbc.tar.gz"
|
||||
|
||||
echo "[makeodbc] $(date +%y-%m-%d' '%T): script dir : ${LOCAL_DIR}"
|
||||
declare LOG_FILE="${LOCAL_DIR}/build.log"
|
||||
declare BUILD_DIR="${LOCAL_DIR}/tmp_odbc"
|
||||
declare ODBC_INSTALL_DIR="${BUILD_DIR}/odbc"
|
||||
declare ERR_MKGS_FAILED=1
|
||||
declare MKGS_OK=0
|
||||
|
||||
SERVERLIBS_PATH="${serverlib_dir}"
|
||||
|
||||
###################################
|
||||
# build parameter about enable-llt
|
||||
##################################
|
||||
COMPLIE_TYPE="comm"
|
||||
echo "[makeodbc] $(date +%y-%m-%d' '%T): Work root dir : ${LOCAL_DIR}"
|
||||
UNIX_ODBC="${LOCAL_DIR}/third_party/unixodbc/install_comm/unixODBC-2.3.9"
|
||||
#######################################################################
|
||||
# Print log.
|
||||
#######################################################################
|
||||
@ -53,89 +150,146 @@ die()
|
||||
{
|
||||
log "$@"
|
||||
echo "$@"
|
||||
exit $BUILD_FAILED
|
||||
exit $ERR_MKGS_FAILED
|
||||
}
|
||||
|
||||
function clean_environment()
|
||||
{
|
||||
if [ -d "$BUILD_DIR" ]; then
|
||||
rm -rf "$BUILD_DIR"
|
||||
fi
|
||||
|
||||
if [ -f "$LOG_FILE" ]; then
|
||||
rm -rf "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "clean completely"
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# build and install component
|
||||
##install odbc
|
||||
#######################################################################
|
||||
function build_component()
|
||||
function install_odbc()
|
||||
{
|
||||
echo "Begin make odbc..." >> "$LOG_FILE" 2>&1
|
||||
|
||||
cd ${LOCAL_DIR}/third_party/unixodbc/
|
||||
sh ./build_unixodbc.sh -m build >> "$LOG_FILE" 2>&1
|
||||
cd ${LOCAL_DIR}
|
||||
|
||||
export GAUSSHOME=$BUILD_OPTION
|
||||
export LD_LIBRARY_PATH=$BUILD_OPTION/lib:$LD_LIBRARY_PATH
|
||||
export GAUSSHOME=$SERVERLIBS_PATH
|
||||
export LD_LIBRARY_PATH=$SERVERLIBS_PATH/lib:$LD_LIBRARY_PATH
|
||||
|
||||
log "[Notice] PSQLODBC configure string: ./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC' --prefix=`pwd`/install --with-libpq=$BUILD_OPTION --with-unixodbc=./third_party/unixodbc/install_comm/unixODBC-2.3.6/"
|
||||
./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC' --prefix=`pwd`/install --with-libpq=$BUILD_OPTION --with-unixodbc=./third_party/unixodbc/install_comm/unixODBC-2.3.6/ >> "$LOG_FILE" 2>&1
|
||||
if [ "$version_mode"x == "memcheck"x ]; then
|
||||
export LIBS="-lrt -ldl -lm -lpthread -lasan"
|
||||
fi
|
||||
|
||||
./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC' --prefix=${ODBC_INSTALL_DIR} --with-libpq=${SERVERLIBS_PATH} --with-unixodbc=${UNIX_ODBC} >> "$LOG_FILE" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
die "configure odbc failed."
|
||||
fi
|
||||
|
||||
log "[Notice] PSQLODBC Begin make"
|
||||
make -sj >> "$LOG_FILE" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
die "PSQLODBC make failed."
|
||||
die "make odbc failed."
|
||||
fi
|
||||
|
||||
log "[Notice] PSQLODBC Begin make install"
|
||||
make install -sj >> "$LOG_FILE" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
die "[Error] PSQLODBC make install failed."
|
||||
die "make install odbc failed."
|
||||
fi
|
||||
|
||||
make clean >> "$LOG_FILE" 2>&1
|
||||
|
||||
log "[Notice] PSQLODBC Begin make package"
|
||||
mv ${LOCAL_DIR}/install ${LOCAL_DIR}/odbc
|
||||
rm -rf ${LOCAL_DIR}/lib
|
||||
mkdir ${LOCAL_DIR}/lib
|
||||
|
||||
#copy libraries into lib
|
||||
cp $BUILD_OPTION/lib/libpq* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libssl* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libcrypto* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libgssapi_krb5_gauss* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libgssrpc_gauss* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libkrb5_gauss* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libkrb5support_gauss* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libk5crypto_gauss* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libconfig* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libpgport_tool* ${LOCAL_DIR}/lib
|
||||
cp $BUILD_OPTION/lib/libcom_err_gauss* ${LOCAL_DIR}/lib
|
||||
|
||||
cp ./third_party/unixodbc/install_comm/unixODBC-2.3.6/lib/libodbcinst* ${LOCAL_DIR}/lib
|
||||
|
||||
tar -czvf openGauss-1.0.0-ODBC.tar.gz ./lib ./odbc
|
||||
|
||||
rm -rf ${LOCAL_DIR}/lib
|
||||
|
||||
log "[Notice] PSQLODBC has been finished"
|
||||
echo "End make odbc" >> "$LOG_FILE" 2>&1
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
#read command line paramenters
|
||||
##########################################################################
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 1
|
||||
declare package_command
|
||||
#######################################################################
|
||||
##select package command accroding to install_package_format
|
||||
#######################################################################
|
||||
function select_package_command()
|
||||
{
|
||||
case "$install_package_format" in
|
||||
tar)
|
||||
tar='tar'
|
||||
option=' -zcvf'
|
||||
package_command="$tar$option"
|
||||
;;
|
||||
-m|--build_option)
|
||||
if [ "$2"X = X ];then
|
||||
die "no given path of GAUSSHOME"
|
||||
fi
|
||||
BUILD_OPTION=$2
|
||||
shift 2
|
||||
rpm)
|
||||
rpm='rpm'
|
||||
option=' -i'
|
||||
package_command="$rpm$option"
|
||||
;;
|
||||
*)
|
||||
log "Internal Error: option processing error: $1" 1>&2
|
||||
log "please input right paramtenter, the following command may help you"
|
||||
log "./build.sh --help or ./build.sh -h"
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
build_component
|
||||
###############################################################
|
||||
## copy the target to set path
|
||||
###############################################################
|
||||
function target_file_copy()
|
||||
{
|
||||
rm -rf ${BUILD_DIR}/lib
|
||||
mkdir ${BUILD_DIR}/lib
|
||||
|
||||
#copy libraries into lib
|
||||
cp $SERVERLIBS_PATH/lib/libpq* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libssl* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libcrypto* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libgssapi_krb5_gauss* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libgssrpc_gauss* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libkrb5_gauss* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libkrb5support_gauss* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libk5crypto_gauss* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libconfig* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libpgport_tool* ${BUILD_DIR}/lib
|
||||
cp $SERVERLIBS_PATH/lib/libcom_err_gauss* ${BUILD_DIR}/lib
|
||||
|
||||
cp $LOCAL_DIR/third_party/unixodbc/install_comm/unixODBC-2.3.9/lib/libodbcinst* ${BUILD_DIR}/lib
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
##function make_package have tree actions
|
||||
##1.copy target file into a newly created temporary directory temp
|
||||
##2.package all file in the temp directory and renome to destination package_path
|
||||
#######################################################################
|
||||
function make_package()
|
||||
{
|
||||
cd ${BUILD_DIR}
|
||||
|
||||
target_file_copy
|
||||
select_package_command
|
||||
cp ${LOCAL_DIR}/"${NOTICE_FILE}" ./
|
||||
|
||||
echo "packaging odbc..."
|
||||
$package_command "${odbc_package_name}" ./lib ./odbc "${NOTICE_FILE}" >>"$LOG_FILE" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
die "$package_command ${odbc_package_name} failed"
|
||||
fi
|
||||
|
||||
mv ${odbc_package_name} ${BUILD_DIR}/
|
||||
|
||||
echo "install odbc tools is ${odbc_package_name} of ${BUILD_DIR} directory " >> "$LOG_FILE" 2>&1
|
||||
echo "success!"
|
||||
}
|
||||
|
||||
#############################################################
|
||||
# main function
|
||||
#############################################################
|
||||
|
||||
# 1. build odbc
|
||||
install_odbc
|
||||
|
||||
# 2. make odbc package
|
||||
make_package
|
||||
|
||||
# 3. cp odbc package to output
|
||||
mkdir ${LOCAL_DIR}/output
|
||||
mv ${BUILD_DIR}/*.tar.gz ${LOCAL_DIR}/output/
|
||||
|
||||
# 4. clean environment
|
||||
echo "clean enviroment"
|
||||
echo "[makemppdb] $(date +%y-%m-%d' '%T): remove ${BUILD_DIR}" >>"$LOG_FILE" 2>&1
|
||||
clean_environment
|
||||
|
||||
echo "now, odbc package has finished!"
|
||||
|
||||
exit 0
|
||||
|
40
third_party/unixodbc/build_unixodbc.sh
vendored
40
third_party/unixodbc/build_unixodbc.sh
vendored
@ -1,5 +1,12 @@
|
||||
#!/bin/bash
|
||||
# description: the script that make install unixODBC
|
||||
#######################################################################
|
||||
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
|
||||
# descript: Compile and pack MPPDB
|
||||
# Return 0 means OK.
|
||||
# Return 1 means failed.
|
||||
# version: 2.0
|
||||
# date: 2020-08-09
|
||||
#######################################################################
|
||||
|
||||
######################################################################
|
||||
# Parameter setting
|
||||
@ -15,8 +22,8 @@ fi
|
||||
LOCAL_DIR=$(dirname "${LOCAL_PATH}")
|
||||
CONFIG_FILE_NAME=config.ini
|
||||
BUILD_OPTION=release
|
||||
TAR_FILE_NAME=unixODBC-2.3.6.tar.gz
|
||||
SOURCE_CODE_PATH=unixODBC-2.3.6
|
||||
TAR_FILE_NAME=unixODBC-2.3.9.tar.gz
|
||||
SOURCE_CODE_PATH=unixODBC-2.3.9
|
||||
LOG_FILE=${LOCAL_DIR}/build_unixODBC.log
|
||||
BUILD_FAILED=1
|
||||
|
||||
@ -78,6 +85,9 @@ INSTALL_COMPOENT_PATH_NAME="${ROOT_DIR}/${COMPONENT_TYPE}/${COMPONENT_NAME}"
|
||||
function build_component()
|
||||
{
|
||||
cd ${LOCAL_DIR}
|
||||
rm -rf ${TAR_FILE_NAME%.tar.gz}
|
||||
rm -rf ${TAR_FILE_NAME}
|
||||
cp ${TAR_FILE_NAME%.tar.gz}.file ${TAR_FILE_NAME}
|
||||
tar -xvf ${TAR_FILE_NAME}
|
||||
|
||||
cd ${LOCAL_DIR}/${SOURCE_CODE_PATH}
|
||||
@ -85,6 +95,11 @@ function build_component()
|
||||
die "[Error] change dir to $SRC_DIR failed."
|
||||
fi
|
||||
|
||||
log "[Notice] start autoreconf."
|
||||
autoreconf -fi
|
||||
if [ $? -ne 0 ]; then
|
||||
die "[Error] autoreconf failed, please install libtool and libtool-ltdl-devel."
|
||||
fi
|
||||
chmod +x configure
|
||||
for COMPILE_TYPE in ${COMPLIE_TYPE_LIST}
|
||||
do
|
||||
@ -96,9 +111,9 @@ function build_component()
|
||||
die "[Error] unixODBC not supported build type."
|
||||
;;
|
||||
comm)
|
||||
mkdir -p ${LOCAL_DIR}/install_comm/unixODBC-2.3.6
|
||||
log "[Notice] unixODBC configure string: ./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC' --enable-gui=no --prefix=${LOCAL_DIR}/install_comm"
|
||||
./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC' --enable-gui=no --prefix=${LOCAL_DIR}/install_comm/unixODBC-2.3.6
|
||||
mkdir -p ${LOCAL_DIR}/install_comm/unixODBC-2.3.9
|
||||
log "[Notice] unixODBC configure string: ./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC -fPIE -pie' --enable-gui=no --prefix=${LOCAL_DIR}/install_comm"
|
||||
./configure CFLAGS='-fstack-protector-all -Wl,-z,relro,-z,now -Wl,-z,noexecstack -fPIC -fPIE -pie' --enable-gui=no --prefix=${LOCAL_DIR}/install_comm/unixODBC-2.3.9
|
||||
;;
|
||||
release_llt)
|
||||
die "[Error] unixODBC not supported build type."
|
||||
@ -120,6 +135,19 @@ function build_component()
|
||||
fi
|
||||
log "[Notice] unixODBC End configure"
|
||||
|
||||
log "[Notice] disable rpath"
|
||||
|
||||
sed -i 's/runpath_var=LD_RUN_PATH/runpath_var=""/g' ./libtool
|
||||
sed -i 's/hardcode_libdir_flag_spec="\\\${wl}-rpath \\\${wl}\\\$libdir"/hardcode_libdir_flag_spec=""/g' ./libtool
|
||||
|
||||
PLAT_FORM_STR=`uname -p`
|
||||
|
||||
if [ "${PLAT_FORM_STR}"X = "aarch64"X ]
|
||||
then
|
||||
sed -i "250c runpath_var=" libtool
|
||||
sed -i "385c hardcode_libdir_flag_spec=" libtool
|
||||
fi
|
||||
|
||||
log "[Notice] unixODBC using \"${COMPILE_TYPE}\" Begin make"
|
||||
make -sj
|
||||
if [ $? -ne 0 ]; then
|
||||
|
BIN
third_party/unixodbc/unixODBC-2.3.6.tar.gz
vendored
BIN
third_party/unixodbc/unixODBC-2.3.6.tar.gz
vendored
Binary file not shown.
BIN
third_party/unixodbc/unixODBC-2.3.9.tar.gz
vendored
Normal file
BIN
third_party/unixodbc/unixODBC-2.3.9.tar.gz
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user