Skip to content

Commit

Permalink
Build blazecli for more targets
Browse files Browse the repository at this point in the history
It can come in handy to have blazecli readily build for more targets,
especially for Android, where it can be especially painful to get a
working build from scratch.
This change adjusts the build workflow to use a proper cross compilation
setup that makes it easy for us to accomplish the same. With that in
hand, it adds builds for a few Android targets.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o committed Nov 16, 2023
1 parent a80c790 commit 7ca0e00
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Build

on:
workflow_dispatch:
push:

jobs:
build:
name: Build statically linked binary
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
target: [
aarch64-linux-android,
arm-linux-androideabi,
armv7-linux-androideabi,
x86_64-unknown-linux-musl,
]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install musl-tools
- uses: actions-rs/toolchain@v1
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-musl
target: ${{ matrix.target }}
- run: |
cargo install --path=cli --root=. --target x86_64-unknown-linux-musl
strip bin/blazecli
cargo install --path=cli --root=. --target ${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: blazecli
name: blazecli-${{ matrix.target }}
path: bin/blazecli
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Test

on:
push:
pull_request:
workflow_call:

env:
Expand Down
10 changes: 6 additions & 4 deletions src/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ struct EntryMeta {

impl EntryMeta {
fn new(path: PathBuf, stat: &libc::stat) -> Self {
// Casts are necessary because on Android some libc types do not
// use proper typedefs. https://github.com/rust-lang/libc/issues/3285
Self {
path,
dev: stat.st_dev,
inode: stat.st_ino,
size: stat.st_size,
dev: stat.st_dev as _,
inode: stat.st_ino as _,
size: stat.st_size as _,
mtime_sec: stat.st_mtime,
mtime_nsec: stat.st_mtime_nsec,
mtime_nsec: stat.st_mtime_nsec as _,
}
}
}
Expand Down

0 comments on commit 7ca0e00

Please sign in to comment.