Skip to content

Commit d269b69

Browse files
feat(build): add progress output to config_brpc.sh (#3262)
The configuration script previously ran silently with no visible output, making it hard to tell whether it was working or what it detected. Add colored progress messages for each stage: system info, dependency discovery, output file generation, and a final configuration summary.
1 parent e9ada57 commit d269b69

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

config_brpc.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
BOLD='\033[1m'
19+
GREEN='\033[0;32m'
20+
YELLOW='\033[0;33m'
21+
CYAN='\033[0;36m'
22+
NC='\033[0m' # No Color
23+
24+
print_info() {
25+
printf "${CYAN}[INFO]${NC} %s\n" "$1"
26+
}
27+
print_success() {
28+
printf "${GREEN}[OK]${NC} %s\n" "$1"
29+
}
30+
print_step() {
31+
printf "${BOLD}==> %s${NC}\n" "$1"
32+
}
33+
1834
SYSTEM=$(uname -s)
1935
if [ "$SYSTEM" = "Darwin" ]; then
2036
if [ -z "$BASH" ] || [ "$BASH" = "/bin/sh" ] ; then
@@ -83,6 +99,10 @@ while true; do
8399
esac
84100
done
85101

102+
print_step "Configuring brpc (${SYSTEM})"
103+
print_info "Headers path: ${HDRS_IN}"
104+
print_info "Libs path: ${LIBS_IN}"
105+
86106
if [ -z "$CC" ]; then
87107
if [ ! -z "$CXX" ]; then
88108
>&2 $ECHO "--cc and --cxx must be both set or unset"
@@ -99,6 +119,8 @@ elif [ -z "$CXX" ]; then
99119
exit 1
100120
fi
101121

122+
print_info "CC=$CC, CXX=$CXX"
123+
102124
GCC_VERSION=$(CXX=$CXX tools/print_gcc_version.sh)
103125
if [ $GCC_VERSION -gt 0 ] && [ $GCC_VERSION -lt 40800 ]; then
104126
>&2 $ECHO "GCC is too old, please install a newer version supporting C++11"
@@ -175,11 +197,14 @@ if [ "$SYSTEM" = "Darwin" ]; then
175197
fi
176198
fi
177199

200+
print_step "Checking dependencies"
201+
178202
# User specified path of openssl, if not given it's empty
179203
OPENSSL_LIB=$(find_dir_of_lib ssl)
180204
# Inconvenient to check these headers in baidu-internal
181205
#PTHREAD_HDR=$(find_dir_of_header_or_die pthread.h)
182206
OPENSSL_HDR=$(find_dir_of_header_or_die openssl/ssl.h mesalink/openssl/ssl.h)
207+
print_success "Found openssl: lib=${OPENSSL_LIB:-system}, hdr=${OPENSSL_HDR}"
183208

184209
if [ $WITH_MESALINK != 0 ]; then
185210
MESALINK_HDR=$(find_dir_of_header_or_die mesalink/openssl/ssl.h)
@@ -228,11 +253,14 @@ append_linking() {
228253

229254
GFLAGS_LIB=$(find_dir_of_lib_or_die gflags)
230255
append_linking $GFLAGS_LIB gflags
256+
print_success "Found gflags: $GFLAGS_LIB"
231257

232258
PROTOBUF_LIB=$(find_dir_of_lib_or_die protobuf)
233259
append_linking $PROTOBUF_LIB protobuf
260+
print_success "Found protobuf: $PROTOBUF_LIB"
234261

235262
LEVELDB_LIB=$(find_dir_of_lib_or_die leveldb)
263+
print_success "Found leveldb: $LEVELDB_LIB"
236264
# required by leveldb
237265
if [ -f $LEVELDB_LIB/libleveldb.a ]; then
238266
if [ -f $LEVELDB_LIB/libleveldb.$SO ]; then
@@ -261,6 +289,7 @@ else
261289
fi
262290

263291
PROTOC=$(find_bin_or_die protoc)
292+
print_success "Found protoc: $PROTOC"
264293

265294
GFLAGS_HDR=$(find_dir_of_header_or_die gflags/gflags.h)
266295

@@ -348,8 +377,10 @@ if [ "$PROTOBUF_VERSION" -ge 4022000 ]; then
348377
fi
349378
done
350379
CXXFLAGS="-std=c++17"
380+
print_success "Found protobuf version $PROTOBUF_VERSION (>= v22, using C++17 with abseil)"
351381
else
352382
CXXFLAGS="-std=c++0x"
383+
print_success "Found protobuf version $PROTOBUF_VERSION"
353384
fi
354385

355386
CPPFLAGS=
@@ -606,5 +637,22 @@ cat << EOF > src/butil/config.h
606637
#endif // BUTIL_CONFIG_H
607638
EOF
608639

640+
print_step "Generating output files"
641+
609642
# write to config.mk
610643
$ECHO "$OUTPUT_CONTENT" > config.mk
644+
print_success "Generated config.mk"
645+
print_success "Generated src/butil/config.h"
646+
647+
printf "\n"
648+
print_step "Configuration complete"
649+
print_info "Compiler: $CC / $CXX"
650+
print_info "C++ std: $CXXFLAGS"
651+
print_info "System: $SYSTEM"
652+
if [ $WITH_GLOG -ne 0 ]; then print_info "With glog: yes"; fi
653+
if [ $WITH_THRIFT -ne 0 ]; then print_info "With thrift: yes"; fi
654+
if [ $WITH_RDMA -ne 0 ]; then print_info "With RDMA: yes"; fi
655+
if [ $WITH_MESALINK -ne 0 ]; then print_info "With MesaLink: yes"; fi
656+
if [ $WITH_BTHREAD_TRACER -ne 0 ]; then print_info "With bthread tracer: yes"; fi
657+
if [ $WITH_ASAN -ne 0 ]; then print_info "With ASAN: yes"; fi
658+
printf "\n${GREEN}brpc is now configured. You can build it with 'make'.${NC}\n"

0 commit comments

Comments
 (0)