Skip to content

Commit 1afcb71

Browse files
authored
Merge pull request #193 from OpenBrickProtocolFoundation/support_musl
CI: Support musl libc
2 parents a88c9dc + 0c0f907 commit 1afcb71

File tree

5 files changed

+83
-2
lines changed

5 files changed

+83
-2
lines changed

.github/workflows/musl.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: musl CI
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.config.name }}
12+
runs-on: ubuntu-24.04
13+
container: alpine:3.20
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
config:
19+
- name: Linux (musl)
20+
use-clang: false
21+
22+
- name: Linux Clang (musl, libstdc++)
23+
use-clang: true
24+
use-clang_stdlib: false
25+
26+
- name: Linux Clang (musl, libc++)
27+
use-clang: true
28+
use-clang_stdlib: true
29+
30+
31+
steps:
32+
- name: Install dependencies
33+
run: |
34+
apk update
35+
apk add wget meson ca-certificates samurai git openssl-dev openssl pkgconf sdl2 sdl2-dev sdl2_mixer-dev sdl2_ttf-dev sdl2_mixer-dev sdl2_image-dev dbus-dev patchelf ${{ ( matrix.config.use-clang == true ) && 'clang18' || 'gcc g++' }} ${{ ( matrix.config.use-clang == true && matrix.config.use-clang_stdlib == true ) && 'libc++ libc++-dev' || '' }}
36+
echo "CC=${{ matrix.config.use-clang == true && 'clang-18' || 'gcc' }}" >> "$GITHUB_ENV"
37+
echo "CXX=${{ matrix.config.use-clang == true && 'clang++-18' || 'g++' }}" >> "$GITHUB_ENV"
38+
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: '0'
42+
43+
- name: Configure
44+
run: meson setup build -Dbuildtype=release -Ddefault_library=shared -Dclang_libcpp=${{ ( matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) && 'enabled' || 'disabled' }}
45+
46+
- name: Build
47+
run: meson compile -C build
48+
49+
- name: Upload artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: ${{ matrix.config.name }} Executable
53+
path: build/src/executables/oopetris*

subprojects/packagefiles/discord_game_sdk/cpp/meson.build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,34 @@ elif host_machine.system() == 'linux'
5656
dynamic_lib = 'discord_game_sdk.so'
5757
if host_machine.cpu_family() == 'x86_64'
5858
lib_dir = 'lib' / 'x86_64'
59+
60+
cat = find_program('cat')
61+
62+
os_release_info = run_command(
63+
cat,
64+
'/etc/os-release',
65+
check: true,
66+
).stdout().strip().split('\n')
67+
68+
linux_distro = ''
69+
70+
foreach line : os_release_info
71+
line_detail = line.split('=')
72+
73+
if line_detail[0] == 'ID'
74+
linux_distro = line_detail[1]
75+
endif
76+
77+
endforeach
78+
79+
if linux_distro == ''
80+
warning('Couldn\'t detect the linux distro')
81+
endif
82+
83+
if linux_distro == 'alpine'
84+
error('unsuported libc for linux: musl')
85+
endif
86+
5987
else
6088
error('unsuported architectue for linux: ' + host_machine.cpu_family())
6189
endif

subprojects/packagefiles/discord_game_sdk/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(
33
'cpp',
44
'c',
55
version: '3.2.1',
6-
meson_version: '>=1.2.0',
6+
meson_version: '>=1.4.0',
77
default_options: {
88
'cpp_std': ['c++17'],
99
},

tools/dependencies/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ if build_application
335335

336336
discord_sdk_dep = dependency(
337337
'discord-game-sdk',
338-
required: not meson.is_cross_build(),
338+
required: not meson.is_cross_build() and get_option('build_installer'),
339339
# only with msvc we need a static library, all others work without adding __declspec() everywhere
340340
static: c.get_id() == 'msvc',
341341
default_options: c.get_id() != 'msvc' ? {} : {'default_library': 'static'},

0 commit comments

Comments
 (0)