From b4a62e7e76a6d1dcae0bbfa498d70b335c5b1d67 Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 27 Sep 2024 17:46:27 +0200 Subject: [PATCH] build: release logging variant logging variant rel package should be helpful for debugging. --- CMakeLists.txt | 6 +++++- build.sh | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a99ee4e0..c082f3b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,12 +58,16 @@ else() set(QUIC_ENABLE_LOGGING "OFF") endif() +set(LIBNAME_SUFFIX "") if (DEFINED ENV{QUIC_LOGGING_TYPE}) set(QUIC_ENABLE_LOGGING "ON") set(QUIC_LOGGING_TYPE $ENV{QUIC_LOGGING_TYPE}) if (${QUIC_LOGGING_TYPE} STREQUAL "stdout") add_compile_options(-DQUICER_LOGGING_STDOUT) endif() + if (DEFINED ENV{BUILD_RELEASE}) + set(LIBNAME_SUFFIX "-log${QUIC_LOGGING_TYPE}") + endif() endif() if (DEFINED ENV{QUICER_USE_LTTNG} AND DEFINED ENV{QUICER_USE_SNK}) @@ -184,7 +188,7 @@ add_dependencies(quicer_static msquic) set_target_properties(quicer_nif PROPERTIES - LIBRARY_OUTPUT_NAME quicer_nif + LIBRARY_OUTPUT_NAME quicer_nif${LIBNAME_SUFFIX} VERSION ${QUICER_VERSION} SOVERSION ${QUICER_ABI_VERSION} ) diff --git a/build.sh b/build.sh index 4ee3c0a7..2311d4c8 100755 --- a/build.sh +++ b/build.sh @@ -76,20 +76,24 @@ download() { remove_dups() { cp -L $TARGET_SO ${TARGET_SO}tmp rm ${TARGET_SO}.* + rm ${TARGET_SO}-.* mv ${TARGET_SO}tmp $TARGET_SO } release() { + local variant=${1:-""} if [ -z "$PKGNAME" ]; then echo "unable_to_resolve_release_package_name" exit 1 fi mkdir -p _packages + PKGNAME="$(basename $PKGNAME .gz)${variant}.gz" TARGET_PKG="_packages/${PKGNAME}" tar czvf "$TARGET_PKG" -C $(dirname "$TARGET_SO") \ --exclude include --exclude share --exclude .gitignore \ --exclude lib \ . + #$(basename $TARGET_SO).* # use openssl but not sha256sum command because in some macos env it does not exist if command -v openssl; then openssl dgst -sha256 "${TARGET_PKG}" | cut -d ' ' -f 2 > "${TARGET_PKG}.sha256" @@ -101,6 +105,9 @@ release() { if [ "${BUILD_RELEASE:-}" = 1 ]; then build release + ## build logging type variant + QUIC_LOGGING_TYPE=stdout build + release "logstdout" else if [ "${QUICER_DOWNLOAD_FROM_RELEASE:-0}" = 1 ]; then if ! download; then