Skip to content

Commit

Permalink
Merge pull request cubefs#1108 from shuoranliu/fix-libsdk-make-issue
Browse files Browse the repository at this point in the history
Fix libsdk make issue
  • Loading branch information
shuoranliu authored Feb 10, 2021
2 parents b43e2db + 47129c7 commit ecef527
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ tmp/
docker/log
console/html
vendor/dep
java/target
java/src/main/resources/*.so
14 changes: 7 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ get_rocksdb_compress_dep() {
tar zxf bzip2-1.0.6.tar.gz
fi

if [ ! -d "${RootPath}/vendor/dep/zstd-1.4.5" ]; then
wget https://codeload.github.com/facebook/zstd/zip/v1.4.5
unzip v1.4.5
if [ ! -d "${RootPath}/vendor/dep/zstd-1.4.8" ]; then
wget https://codeload.github.com/facebook/zstd/zip/v1.4.8
unzip v1.4.8
fi

if [ ! -d "${RootPath}/vendor/dep/lz4-1.9.2" ]; then
wget https://codeload.github.com/lz4/lz4/tar.gz/v1.9.2
tar zxf v1.9.2
if [ ! -d "${RootPath}/vendor/dep/lz4-1.9.3" ]; then
wget https://codeload.github.com/lz4/lz4/tar.gz/v1.9.3
tar zxf v1.9.3
fi


#rm -rf zlib-1.2.11.tar.gz bzip2-1.0.6.tar.gz v1.4.5 v1.9.2
#rm -rf zlib-1.2.11.tar.gz bzip2-1.0.6.tar.gz v1.4.8 v1.9.3
cd ${RootPath}


Expand Down
19 changes: 14 additions & 5 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ build_bzip2() {
}

build_lz4() {
ZstdSrcPath=${VendorPath}/dep/lz4-1.9.2
ZstdSrcPath=${VendorPath}/dep/lz4-1.9.3
ZstdBuildPath=${BuildOutPath}/lz4
found=$(find ${ZstdBuildPath}/lib -name liblz4.a 2>/dev/null | wc -l)
if [ ${found} -eq 0 ] ; then
Expand All @@ -113,7 +113,7 @@ build_lz4() {

# dep zlib,bz2,lz4
build_zstd() {
ZstdSrcPath=${VendorPath}/dep/zstd-1.4.5
ZstdSrcPath=${VendorPath}/dep/zstd-1.4.8
ZstdBuildPath=${BuildOutPath}/zstd
found=$(find ${ZstdBuildPath}/lib -name libzstd.a 2>/dev/null | wc -l)
if [ ${found} -eq 0 ] ; then
Expand Down Expand Up @@ -288,18 +288,27 @@ build_cli() {
}

build_libsdk() {
pre_build_server
case `uname` in
Linux)
TargetFile=${1:-${SrcPath}/libsdk.so}
TargetFile=${1:-${BuildBinPath}/libcfs.so}
;;
*)
echo "Unsupported platform"
exit 0
;;
esac
pushd $SrcPath >/dev/null
echo -n "build libsdk "
go build $MODFLAGS -ldflags "${LDFlags}" -buildmode c-shared -o ${BuildBinPath}/$TargetFile ${SrcPath}/*.go && echo "success" | echo "failed"
echo -n "build libsdk: libcfs.so "
go build $MODFLAGS -ldflags "${LDFlags}" -buildmode c-shared -o ${TargetFile} ${SrcPath}/libsdk/*.go && echo "success" || echo "failed"
popd >/dev/null

pushd $SrcPath/java >/dev/null
echo -n "build java libchubaofs "
mkdir -p $SrcPath/java/src/main/resources/
\cp -rf ${TargetFile} $SrcPath/java/src/main/resources/
mvn clean package
\cp -rf $SrcPath/java/target/*.jar ${BuildBinPath} && echo "build java libchubaofs success" || echo "build java libchubaofs failed"
popd >/dev/null
}

Expand Down
11 changes: 11 additions & 0 deletions docker/script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ else
failed=1
fi

echo -n 'Building ChubaoFS libsdk ... ';
cd /go/src/github.com/chubaofs/chubaofs/libsdk;
bash ./build.sh &>> /tmp/cfs_build_output;
if [[ $? -eq 0 ]]; then
echo -e "\033[32mdone\033[0m";
mv libcfs.so /go/src/github.com/chubaofs/chubaofs/docker/bin/;
else
echo -e "\033[31mfail\033[0m";
failed=1
fi

if [[ ${failed} -eq 1 ]]; then
echo -e "\nbuild output:"
cat /tmp/cfs_build_output;
Expand Down

0 comments on commit ecef527

Please sign in to comment.