Skip to content

Commit

Permalink
add build rpm logic
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzelin19961202 committed Mar 15, 2022
1 parent c9d4ae0 commit 1c05ac1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
17 changes: 9 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion deps/3rd/obproxy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions rpm/obproxy-ce-VER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.0
18 changes: 18 additions & 0 deletions rpm/obproxy-ce-build.sh
Original file line number Diff line number Diff line change
@@ -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 \;

0 comments on commit 1c05ac1

Please sign in to comment.