Skip to content

Commit

Permalink
feat: EcoPasteHub#744 支持armv7和aarch64,支持交叉编译
Browse files Browse the repository at this point in the history
  • Loading branch information
witt-bit committed Nov 7, 2024
1 parent 4555a6c commit 11edf1e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
34 changes: 26 additions & 8 deletions .github/workflows/beta_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ jobs:
fail-fast: false
matrix:
os: ${{ fromJson(needs.preprocess.outputs.matrix) }}
include:
- os: macos-latest
targets: "aarch64-apple-darwin,x86_64-apple-darwin"
- os: 'windows-latest'
targets: ""
- os: ubuntu-22.04
target: "x86_64-unknown-linux-gnu,armv7-unknown-linux-gnueabihf,aarch64-unknown-linux-gnu"


runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -145,13 +153,13 @@ jobs:
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf \
gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
# 那些目标仅在 macos 运行器上使用,因此将其置于 `if` 语句中,以稍微加快 Windows 和 Linux 的构建速度。
targets: ${{ startsWith(matrix.os, 'macos') && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
targets: ${{ matrix.targets }}

- name: Rust cache
uses: swatinem/rust-cache@v2
Expand All @@ -167,10 +175,17 @@ jobs:
pnpm tauri build --target aarch64-apple-darwin
pnpm tauri build --target x86_64-apple-darwin
- name: Build Other app
if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-22.04'
- name: Build Windows app
if: matrix.os == 'windows-latest'
run: pnpm tauri build

- name: Build Linux app
if: matrix.os == 'ubuntu-22.04'
run: |
pnpm tauri build --target x86_64-unknown-linux-gnu
pnpm tauri build --target armv7-unknown-linux-gnueabihf
pnpm tauri build --target aarch64-unknown-linux-gnu
- name: Rename macos
if: startsWith(matrix.os, 'macos')
run: |
Expand All @@ -184,9 +199,12 @@ jobs:
- name: Rename linux
if: startsWith(matrix.os, 'ubuntu')
run: |
mv target/release/bundle/deb/*.deb target/${{ env.FILE_PREFIX }}_amd64.deb
mv target/release/bundle/rpm/*.rpm target/${{ env.FILE_PREFIX }}_x64.rpm
mv target/release/bundle/appimage/*.AppImage target/${{ env.FILE_PREFIX }}_amd64.AppImage
mv target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb target/${{ env.FILE_PREFIX }}_amd64.deb
mv target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm target/${{ env.FILE_PREFIX }}_x64.rpm
mv target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/${{ env.FILE_PREFIX }}_amd64.AppImage
mv target/armv7-unknown-linux-gnueabihf/release/bundle/deb/*.deb target/${{ env.FILE_PREFIX }}_armv7.deb
mv target/armv7-unknown-linux-gnueabihf/release/bundle/rpm/*.rpm target/${{ env.FILE_PREFIX }}_armv7.rpm
mv target/armv7-unknown-linux-gnueabihf/release/bundle/appimage/*.AppImage target/${{ env.FILE_PREFIX }}_armv7.AppImage
- name: Upload artifacts (Windows)
if: matrix.os == 'windows-latest'
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ jobs:
target: "i686-pc-windows-msvc"
- platform: "windows-latest"
target: "aarch64-pc-windows-msvc"

- platform: "ubuntu-22.04"
target: "x86_64-unknown-linux-gnu"
- platform: "ubuntu-22.04"
target: "armv7-unknown-linux-gnueabihf"
- platform: "ubuntu-22.04"
target: "aarch64-unknown-linux-gnu"

runs-on: ${{ matrix.platform }}

Expand All @@ -77,7 +80,10 @@ jobs:
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf \
gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
# 安装 Rust
- name: Install Rust stable
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source.organizeImports.biome": "explicit"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
Expand Down
30 changes: 21 additions & 9 deletions src-tauri/tauri.linux.conf.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
{
"identifier": "com.ayangweb.EcoPaste",
"bundle": {
"linux": {
"deb": {
"depends": ["gstreamer1.0-plugins-good"],
"desktopTemplate": "./EcoPaste.desktop"
"tauri": {
"bundle": {
"identifier": "com.ayangweb.EcoPaste",
"appimage": {
"bundleMediaFramework": true
},
"rpm": {
"depends": ["gstreamer1-plugins-good"],
"desktopTemplate": "./EcoPaste.desktop"
"linux": {
"deb": {
"depends": ["gstreamer1.0-plugins-good"],
"desktopTemplate": "./EcoPaste.desktop"
},
"rpm": {
"depends": ["gstreamer1-plugins-good"],
"desktopTemplate": "./EcoPaste.desktop"
}
}
},
"targets": {
"linux": [
"x86_64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
"aarch64-unknown-linux-gnu"
]
}
}
}

0 comments on commit 11edf1e

Please sign in to comment.