Skip to content

Commit 200f70e

Browse files
committed
ci: add macOS workflow and fix FUSE compatibility issues
- Add GitHub Actions CI workflow for macOS and Ubuntu. - Resolve macOS FUSE compilation errors by disabling macFUSE extensions. - Revert to using standard struct stat and fuse_fill_dir_t in src/fuse_local.c. - Ensure cross-platform compatibility for file attributes and directory listing.
1 parent cea9e65 commit 200f70e

2 files changed

Lines changed: 75 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build-mac:
11+
name: Build (macOS)
12+
runs-on: macos-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install dependencies
17+
run: |
18+
brew update
19+
brew install \
20+
gumbo-parser \
21+
openssl \
22+
curl \
23+
expat \
24+
meson \
25+
pkg-config \
26+
ossp-uuid
27+
brew install --cask macfuse
28+
29+
- name: Setup Meson
30+
run: |
31+
OPENSSL_PREFIX=$(brew --prefix openssl@3)
32+
BREW_PREFIX=$(brew --prefix)
33+
export PKG_CONFIG_PATH="$OPENSSL_PREFIX/lib/pkgconfig:$BREW_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
34+
meson setup builddir
35+
36+
- name: Compile
37+
run: meson compile -C builddir
38+
39+
build-ubuntu:
40+
name: Build (Ubuntu, ${{ matrix.compiler }})
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
compiler: [gcc, clang]
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install dependencies
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get install -y \
52+
libgumbo-dev \
53+
libcurl4-openssl-dev \
54+
libfuse3-dev \
55+
uuid-dev \
56+
libexpat1-dev \
57+
libssl-dev \
58+
meson \
59+
ninja-build \
60+
help2man
61+
62+
- name: Setup Meson
63+
run: |
64+
export CC=${{ matrix.compiler }}
65+
meson setup builddir
66+
67+
- name: Compile
68+
run: meson compile -C builddir

src/fuse_local.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
/*
77
* must be included before including <fuse.h>
88
*/
9+
#if defined(__APPLE__) && defined(__MACH__)
10+
#define FUSE_DARWIN_ENABLE_EXTENSIONS 0
11+
#endif
12+
913
#define FUSE_USE_VERSION 30
1014
#include <fuse.h>
1115

@@ -50,7 +54,9 @@ static int fs_getattr(const char *path, struct stat *stbuf,
5054
struct timespec spec = { 0 };
5155
spec.tv_sec = link->time;
5256
#if defined(__APPLE__) && defined(__MACH__)
53-
stbuf->st_mtimespec = spec;
57+
stbuf->st_mtime = spec.tv_sec;
58+
stbuf->st_atime = spec.tv_sec;
59+
stbuf->st_ctime = spec.tv_sec;
5460
#else
5561
stbuf->st_mtim = spec;
5662
#endif

0 commit comments

Comments
 (0)