Skip to content

Commit 15258ff

Browse files
author
Github Actions
committed
Build static Linux release binaries
Add a Meson option for statically linking only the final ppm executable and enable it for all Linux release artifacts. This preserves the old build.sh behavior without forcing helper binaries from fallback subprojects to link statically. Verify Linux release artifacts in CI by failing when readelf still reports an ELF program interpreter, which catches binaries that would require a missing musl loader on Ubuntu runners. Bump the plugin_manager manifest version for the packaging fix.
1 parent aefed4c commit 15258ff

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,19 @@ jobs:
7575
run: |
7676
MESON_CROSS_ARGS=()
7777
MESON_C_ARGS="-ffunction-sections -fdata-sections"
78+
MESON_ARGS=()
7879
7980
case "$TARGET_ARCH" in
81+
x86_64-linux)
82+
MESON_ARGS+=(-Dfully_static=true)
83+
;;
8084
aarch64-linux)
8185
MESON_CROSS_ARGS=(--cross-file=cross/aarch64-linux-musl.ini)
86+
MESON_ARGS+=(-Dfully_static=true)
8287
;;
8388
riscv64-linux)
8489
MESON_CROSS_ARGS=(--cross-file=cross/riscv64-linux-musl.ini)
90+
MESON_ARGS+=(-Dfully_static=true)
8591
;;
8692
x86_64-windows)
8793
MESON_CROSS_ARGS=(--cross-file=cross/x86_64-w64-mingw32.ini)
@@ -114,9 +120,19 @@ jobs:
114120
-Dbinary_name="$BIN_BASE" \
115121
-Dc_args="$MESON_C_ARGS" \
116122
-Dc_link_args="-Wl,--gc-sections" \
123+
"${MESON_ARGS[@]}" \
117124
"${MESON_CROSS_ARGS[@]}"
118125
meson compile -C build-ci
119126
127+
- name: Verify Linux Static Artifact
128+
if: ${{ matrix.config.platform == 'linux' }}
129+
run: |
130+
file build-ci/$BIN
131+
if readelf -l build-ci/$BIN | grep -q 'Requesting program interpreter'; then
132+
echo "::error::$BIN is dynamically linked"
133+
exit 1
134+
fi
135+
120136
# - name: Run Tests
121137
# if: ${{ matrix.config.native }}
122138
# run: |

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"addons": [
33
{
44
"id": "plugin_manager",
5-
"version": "1.5.4",
5+
"version": "1.5.5",
66
"description": "A GUI interface to Adam's pragtical plugin manager.",
77
"type": "plugin",
88
"path": "plugins/plugin_manager",

meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ microtar_dep = declare_dependency(
3131

3232
ppm_source = files('src/ppm.c')
3333
cflags = []
34+
link_args = []
3435
ppm_release_version = get_option('release_version')
3536
ppm_full_version = get_option('full_version')
3637
ppm_target_arch = get_option('target_arch')
@@ -78,6 +79,10 @@ if get_option('static')
7879
cflags += '-DPPM_STATIC'
7980
endif
8081

82+
if get_option('fully_static')
83+
link_args += '-static'
84+
endif
85+
8186
ppm_exe = executable(ppm_binary_name,
8287
ppm_source,
8388
dependencies: [
@@ -90,6 +95,7 @@ ppm_exe = executable(ppm_binary_name,
9095
microtar_dep
9196
],
9297
c_args: cflags,
98+
link_args: link_args,
9399
install: true,
94100
install_dir: get_option('install_plugin') ? pragtical_datadir / 'plugins/plugin_manager' : get_option('bindir'),
95101
)

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
option('static', type : 'boolean', value : false, description: 'Build the pre-packaged lua file into the executable.')
2+
option('fully_static', type : 'boolean', value : false, description: 'Statically link the ppm executable.')
23
option('install_plugin', type : 'boolean', value : false, description: 'Install the Pragtical plugin for ppm')
34
option('pragtical_datadir', type : 'string', value : '', description: 'Path to the Pragtical data directory, usually \'share/pragtical\'')
45
option('release_version', type : 'string', value : '', description: 'Release version used by package builds.')

0 commit comments

Comments
 (0)