mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
Add: init package and build script for cli tool
Signed-off-by: Mervin <mofei2816@gmail.com>
This commit is contained in:
parent
2165991b42
commit
a75fe4d85e
13
Makefile
13
Makefile
@ -6,6 +6,7 @@ BIN_SERVER := $(BIN_PATH)/cfs-server
|
||||
BIN_CLIENT := $(BIN_PATH)/cfs-client
|
||||
BIN_CLIENT2 := $(BIN_PATH)/cfs-client2
|
||||
BIN_AUTHTOOL := $(BIN_PATH)/cfs-authtool
|
||||
BIN_CLI := $(BIN_PATH)/cfs-cli
|
||||
|
||||
COMMON_SRC := build/build.sh Makefile
|
||||
COMMON_SRC += $(wildcard storage/*.go util/*/*.go util/*.go repl/*.go raftstore/*.go proto/*.go)
|
||||
@ -13,6 +14,7 @@ SERVER_SRC := $(wildcard cmd/*.go authnode/*.go datanode/*.go master/*.go metano
|
||||
CLIENT_SRC := $(wildcard client/*.go client/fs/*.go sdk/*.go)
|
||||
CLIENT2_SRC := $(wildcard clientv2/*.go clientv2/fs/*.go sdk/*.go)
|
||||
AUTHTOOL_SRC := $(wildcard authtool/*.go)
|
||||
CLI_SRC := $(wildcard cli/*.go)
|
||||
|
||||
RM := $(shell [ -x /bin/rm ] && echo "/bin/rm -rf" || echo "/usr/bin/rm -rf" )
|
||||
|
||||
@ -21,8 +23,8 @@ default: all
|
||||
phony := all
|
||||
all: build
|
||||
|
||||
phony += build server authtool client client2
|
||||
build: server authtool client
|
||||
phony += build server authtool client client2 cli
|
||||
build: server authtool client cli
|
||||
|
||||
server: $(BIN_SERVER)
|
||||
|
||||
@ -32,7 +34,9 @@ client2: $(BIN_CLIENT2)
|
||||
|
||||
authtool: $(BIN_AUTHTOOL)
|
||||
|
||||
$(BIN_SERVER): $(COMMON_SRC) ${SERVER_SRC}
|
||||
cli: $(BIN_CLI)
|
||||
|
||||
$(BIN_SERVER): $(COMMON_SRC) $(SERVER_SRC)
|
||||
@build/build.sh server
|
||||
|
||||
$(BIN_CLIENT): $(COMMON_SRC) $(CLIENT_SRC)
|
||||
@ -44,6 +48,9 @@ $(BIN_CLIENT2): $(COMMON_SRC) $(CLIENT2_SRC)
|
||||
$(BIN_AUTHTOOL): $(COMMON_SRC) $(AUTHTOOL_SRC)
|
||||
@build/build.sh authtool
|
||||
|
||||
$(BIN_CLI): $(COMMON_SRC) $(CLI_SRC)
|
||||
@build/build.sh cli
|
||||
|
||||
phony += clean
|
||||
clean:
|
||||
@$(RM) build/bin
|
||||
|
||||
@ -19,7 +19,14 @@ GCC_LIBRARY_PATH="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib6
|
||||
cgo_cflags=""
|
||||
cgo_ldflags="-lstdc++ -lm"
|
||||
|
||||
[ $(uname -s) != "Linux" ] && { echo "ChubaoFS only support Linux os"; exit 1; }
|
||||
case $(uname -s | tr 'A-Z' 'a-z') in
|
||||
"linux"|"darwin")
|
||||
;;
|
||||
*)
|
||||
echo "Current platform $(uname -s) not support";
|
||||
exit1;
|
||||
;;
|
||||
esac
|
||||
|
||||
build_snappy() {
|
||||
found=$(find ${GCC_LIBRARY_PATH} -name libsnappy.a -o -name libsnappy.so 2>/dev/null | wc -l)
|
||||
@ -101,7 +108,7 @@ run_test() {
|
||||
build_server() {
|
||||
pre_build
|
||||
pushd $SrcPath >/dev/null
|
||||
echo -n "build cfs-server "
|
||||
echo -n "build cfs-server "
|
||||
go build $MODFLAGS -ldflags "${LDFlags}" -o ${BuildBinPath}/cfs-server ${SrcPath}/cmd/*.go && echo "success" || echo "failed"
|
||||
popd >/dev/null
|
||||
}
|
||||
@ -109,7 +116,7 @@ build_server() {
|
||||
build_client() {
|
||||
pre_build
|
||||
pushd $SrcPath >/dev/null
|
||||
echo -n "build cfs-client "
|
||||
echo -n "build cfs-client "
|
||||
go build $MODFLAGS -ldflags "${LDFlags}" -o ${BuildBinPath}/cfs-client ${SrcPath}/client/*.go && echo "success" || echo "failed"
|
||||
popd >/dev/null
|
||||
}
|
||||
@ -117,7 +124,7 @@ build_client() {
|
||||
build_client2() {
|
||||
pre_build
|
||||
pushd $SrcPath >/dev/null
|
||||
echo -n "build cfs-client2 "
|
||||
echo -n "build cfs-client2 "
|
||||
go build $MODFLAGS -ldflags "${LDFlags}" -o ${BuildBinPath}/cfs-client2 ${SrcPath}/clientv2/*.go && echo "success" || echo "failed"
|
||||
popd >/dev/null
|
||||
}
|
||||
@ -130,6 +137,14 @@ build_authtool() {
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
build_cli() {
|
||||
pre_build
|
||||
pushd $SrcPath >/dev/null
|
||||
echo -n "build cfs-cli "
|
||||
go build $MODFLAGS -ldflags "${LDFlags}" -o ${BuildBinPath}/cfs-cli ${SrcPath}/cli/*.go && echo "success" || echo "failed"
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
clean() {
|
||||
rm -rf ${BuildBinPath}
|
||||
}
|
||||
@ -161,6 +176,9 @@ case "$cmd" in
|
||||
"authtool")
|
||||
build_authtool
|
||||
;;
|
||||
"cli")
|
||||
build_cli
|
||||
;;
|
||||
"clean")
|
||||
clean
|
||||
;;
|
||||
|
||||
19
cli/main.go
Normal file
19
cli/main.go
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2018 The Chubao Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// permissions and limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
func main() {
|
||||
|
||||
}
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2018 The Chubao Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// permissions and limitations under the License.
|
||||
|
||||
package mocktest
|
||||
|
||||
import (
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2018 The Chubao Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// permissions and limitations under the License.
|
||||
|
||||
package mocktest
|
||||
|
||||
import (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user