diff --git a/build.sh b/build.sh index c93bc75a43cec6388d41ad0378bf49a16f6d17dd..39a56da3c60675d01974cb856c51c3e86534ec8d 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,13 @@ DEP_DIR=${TOPDIR}/deps/3rd/usr/local/oceanbase/deps/devel TOOLS_DIR=${TOPDIR}/deps/3rd/usr/local/oceanbase/devtools RUNTIME_DIR=${TOPDIR}/deps/3rd/usr CPU_CORES=`grep -c ^processor /proc/cpuinfo` -MAKE_ARGS=(-j $CPU_CORES) +MAKE_ARGS="-j $CPU_CORES" + +PACKAGE=${2:-obproxy-ce} +VERSION=${3:-`cat rpm/${PACKAGE}-VER.txt`} +RELEASE=${4:-1} +PREFIX=/home/admin/obproxy +SPEC_FILE=obproxy.spec function sw() { @@ -35,7 +41,7 @@ function do_init() function do_dep_init() { - (cd $TOPDIR/deps/3rd && bash dep_create.sh) + cd $TOPDIR/deps/3rd && bash dep_create.sh cd $TOPDIR do_init } @@ -83,18 +89,13 @@ function do_make() { set -x sw - make "${MAKE_ARGS[@]}" + make $MAKE_ARGS } function do_rpm() { set -x sw - PACKAGE=obproxy-ce - VERSION=3.2.0 - RELEASE=1 - PREFIX=/home/admin/obproxy - SPEC_FILE=obproxy.spec echo "[BUILD] make dist..." make dist-gzip || exit 1 diff --git a/deps/3rd/obproxy.spec b/deps/3rd/obproxy.spec index 9c39676a505526b4fa608241442f141b0a980900..2d88e8dccd57664873168b646c3dc44d80a06609 100644 --- a/deps/3rd/obproxy.spec +++ b/deps/3rd/obproxy.spec @@ -36,7 +36,9 @@ OceanBase Database Proxy %build ./configure CXX=${CXX} CC=${CC} --with-gcc-version=5.2.0 RELEASEID=%{RELEASE} --prefix=%{_prefix} --with-test-case=no --with-release=yes --with-tblib-root=/opt/csr/common --with-easy-root=/usr --with-easy-lib-path=/usr/lib64 --with-svnfile --enable-shared=default --enable-silent-rules mkdir -p unittest -make %{?_smp_mflags} +CPU_CORES=`grep -c ^processor /proc/cpuinfo` +MAKE_ARGS="-j $CPU_CORES" +make $MAKE_ARGS %install make DESTDIR=$RPM_BUILD_ROOT install diff --git a/rpm/obproxy-ce-VER.txt b/rpm/obproxy-ce-VER.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4f52a5dbb5a6ad929239d21c3c77812a5862540 --- /dev/null +++ b/rpm/obproxy-ce-VER.txt @@ -0,0 +1 @@ +3.2.0 \ No newline at end of file diff --git a/rpm/obproxy-ce-build.sh b/rpm/obproxy-ce-build.sh new file mode 100644 index 0000000000000000000000000000000000000000..68a70106c148d7b9c548d1d104561a687a205ec1 --- /dev/null +++ b/rpm/obproxy-ce-build.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# use by rpm build platform + +SCRIPT_DIR=$(cd "$(dirname "$0")";pwd) +TOP_DIR=${1:-${SCRIPT_DIR}/../} +PACKAGE=$2 +VERSION=$3 +RELEASE=$4 + +# prepare rpm build dirs +cd $TOP_DIR +sh build.sh clean + +# build rpm +cd $TOP_DIR +sh build.sh rpm $PACKAGE $VERSION $RELEASE + +find $TOP_DIR/ -name "*.rpm" -maxdepth 1 -exec mv {} $SCRIPT_DIR 2>/dev/null \; \ No newline at end of file