Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add official build flag #1054

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(YASS_APP_FEATURES)

option(OFFICIAL_BUILD "Build with official build" OFF)

if (OFFICIAL_BUILD)
list(APPEND YASS_APP_FEATURES "official-build")
add_definitions(-DOFFICIAL_BUILD)
endif()

if(MSVC)
# On Windows, prefer cl over gcc if both are available. By default most of
# the CMake generators prefer gcc, even on Windows.
Expand Down
3 changes: 3 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export GOPROXY
# In compat 13 and later, The variables HOME will be set to a writable directory
export HOME=/tmp

# mark as official build
CMAKE_OPTIONS += -DOFFICIAL_BUILD=on

CMAKE_OPTIONS += ${CMAKE_CROSS_TOOLCHAIN_FLAGS_NATIVE}

# this fix is required before debhelper 11.4
Expand Down
21 changes: 19 additions & 2 deletions third_party/libc++/__assertion_handler
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,24 @@
# pragma GCC system_header
#endif

// TODO(hardening): in production, trap rather than abort.
#define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
// Based on CHECK_WILL_STREAM() defined in base/check.h
#if defined(NDEBUG) && defined(OFFICIAL_BUILD)

_LIBCPP_BEGIN_NAMESPACE_STD

_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __libcpp_hardening_failure() {
__builtin_trap();
}

_LIBCPP_END_NAMESPACE_STD

// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, ::std::__libcpp_hardening_failure())

#else

# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)

#endif // defined(NDEBUG) && defined(OFFICIAL_BUILD)

#endif // _LIBCPP___ASSERTION_HANDLER
1 change: 1 addition & 0 deletions tools/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ func buildStageGenerateBuildScript() {
glog.Infof("Using compiler %s", _clangPath)
}
}
cmakeArgs = append(cmakeArgs, "-DOFFICIAL_BUILD=on")
cmakeArgs = append(cmakeArgs, "-DENABLE_LLD=on")
cmakeArgs = append(cmakeArgs, "-DGUI=ON", "-DCLI=ON", "-DSERVER=ON")
cmakeArgs = append(cmakeArgs, fmt.Sprintf("-DCMAKE_BUILD_TYPE=%s", cmakeBuildTypeFlag))
Expand Down
2 changes: 1 addition & 1 deletion yass.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ for embedded devices and low end boxes.
mkdir build
cd build
# old c-ares doesn't contain ares_getaddrinfo api
%cmake_alias -G Ninja -DCMAKE_BUILD_TYPE=Release \
%cmake_alias -G Ninja -DOFFICIAL_BUILD=on -DCMAKE_BUILD_TYPE=Release \
-DBUILD_BENCHMARKS=on -DBUILD_TESTS=on \
-DUSE_QT6="%enable_use_qt6_opt" -DUSE_QT5="%enable_use_qt5_opt" \
-DUSE_GTK4="%enable_use_gtk4_opt" -DGUI=on \
Expand Down
Loading