Skip to content

Commit

Permalink
Wording.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Dec 8, 2023
1 parent 051ec60 commit 7458d4a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-static-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env:
IMAGE_TYPE: test
CMAKE_UNITY_BUILD: ON
BUILD_STATIC_RELEASE: ON
BUILD_STATIC_RELEASE_SANS_GLIBC: ON
ENABLE_TEST_TOOLS: ON
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ OPTION (ENABLE_MULTITHREAD "Use multithreading" OFF)
OPTION (ENABLE_LTO "Enable Link Time Optimization (LTO)" OFF)
OPTION (ENABLE_WERROR "Treat warnings as errors" OFF)
OPTION (ENABLE_SANITIZERS "Enable sanitizers" OFF)
OPTION (BUILD_STATIC_RELEASE "Build a statically linked release binary" OFF)
# TODO: Keep track of https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
# and see whether static linking improves on Linux.
option(BUILD_STATIC_RELEASE_SANS_GLIBC
"Build a (mostly) statically linked release binary. Glibc is linked dynamically." OFF
)
OPTION (BUILD_AUTO_VAR_INIT_PATTERN "Initialize variables with pattern during build" OFF)
OPTION (ENABLE_IWYU "Enable checking includes with IWYU" OFF)
# Support a legacy option. TODO: Remove?
Expand Down Expand Up @@ -117,7 +121,7 @@ endif ()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Set the required options for a (mostly) static release build.
if(BUILD_STATIC_RELEASE)
if(BUILD_STATIC_RELEASE_SANS_GLIBC)
message(STATUS "Building static release binaries")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
Expand Down Expand Up @@ -282,7 +286,7 @@ endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# We want to optimize the binary size for a static release binary.
# This only works with modern versions of GCC.
if (BUILD_STATIC_RELEASE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
if (BUILD_STATIC_RELEASE_SANS_GLIBC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
if (BUILD_LINK_WITH_LLD)
message(WARNING "LLD does not work with GCC's LTO object format, switching to Gold.")
set(BUILD_LINK_WITH_LLD OFF)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARG CMAKE_UNITY_BUILD=ON
ARG VALIDATION=OFF
# This creates a release build that includes link time optimization and links
# all libraries statically.
ARG BUILD_STATIC_RELEASE=OFF
ARG BUILD_STATIC_RELEASE_SANS_GLIBC=OFF
# No questions asked during package installation.
ARG DEBIAN_FRONTEND=noninteractive
# Whether to install dependencies required to run PTF-ebpf tests
Expand Down
4 changes: 2 additions & 2 deletions tools/ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ P4C_DIR=$(readlink -f ${THIS_DIR}/..)
: "${VALIDATION:=OFF}"
# This creates a release build that includes link time optimization and links
# all libraries statically.
: "${BUILD_STATIC_RELEASE:=OFF}"
: "${BUILD_STATIC_RELEASE_SANS_GLIBC:=OFF}"
# No questions asked during package installation.
: "${DEBIAN_FRONTEND:=noninteractive}"
# Whether to install dependencies required to run PTF-ebpf tests
Expand Down Expand Up @@ -236,7 +236,7 @@ export CXXFLAGS="${CXXFLAGS} -O3"
# Toggle unity compilation.
CMAKE_FLAGS+="-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} "
# Toggle static builds.
CMAKE_FLAGS+="-DBUILD_STATIC_RELEASE=${BUILD_STATIC_RELEASE} "
CMAKE_FLAGS+="-DBUILD_STATIC_RELEASE_SANS_GLIBC=${BUILD_STATIC_RELEASE_SANS_GLIBC} "
# Toggle the installation of the tools back end.
CMAKE_FLAGS+="-DENABLE_TEST_TOOLS=${ENABLE_TEST_TOOLS} "
# RELEASE should be default, but we want to make sure.
Expand Down
2 changes: 1 addition & 1 deletion tools/debian-build/packaging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CONFOPT+="-DCMAKE_UNITY_BUILD=ON "
# RELEASE should be default, but we want to make sure.
CONFOPT+="-DCMAKE_BUILD_TYPE=RELEASE "
# The binaries we produce should not depend on system libraries.
CONFOPT+="-DBUILD_STATIC_RELEASE=ON "
CONFOPT+="-DBUILD_STATIC_RELEASE_SANS_GLIBC=ON "
MAKE_DIST="cd ${P4C_DIR}/backends/ebpf && ./build_libbpf && mkdir -p ${P4C_DIR}/build && cd ${P4C_DIR}/build && cmake .. $CONFOPT && make && make dist"
# Distributions which are *not* supported!
NOT_TARGET_DISTRIBUTIONS="lucid precise trusty xenial bionic"
Expand Down

0 comments on commit 7458d4a

Please sign in to comment.