Set RUSTFLAGS with project based config, fixed OPENSSL_STATIC

This commit is contained in:
zonyitoo
2020-08-19 22:18:52 +08:00
parent ed0ca0dd4a
commit 43f9195f2f
10 changed files with 24 additions and 15 deletions

9
.cargo/config.toml Normal file
View File

@@ -0,0 +1,9 @@
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))']
rustflags = [
"-C", "target-feature=+aes,+sse,+sse4.1,+sse4.2,+avx,+avx2,+prefetchwt1,+pclmul,+fma4,+fma,+bmi2,+bmi,+adx,+prefer-256-bit,+prefer-128-bit"
]
[target.'cfg(target_arch = "aarch64")']
rustflags = [
"-C", "target-feature=+aes,+crypto,+neon",
]

View File

@@ -46,7 +46,6 @@ jobs:
runs-on: ${{ matrix.os }}
env:
BUILD_EXTRA_FEATURES: "openssl-vendored local-redir"
RUSTFLAGS: "-Ctarget-feature=+aes,+ssse3"
strategy:
matrix:
# os: [ubuntu-latest, macos-latest]
@@ -71,9 +70,8 @@ jobs:
build-windows:
runs-on: windows-latest
env:
OPENSSL_STATIC: 1
OPENSSL_STATIC: "1"
OPENSSL_DIR: "C:\\Program Files\\OpenSSL-Win64\\"
RUSTFLAGS: "-Ctarget-feature=+aes,+ssse3"
steps:
- uses: actions/checkout@v2

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:aarch64-unknown-linux-gnu
ENV RUSTFLAGS="-Ctarget-feature=+aes,+neon"
# ENV RUSTFLAGS="-Ctarget-feature=+aes,+neon"

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:arm-unknown-linux-gnueabihf
ENV RUSTFLAGS="-Ctarget-feature=+aes"
# ENV RUSTFLAGS="-Ctarget-feature=+aes"

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:mips-unknown-linux-musl
ENV RUSTFLAGS=""
# ENV RUSTFLAGS=""

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:mipsel-unknown-linux-musl
ENV RUSTFLAGS=""
# ENV RUSTFLAGS=""

View File

@@ -19,5 +19,7 @@ RUN curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$SODIUM
V=1 make -j${nprocs} && make install && \
cd .. && rm -rf libsodium-$SODIUM_VERS.tar.gz libsodium-$SODIUM_VERS
ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3" \
SODIUM_LIB_DIR=/usr/x86_64-w64-mingw32/lib
# ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3" \
# SODIUM_LIB_DIR=/usr/x86_64-w64-mingw32/lib
ENV SODIUM_LIB_DIR=/usr/x86_64-w64-mingw32/lib

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:x86_64-unknown-linux-gnu
ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3"
# ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3"

View File

@@ -1,3 +1,3 @@
FROM rustembedded/cross:x86_64-unknown-linux-musl
ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3"
# ENV RUSTFLAGS="-Ctarget-feature=+aes,+ssse3"

View File

@@ -6,13 +6,13 @@
#>
$ErrorActionPreference = "Stop"
$TargetTriple = (rustc -Vv | Select-String -Pattern "host: (.*)" | foreach {$_.Matches.Value}).split()[-1]
$TargetTriple = (rustc -Vv | Select-String -Pattern "host: (.*)" | ForEach-Object { $_.Matches.Value }).split()[-1]
Write-Host "Started building release for ${TargetTriple} ..."
cargo build --release --features "aes-pmac-siv openssl-vendored"
$Version = (Select-String -Pattern '^version *= *"([^"]*)"$' -Path "${PSScriptRoot}\..\Cargo.toml" | foreach {$_.Matches.Value}).split()[-1]
$Version = (Select-String -Pattern '^version *= *"([^"]*)"$' -Path "${PSScriptRoot}\..\Cargo.toml" | ForEach-Object { $_.Matches.Value }).split()[-1]
$Version = $Version -replace '"'
$PackageReleasePath = "${PSScriptRoot}\release"
@@ -24,12 +24,12 @@ Write-Host $PackageReleasePath
Write-Host $PackageName
Write-Host $PackagePath
Pushd "${PSScriptRoot}\..\target\release"
Push-Location "${PSScriptRoot}\..\target\release"
$ProgressPreference = "SilentlyContinue"
New-Item "${PackageReleasePath}" -ItemType Directory -ErrorAction SilentlyContinue
$CompressParam = @{
LiteralPath = "sslocal.exe", "ssserver.exe", "ssurl.exe", "ssmanager.exe"
LiteralPath = "sslocal.exe", "ssserver.exe", "ssurl.exe", "ssmanager.exe"
DestinationPath = "${PackagePath}"
}
Compress-Archive @CompressParam