Skip to content

Commit 79cfd71

Browse files
committed
Linking against legacy libc <= 2.15
1 parent 30572ef commit 79cfd71

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929
with:
3030
fetch-depth: 0
3131

3232
- name: Setup MSBuild
33-
uses: microsoft/setup-msbuild@v1.1.3
33+
uses: microsoft/setup-msbuild@v2
3434
with:
3535
vs-version: '16.8'
3636

@@ -58,13 +58,14 @@ jobs:
5858
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
5959
6060
- name: Deploy artifacts
61-
uses: actions/upload-artifact@v3.1.1
61+
uses: actions/upload-artifact@v4
6262
with:
6363
name: win32
6464
path: publish/*
6565

6666
testdemos:
67-
name: 'Test demos'
67+
if: false # TODO: FIXME!!
68+
name: 'Test demos (FIXME)'
6869
runs-on: ubuntu-20.04
6970
container: s1lentq/testdemos:latest
7071
needs: [windows]
@@ -80,7 +81,7 @@ jobs:
8081

8182
steps:
8283
- name: Deploying windows artifacts
83-
uses: actions/download-artifact@v3
84+
uses: actions/download-artifact@v2
8485
with:
8586
name: win32
8687

@@ -136,7 +137,7 @@ jobs:
136137

137138
steps:
138139
- name: Checkout
139-
uses: actions/checkout@v3
140+
uses: actions/checkout@v4
140141
with:
141142
fetch-depth: 0
142143
submodules: true
@@ -173,7 +174,7 @@ jobs:
173174

174175
- name: Build using Clang C++ Compiler
175176
run: |
176-
rm -rf build && CC=clang CXX=clang++ cmake -B build && cmake --build build -j8
177+
rm -rf build && CC=clang CXX=clang++ cmake -DUSE_LEGACY_LIBC=ON -B build && cmake --build build -j8
177178
178179
- name: Prepare CSSDK
179180
run: |
@@ -199,7 +200,7 @@ jobs:
199200
shell: bash
200201

201202
- name: Deploy artifacts
202-
uses: actions/upload-artifact@v3.1.1
203+
uses: actions/upload-artifact@v4
203204
id: upload-job
204205
with:
205206
name: linux32
@@ -213,17 +214,17 @@ jobs:
213214
214215
publish:
215216
name: 'Publish'
216-
runs-on: ubuntu-20.04
217+
runs-on: ubuntu-latest
217218
needs: [windows, testdemos, linux]
218219

219220
steps:
220221
- name: Deploying linux artifacts
221-
uses: actions/download-artifact@v3
222+
uses: actions/download-artifact@v6
222223
with:
223224
name: linux32
224225

225226
- name: Deploying windows artifacts
226-
uses: actions/download-artifact@v3
227+
uses: actions/download-artifact@v6
227228
with:
228229
name: win32
229230

@@ -253,7 +254,7 @@ jobs:
253254
7z a -tzip regamedll-bin-${{ env.APP_VERSION }}.zip bin/ cssdk/
254255
255256
- name: Publish artifacts
256-
uses: softprops/action-gh-release@v1
257+
uses: softprops/action-gh-release@v2
257258
id: publish-job
258259
if: |
259260
startsWith(github.ref, 'refs/tags/') &&

regamedll/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ project(regamedll CXX)
2222

2323
option(DEBUG "Build with debug information." OFF)
2424
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
25+
option(USE_LEGACY_LIBC "Enables linking against legacy libc (<= 2.15) for compat with older distros (Debian 8/Ubuntu 16.04/Centos 7)." OFF)
2526

2627
set(CMAKE_CXX_STANDARD 14)
2728
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -32,6 +33,7 @@ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
3233

3334
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
3435
set(LINK_FLAGS "-m32 -s")
36+
set(LINK_LIBS dl aelf32)
3537

3638
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-builtin -Wno-unknown-pragmas")
3739

@@ -362,12 +364,13 @@ target_sources(regamedll PRIVATE
362364
${UNITTESTS_SRCS}>
363365
)
364366

365-
target_link_libraries(regamedll PRIVATE
366-
dl
367-
aelf32
367+
if (CMAKE_BUILD_TYPE MATCHES Unittests)
368+
list(APPEND LINK_LIBS cppunitlite)
369+
elseif (USE_LEGACY_LIBC)
370+
list(APPEND LINK_LIBS libc-2.15.so)
371+
endif()
368372

369-
$<$<CONFIG:Unittests>:cppunitlite>
370-
)
373+
target_link_libraries(regamedll PRIVATE ${LINK_LIBS})
371374

372375
if (USE_STATIC_LIBSTDC)
373376
target_compile_definitions(regamedll PRIVATE BUILD_STATIC_LIBSTDC)

regamedll/lib/linux32/libc-2.15.so

1.63 MB
Binary file not shown.

0 commit comments

Comments
 (0)