Skip to content

Commit 9d8bb68

Browse files
authored
Refactor DEFS to array format in forkrun_release.yml
Refactor DEFS variable to use an array format for better readability and maintainability.
1 parent 5f3579f commit 9d8bb68

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/forkrun_release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ jobs:
7979
echo "Compiling Version: $FR_VERSION"
8080
8181
# 3. Define Common Flags
82-
# Note: We escape quotes heavily for the -D flags to survive shell passing
8382
OPT_FLAGS="-O3 -flto=auto -fno-strict-aliasing -fno-semantic-interposition -fno-math-errno -ftree-loop-im -ftree-loop-ivcanon -fPIC "
8483
WARN_FLAGS="-DNDEBUG -Wall -Wextra "
8584
INCLUDES="-I/usr/include/bash -I/usr/include/bash/include -I/usr/include/bash/builtins "
8685
87-
DEFS="-DSHELL -DHAVE_CONFIG_H"
88-
DEFS+=" -DBUILD_OS=\"\\\"Linux\\\"\""
89-
DEFS+=" -DFORKRUN_RING_VERSION=\"\\\"$FR_VERSION\\\"\""
90-
DEFS+=" -DCOMPILER_FLAGS=\"\\\"$OPT_FLAGS\\\"\""
86+
DEFS=(
87+
"-DSHELL"
88+
"-DHAVE_CONFIG_H"
89+
"-DBUILD_OS=\"Linux\""
90+
"-DFORKRUN_RING_VERSION=\"$FR_VERSION\""
91+
"-DCOMPILER_FLAGS=\"$OPT_FLAGS\""
92+
)
9193
9294
# Function to build specific variant
9395
build_variant() {
@@ -98,19 +100,18 @@ jobs:
98100
echo ">>> Building $arch_name..."
99101
100102
# Dynamic Arch Definition
101-
local ARCH_DEF="-DBUILD_ARCH=\"\\\"$arch_name\\\"\""
103+
local ARCH_DEF="-DBUILD_ARCH=\"$arch_name\""
102104
103105
gcc forkrun_ring.c \
104106
$OPT_FLAGS $WARN_FLAGS $INCLUDES \
105-
$DEFS $ARCH_DEF \
107+
"${DEFS[@]}" "$ARCH_DEF" \
106108
-shared \
107109
$march_flag \
108110
-o "$out_file"
109111
110112
strip --strip-unneeded "$out_file"
111113
112114
# SANITY CHECK: Try to enable and run version check
113-
# We only check if it loads successfully.
114115
echo ">>> Testing loadable..."
115116
enable -f "$out_file" ring_version && \
116117
ring_version -a || exit 1

0 commit comments

Comments
 (0)