提交 a109c0ad 编写于 作者: LINGuanRen's avatar LINGuanRen 提交者: wangzelin.wzl

add compilation compatibility about other x86_64 system

上级 178a779f
#!/bin/sh
#!/bin/bash
TOPDIR="$(dirname $(readlink -f "$0"))"
DEP_DIR=${TOPDIR}/deps/3rd/usr/local/oceanbase/deps/devel
TOOLS_DIR=${TOPDIR}/deps/3rd/usr/local/oceanbase/devtools
......@@ -13,10 +13,10 @@ function sw()
export RUNTIME_DIR;
export DEP_VAR=$DEP_DIR/var/;
/sbin/ldconfig -n $DEP_DIR/lib;
export LD_LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib;
export LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib;
export CPLUS_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:$DEP_VAR/usr/local/include:$DEP_VAR/usr/include;
export C_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include;
export LD_LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:$DEP_VAR/lib64:/usr/lib/x86_64-linux-gnu;
export LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:/usr/lib/x86_64-linux-gnu;
export CPLUS_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:$DEP_VAR/usr/local/include:$DEP_VAR/usr/include:$DEP_VAR/devel/include:/usr/include/x86_64-linux-gnu;
export C_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:/usr/include/x86_64-linux-gnu;
export PATH=$DEP_DIR/bin:$TOOLS_DIR/bin:$PATH;
}
......@@ -35,7 +35,7 @@ function do_init()
function do_dep_init()
{
(cd $TOPDIR/deps/3rd && sh dep_create.sh)
(cd $TOPDIR/deps/3rd && bash dep_create.sh)
cd $TOPDIR
do_init
}
......
......@@ -26,17 +26,17 @@
if test "$withval" = "yes"; then
case "$host_cpu" in
*aarch64* )
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wunused-parameter -Wformat -Wconversion -Wno-deprecated -Wno-invalid-offsetof -finline-functions -fno-strict-aliasing -mtune=generic -Wno-psabi -Wno-sign-compare"
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=generic -Wno-psabi -Wno-sign-compare"
AM_CFLAGS="-g -O2 -D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -finline-functions -fno-strict-aliasing -Wall -mtune=generic -Wno-psabi -Wno-sign-compare"
;;
* )
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wunused-parameter -Wformat -Wconversion -Wno-deprecated -Wno-invalid-offsetof -finline-functions -fno-strict-aliasing -mtune=core2 -Wno-psabi -Wno-sign-compare"
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=core2 -Wno-psabi -Wno-sign-compare"
AM_CFLAGS="-g -O2 -D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -finline-functions -fno-strict-aliasing -Wall -mtune=core2 -Wno-psabi -Wno-sign-compare"
;;
esac
fi
],
[ AM_CXXFLAGS="-D__STDC_LIMIT_MACROS -D_OB_VERSION=1000 -D__STDC_CONSTANT_MACROS -D_NO_EXCEPTION -g -Wall -Wextra -Wunused-parameter -Wformat -Wconversion -Wno-invalid-offsetof -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -mtune=generic -Wno-psabi -Wno-sign-compare"
[ AM_CXXFLAGS="-D__STDC_LIMIT_MACROS -D_OB_VERSION=1000 -D__STDC_CONSTANT_MACROS -D_NO_EXCEPTION -g -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -mtune=generic -Wno-psabi -Wno-sign-compare"
AM_CFLAGS="-D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-omit-frame-pointer -g -Wall -Wno-psabi -Wno-sign-compare"
]
)
......@@ -53,6 +53,8 @@
AM_CXXFLAGS="${AM_CXXFLAGS} -DGCC_52"
fi
AM_CXXFLAGS="${AM_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0"
gcc_version="4.4.4"
dnl condition OPT_GCC_VERSION
AC_ARG_WITH([gcc-version],
......@@ -176,7 +178,7 @@
AM_LDFLAGS="${AM_LDFLAGS} -L${DEP_DIR}/lib -L${DEP_DIR}/lib/mysql"
dnl global default INCLUDES
AM_CPPFLAGS="${AM_CPPFLAGS} -I${DEP_DIR}/include -I${DEP_DIR}/include/mysql"
AM_CXXFLAGS="${AM_CXXFLAGS} -I${DEP_DIR}/include -I${DEP_DIR}/include/mariadb -I${RUNTIME_DIR}/include"
if test "X${CXXFLAGS}" = "X-g -O2"; then
CXXFLAGS=""
......@@ -301,7 +303,7 @@
AC_DEFINE_UNQUOTED([RELEASEID], "$RELEASEID")
dnl LDADD
AM_LDFLAGS="${AM_LDFLAGS} -Wl,--allow-multiple-definition"
AM_LDFLAGS="${AM_LDFLAGS} -Wl,--no-as-needed -Wl,--allow-multiple-definition"
BIN_LDFLAGS="-lc -lrt"
if test "X5.2.0" = "X$GCC_VERSION"; then
......
......@@ -5,8 +5,89 @@ unalias -a
PWD="$(cd $(dirname $0); pwd)"
OS_RELEASE="$(grep -Po '(?<=release )\d' /etc/redhat-release)" || exit 1
OS_ARCH="$(uname -p)" || exit 1
OS_ARCH="$(uname -m)" || exit 1
OS_RELEASE="0"
if [[ ! -f /etc/os-release ]]; then
echo "[ERROR] os release info not found" 1>&2 && exit 1
fi
source /etc/os-release || exit 1
PNAME=${PRETTY_NAME:-"${NAME} ${VERSION}"}
PNAME="${PNAME} (${OS_ARCH})"
function compat_centos8() {
echo "[NOTICE] '$PNAME' is compatible with CentOS 8, use el8 dependencies list"
OS_RELEASE=8
}
function compat_centos7() {
echo "[NOTICE] '$PNAME' is compatible with CentOS 7, use el7 dependencies list"
OS_RELEASE=7
}
function not_supported() {
echo "[ERROR] '$PNAME' is not supported yet."
}
function version_ge() {
test "$(awk -v v1=$VERSION_ID -v v2=$1 'BEGIN{print(v1>=v2)?"1":"0"}' 2>/dev/null)" == "1"
}
function get_os_release() {
if [[ "${OS_ARCH}x" == "x86_64x" ]]; then
case "$ID" in
alinux)
version_ge "2.1903" && compat_centos7 && return
;;
alios)
version_ge "8.0" && compat_centos8 && return
version_ge "7.2" && compat_centos7 && return
;;
anolis)
version_ge "8.0" && compat_centos8 && return
version_ge "7.0" && compat_centos7 && return
;;
ubuntu)
version_ge "16.04" && compat_centos7 && return
;;
centos)
version_ge "8.0" && OS_RELEASE=8 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
debian)
version_ge "9" && compat_centos7 && return
;;
fedora)
version_ge "33" && compat_centos7 && return
;;
opensuse-leap)
version_ge "15" && compat_centos7 && return
;;
#suse
sles)
version_ge "15" && compat_centos7 && return
;;
uos)
version_ge "20" && compat_centos7 && return
;;
esac
elif [[ "${OS_ARCH}x" == "aarch64x" ]]; then
case "$ID" in
alios)
version_ge "7.0" && compat_centos7 && return
;;
centos)
version_ge "8.0" && compat_centos7 && return
version_ge "7.0" && OS_RELEASE=7 && return
;;
esac
fi
not_supported && return 1
}
get_os_release || exit 1
OS_TAG="el$OS_RELEASE.$OS_ARCH"
DEP_FILE="obproxy.${OS_TAG}.deps"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册