Skip to content

Commit

Permalink
Merge pull request #228 from chaoticgd/glibc
Browse files Browse the repository at this point in the history
Provide glibc-based Linux builds in addition to musl-based builds
  • Loading branch information
chaoticgd authored Aug 10, 2024
2 parents 3a70a2e + 38a8b4d commit 5e70a8e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 27 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:

env:
BUILD_TYPE: Release
BUILD_STATIC: false

jobs:
build:
runs-on: ${{ matrix.sys.os }}
strategy:
matrix:
sys:
- { os: windows-latest, shell: pwsh }
- { os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { os: macos-latest, shell: bash }
- { name: linux-glibc, os: ubuntu-latest, shell: bash }
- { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { name: windows, os: windows-latest, shell: pwsh }
- { name: mac, os: macos-latest, shell: bash }
defaults:
run:
shell: ${{ matrix.sys.shell }}
Expand All @@ -29,7 +29,7 @@ jobs:

- name: Setup latest Alpine Linux
uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d
if: ${{ matrix.sys.os == 'ubuntu-latest' }}
if: ${{ matrix.sys.name == 'linux-musl' }}
with:
arch: x86_64
packages: >
Expand All @@ -46,8 +46,8 @@ jobs:

- name: Configure CMake
env:
BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}} -DZIP_RELEASE=1
USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}} -DZIP_RELEASE=1

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ on:

env:
BUILD_TYPE: Release
BUILD_STATIC: false

jobs:
build:
runs-on: ${{ matrix.sys.os }}
strategy:
matrix:
sys:
- { os: windows-latest, shell: pwsh }
- { os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { os: macos-latest, shell: bash }
- { name: linux-glibc, os: ubuntu-latest, shell: bash }
- { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { name: windows, os: windows-latest, shell: pwsh }
- { name: mac, os: macos-latest, shell: bash }
defaults:
run:
shell: ${{ matrix.sys.shell }}
Expand All @@ -30,7 +30,7 @@ jobs:

- name: Setup latest Alpine Linux
uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d
if: ${{ matrix.sys.os == 'ubuntu-latest' }}
if: ${{ matrix.sys.name == 'linux-musl' }}
with:
arch: x86_64
packages: >
Expand All @@ -47,8 +47,8 @@ jobs:

- name: Configure CMake
env:
BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}}
USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ on:

env:
BUILD_TYPE: Release
BUILD_STATIC: false

jobs:
build:
runs-on: ${{ matrix.sys.os }}
strategy:
matrix:
sys:
- { os: windows-latest, shell: pwsh }
- { os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { os: macos-latest, shell: bash }
- { name: linux-glibc, os: ubuntu-latest, shell: bash }
- { name: linux-musl, os: ubuntu-latest, shell: 'alpine.sh --root {0}' }
- { name: windows, os: windows-latest, shell: pwsh }
- { name: mac, os: macos-latest, shell: bash }
defaults:
run:
shell: ${{ matrix.sys.shell }}
Expand All @@ -28,7 +28,7 @@ jobs:

- name: Setup latest Alpine Linux
uses: jirutka/setup-alpine@39d2d96fa8e4b713be89c0239a5c3b9a0f49838d
if: ${{ matrix.sys.os == 'ubuntu-latest' }}
if: ${{ matrix.sys.name == 'linux-musl' }}
with:
arch: x86_64
packages: >
Expand All @@ -45,8 +45,8 @@ jobs:

- name: Configure CMake
env:
BUILD_STATIC: ${{ matrix.sys.os == 'ubuntu-latest' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=${{env.BUILD_STATIC}} -DZIP_RELEASE=1
USE_MUSL_LIBC: ${{ matrix.sys.name == 'linux-musl' }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_MUSL_LIBC=${{env.USE_MUSL_LIBC}} -DZIP_RELEASE=1

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

## v2.1

- The offsets of stack variables will now be relative to the value of the stack pointer register for the current function rather than the caller by default.
- Stack variable offsets will now be relative to the value of the stack pointer register for the current function.
- Variable symbols are no longer incorrectly deduplicated as if they were types.
- The static keyword is no longer missing from the output for static global variables.
- Structs defined inside global variable definitions are now printed with the correct C++ syntax.
- Fixed an issue where in some cases null addresses would be handled incorrectly.
- Glibc-based Linux builds are now provided in addition to musl-based builds.
- stdump: Added `--procedures` option.
- stdump: Added `--sort-by-address` option.
- stdump: Added `--caller-stack-offsets` option.
Expand Down
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(BUILD_STATIC)
if(USE_MUSL_LIBC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()

if(MSVC)
# TODO
else()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-O3 -ggdb -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall")
add_link_options($<$<CONFIG:RELEASE>:-s>)
Expand Down
11 changes: 10 additions & 1 deletion cmake/release_crafter.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ if(ZIP_RELEASE)
set(RELEASE_VERSION ${GIT_TAG})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(RELEASE_OS "linux")
if(USE_MUSL_LIBC)
set(RELEASE_OS "linux-musl")
else()
execute_process(
COMMAND bash -c "ldd --version | sed -n 's/ldd (Ubuntu GLIBC //p' | sed 's/).*//'"
OUTPUT_VARIABLE GLIBC_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(RELEASE_OS "linux-glibc${GLIBC_VERSION_STRING}")
endif()
elseif(APPLE)
set(RELEASE_OS "mac")
elseif(WIN32)
Expand Down

0 comments on commit 5e70a8e

Please sign in to comment.