mirror of
https://github.com/lbl8603/vnt.git
synced 2026-04-22 23:47:08 +08:00
Modify the compilation method for the MIPS target platform.
This commit is contained in:
+89
-27
@@ -12,6 +12,9 @@ defaults:
|
||||
run:
|
||||
# necessary for windows
|
||||
shell: bash
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
# test:
|
||||
@@ -78,6 +81,11 @@ jobs:
|
||||
- TARGET: mips-unknown-linux-musl # openwrt
|
||||
OS: ubuntu-latest
|
||||
FEATURES: ring-cipher,wss
|
||||
# - TARGET: x86_64-unknown-freebsd
|
||||
# OS: ubuntu-latest
|
||||
# ARTIFACT_NAME: freebsd-13.2-x86_64
|
||||
# FEATURES: default
|
||||
# BSD_VERSION: 13.2
|
||||
# needs: test
|
||||
runs-on: ${{ matrix.OS }}
|
||||
env:
|
||||
@@ -101,7 +109,38 @@ jobs:
|
||||
run: echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
|
||||
- name: List
|
||||
run: find ./
|
||||
- name: Build NetLink X86_64-FreeBSD
|
||||
uses: cross-platform-actions/action@v0.23.0
|
||||
if: ${{ endsWith(matrix.TARGET, 'freebsd') }}
|
||||
env:
|
||||
TARGET: ${{ matrix.TARGET }}
|
||||
with:
|
||||
operating_system: freebsd
|
||||
environment_variables: TARGET
|
||||
architecture: x86-64
|
||||
version: ${{ matrix.BSD_VERSION }}
|
||||
shell: bash
|
||||
memory: 5G
|
||||
cpu_count: 4
|
||||
run: |
|
||||
uname -a
|
||||
echo $SHELL
|
||||
pwd
|
||||
ls -lah
|
||||
whoami
|
||||
env | sort
|
||||
sudo pkg install -y git protobuf
|
||||
curl --proto 'https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source $HOME/.cargo/env
|
||||
rustup set auto-self-update disable
|
||||
rustup install 1.77
|
||||
rustup default 1.77
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
export CARGO_TERM_COLOR=always
|
||||
cargo build --release --verbose --target $TARGET
|
||||
- name: Install and configure dependencies
|
||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||
run: |
|
||||
# dependencies are only needed on ubuntu as that's the only place where
|
||||
# we make cross-compilation
|
||||
@@ -112,7 +151,8 @@ jobs:
|
||||
# curl -s musl.cc | grep mipsel
|
||||
case $TARGET in
|
||||
mipsel-unknown-linux-musl)
|
||||
MUSL_URI=mipsel-linux-musl-cross
|
||||
MUSL_URI=mipsel-linux-muslsf-cross
|
||||
URL=mipsel-linux-muslsf
|
||||
;;
|
||||
aarch64-unknown-linux-musl)
|
||||
MUSL_URI=aarch64-linux-musl-cross
|
||||
@@ -122,7 +162,7 @@ jobs:
|
||||
;;
|
||||
armv7-unknown-linux-musleabi)
|
||||
MUSL_URI=armv7m-linux-musleabi-cross
|
||||
;;
|
||||
;;
|
||||
arm-unknown-linux-musleabihf)
|
||||
MUSL_URI=arm-linux-musleabihf-cross
|
||||
;;
|
||||
@@ -130,28 +170,31 @@ jobs:
|
||||
MUSL_URI=arm-linux-musleabi-cross
|
||||
;;
|
||||
mips-unknown-linux-musl)
|
||||
MUSL_URI=mips-linux-musl-cross
|
||||
MUSL_URI=mips-linux-muslsf-cross
|
||||
URL=mips-linux-muslsf
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $TARGET =~ ^mips.*$ ]]; then
|
||||
# mips平台使用1.71.1版本
|
||||
rustup install 1.71.1
|
||||
rustup default 1.71.1
|
||||
else
|
||||
rustup install 1.77
|
||||
rustup default 1.77
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$MUSL_URI" ]; then
|
||||
mkdir -p ./musl_gcc
|
||||
wget -c https://musl.cc/$MUSL_URI.tgz -P ./musl_gcc/
|
||||
tar zxf ./musl_gcc/$MUSL_URI.tgz -C ./musl_gcc/
|
||||
sudo ln -s $(pwd)/musl_gcc/$MUSL_URI/bin/*gcc /usr/bin/
|
||||
mkdir -p /opt/musl_gcc
|
||||
wget -c https://musl.cc/$MUSL_URI.tgz -P /opt/musl_gcc/
|
||||
tar zxf /opt/musl_gcc/$MUSL_URI.tgz -C /opt/musl_gcc/
|
||||
sudo ln -s /opt/musl_gcc/$MUSL_URI/bin/*gcc /usr/bin/
|
||||
fi
|
||||
else
|
||||
rustup install 1.77
|
||||
rustup default 1.77
|
||||
fi
|
||||
if [[ $TARGET =~ ^mips.*$ ]]; then
|
||||
cd /opt/musl_gcc/${URL}-cross/lib/gcc/${URL}/11.2.1
|
||||
cp libgcc_eh.a libunwind.a
|
||||
rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
||||
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
||||
RUST_LIB_SRC=$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/
|
||||
if [[ -f $RUST_LIB_SRC/library/Cargo.lock && ! -f $RUST_LIB_SRC/Cargo.lock ]]; then
|
||||
cp -f $RUST_LIB_SRC/library/Cargo.lock $RUST_LIB_SRC/Cargo.lock
|
||||
fi
|
||||
elif [[ $OS =~ ^windows.*$ ]]; then
|
||||
# Windows 平台使用 1.77 版本
|
||||
rustup install 1.77.0
|
||||
rustup default 1.77.0
|
||||
fi
|
||||
rustup -V
|
||||
|
||||
@@ -175,11 +218,17 @@ jobs:
|
||||
linker = "arm-linux-musleabi-gcc"
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols"]
|
||||
[target.mipsel-unknown-linux-musl]
|
||||
linker = "mipsel-linux-musl-gcc"
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols"]
|
||||
linker = "mipsel-linux-muslsf-gcc"
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols","-C", "link-arg=-static",
|
||||
"-C", "relocation-model=static","-C", "link-arg=-no-pie","--cfg", "compiler_builtins_no_debug",
|
||||
"-L", "/opt/musl_gcc/mipsel-linux-muslsf-cross/mipsel-linux-muslsf/lib",
|
||||
"-L", "/opt/musl_gcc/mipsel-linux-muslsf-cross/lib/gcc/mipsel-linux-muslsf/11.2.1"]
|
||||
[target.mips-unknown-linux-musl]
|
||||
linker = "mips-linux-musl-gcc"
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols"]
|
||||
linker = "mips-linux-muslsf-gcc"
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols","-C", "link-arg=-static",
|
||||
"-C", "relocation-model=static","-C", "link-arg=-no-pie","--cfg", "compiler_builtins_no_debug",
|
||||
"-L", "/opt/musl_gcc/mips-linux-muslsf-cross/mips-linux-muslsf/lib",
|
||||
"-L", "/opt/musl_gcc/mips-linux-muslsf-cross/lib/gcc/mips-linux-muslsf/11.2.1"]
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols"]
|
||||
[target.i686-pc-windows-msvc]
|
||||
@@ -192,11 +241,24 @@ jobs:
|
||||
rustflags = ["-C", "target-feature=+crt-static","-C", "strip=symbols"]
|
||||
EOF
|
||||
- name: Install rust target
|
||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') && ! startsWith(matrix.TARGET, 'mips') }}
|
||||
run: rustup target add $TARGET
|
||||
- name: Run build vn-link-cli
|
||||
run: cargo build --package vn-link-cli --release --verbose --target $TARGET --features $FEATURES
|
||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||
run: |
|
||||
if [[ $TARGET =~ ^mips.*$ ]]; then
|
||||
cargo +nightly build --package vn-link-cli --release --verbose --target $TARGET -Z build-std=std,panic_abort --features $FEATURES
|
||||
else
|
||||
cargo build --package vn-link-cli --release --verbose --target $TARGET --features $FEATURES
|
||||
fi
|
||||
- name: Run build vnt-cli
|
||||
run: cargo build --package vnt-cli --release --verbose --target $TARGET --features $FEATURES
|
||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||
run: |
|
||||
if [[ $TARGET =~ ^mips.*$ ]]; then
|
||||
cargo +nightly build --package vnt-cli --release --verbose --target $TARGET -Z build-std=std,panic_abort --features $FEATURES
|
||||
else
|
||||
cargo build --package vnt-cli --release --verbose --target $TARGET --features $FEATURES
|
||||
fi
|
||||
- name: List target
|
||||
run: find ./target
|
||||
- name: Compress
|
||||
@@ -243,7 +305,7 @@ jobs:
|
||||
- name: Release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.YOURTOKEN }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./artifacts/**/*.tar.gz
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
Reference in New Issue
Block a user