mirror of
https://github.com/TheWhiteDog9487/lag2cn.git
synced 2026-08-11 23:01:29 +08:00
使用musl替换glibc,并在输出内移除调试符号以减小产物大小
This commit is contained in:
+21
-14
@@ -11,27 +11,34 @@ jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-linux-musl
|
||||
artifact: language
|
||||
- target: aarch64-linux-musl
|
||||
artifact: language_arm
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: 安装GCC对ARM交叉编译工具链
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install g++-aarch64-linux-gnu
|
||||
- name: 下载 musl 工具链
|
||||
uses: lmq8267/dl-musl@main
|
||||
with:
|
||||
TARGET: ${{ matrix.target }}
|
||||
STATIC: true
|
||||
|
||||
- name: 编译源代码
|
||||
- name: 编译
|
||||
run: |
|
||||
g++ -o language --static -std=c++20 language.cpp
|
||||
aarch64-linux-gnu-g++ -o language_arm --static -std=c++20 language.cpp
|
||||
# 静态链接,避免运行时才发现缺少so动态链接库
|
||||
if [ "${{ matrix.target }}" = "x86_64-linux-musl" ]; then
|
||||
"$CXX" -o "${{ matrix.artifact }}" -std=c++23 -s language.cpp
|
||||
else
|
||||
"$CXX" -o "${{ matrix.artifact }}" -std=c++23 -s language.cpp
|
||||
fi
|
||||
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: language_arm
|
||||
path: language_arm
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: language
|
||||
path: language
|
||||
name: ${{ matrix.artifact }}
|
||||
path: ${{ matrix.artifact }}
|
||||
push:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user