mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Meta: Fix BuildFuseExt2.sh with patch for linking with modern macFUSE
Patch from https://github.com/alperakcan/fuse-ext2/issues/149
This commit is contained in:
1 parent
e147b944ed
commit
5171b67066
3 files changed
+127
-9
No files matched your search
@@ -8,27 +8,75 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
exit_if_running_as_root "Do not run BuildFuseExt2.sh as root, parts of your Toolchain directory will become root-owned"
|
||||
|
||||
export PATH="/usr/local/opt/m4/bin:$PATH"
|
||||
|
||||
die() {
|
||||
echo "die: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
die "This script makes sense to be run only on macOS"
|
||||
SOURCE_DIR="$DIR/Tarballs/fuse-ext2"
|
||||
PATCH_DIR="$DIR/Patches/fuse-ext2/macos"
|
||||
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_LDFLAGS=""
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
if command -v brew &>/dev/null; then
|
||||
m4_prefix="$(brew --prefix m4 2>/dev/null)"
|
||||
[ -n "$m4_prefix" ] && export PATH="${m4_prefix}/bin:$PATH"
|
||||
E2FSPROGS_PREFIX="$(brew --prefix e2fsprogs 2>/dev/null)"
|
||||
EXTRA_CFLAGS="-I${E2FSPROGS_PREFIX}/include"
|
||||
EXTRA_LDFLAGS="-L${E2FSPROGS_PREFIX}/lib"
|
||||
elif command -v pkg-config &>/dev/null && pkg-config --exists ext2fs; then
|
||||
EXTRA_CFLAGS="$(pkg-config --cflags ext2fs)"
|
||||
EXTRA_LDFLAGS="$(pkg-config --libs ext2fs)"
|
||||
else
|
||||
die "Could not find e2fsprogs. Install it via Homebrew (brew install e2fsprogs) or ensure pkg-config can find ext2fs."
|
||||
fi
|
||||
# Support older osxfuse installs that put headers in /usr/local/include/osxfuse
|
||||
if [ -d "/usr/local/include/osxfuse" ]; then
|
||||
EXTRA_CFLAGS="-I/usr/local/include/osxfuse ${EXTRA_CFLAGS}"
|
||||
fi
|
||||
MACFUSE_FRAMEWORK_DIR="/Library/Filesystems/macfuse.fs/Contents/Frameworks"
|
||||
if [ -d "${MACFUSE_FRAMEWORK_DIR}/MFMount.framework" ]; then
|
||||
EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -F${MACFUSE_FRAMEWORK_DIR}"
|
||||
fi
|
||||
MACOS_PATCHES=true
|
||||
else
|
||||
if command -v pkg-config &>/dev/null && pkg-config --exists ext2fs; then
|
||||
EXTRA_CFLAGS="$(pkg-config --cflags ext2fs)"
|
||||
EXTRA_LDFLAGS="$(pkg-config --libs ext2fs)"
|
||||
else
|
||||
EXTRA_LDFLAGS="-lext2fs"
|
||||
fi
|
||||
MACOS_PATCHES=false
|
||||
fi
|
||||
|
||||
mkdir -p "$DIR"/Tarballs
|
||||
pushd "$DIR"/Tarballs
|
||||
|
||||
if [ ! -d fuse-ext2 ]; then
|
||||
git clone https://github.com/alperakcan/fuse-ext2.git
|
||||
if [ -d "$SOURCE_DIR" ]; then
|
||||
rm -rf "$SOURCE_DIR"
|
||||
fi
|
||||
|
||||
git clone --depth 1 https://github.com/alperakcan/fuse-ext2.git "$SOURCE_DIR"
|
||||
|
||||
cd "$SOURCE_DIR"
|
||||
if [ "$MACOS_PATCHES" = true ]; then
|
||||
for patch in "$PATCH_DIR"/*.patch; do
|
||||
[ -f "$patch" ] || continue
|
||||
patch -p1 < "$patch" > /dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
cd fuse-ext2
|
||||
./autogen.sh
|
||||
CFLAGS="-I/usr/local/include/osxfuse/ -I/$(brew --prefix e2fsprogs)/include" LDFLAGS="-L$(brew --prefix e2fsprogs)/lib" ./configure
|
||||
make
|
||||
CFLAGS="${EXTRA_CFLAGS}" LDFLAGS="${EXTRA_LDFLAGS}" ./configure
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
make \
|
||||
"fuse_ext2_wait_LINK=\$(OBJC) \$(OBJCFLAGS) \$(AM_OBJCFLAGS) \$(AM_LDFLAGS) \$(LDFLAGS) \$(fuse_ext2_wait_LDFLAGS) -o \$@" \
|
||||
"fuse_ext2_install_LINK=\$(OBJC) \$(OBJCFLAGS) \$(AM_OBJCFLAGS) \$(AM_LDFLAGS) \$(LDFLAGS) \$(fuse_ext2_install_LDFLAGS) -o \$@" \
|
||||
"OBJCLINK=\$(OBJC) \$(OBJCFLAGS) \$(AM_OBJCFLAGS) \$(AM_LDFLAGS) \$(LDFLAGS) -o \$@"
|
||||
else
|
||||
make
|
||||
fi
|
||||
sudo make install
|
||||
popd
|
||||
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bastiaan van der Plaat <[email protected]>
|
||||
Date: Tue, 5 May 2026 20:56:42 +0200
|
||||
Subject: [PATCH] Build with latest macFUSE on macOS
|
||||
|
||||
Adjust the macOS build for current macFUSE headers and skip installing the
|
||||
legacy preference pane.
|
||||
|
||||
Link: https://github.com/alperakcan/fuse-ext2/issues/149
|
||||
---
|
||||
fuse-ext2/fuse-ext2.h | 2 +-
|
||||
fuse-ext2/op_getxattr.c | 3 ++-
|
||||
tools/macosx/Makefile.am | 2 --
|
||||
3 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/fuse-ext2/fuse-ext2.h b/fuse-ext2/fuse-ext2.h
|
||||
index 07fd1db..09399ed 100644
|
||||
--- a/fuse-ext2/fuse-ext2.h
|
||||
+++ b/fuse-ext2/fuse-ext2.h
|
||||
@@ -178,7 +178,7 @@ int op_fgetattr (const char *path, struct stat *stbuf, struct fuse_file_info *fi
|
||||
|
||||
int op_getattr (const char *path, struct stat *stbuf);
|
||||
|
||||
-int op_getxattr(const char *path, const char *name, char *value, size_t size);
|
||||
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position);
|
||||
|
||||
ext2_file_t do_open (ext2_filsys e2fs, const char *path, int flags);
|
||||
|
||||
diff --git a/fuse-ext2/op_getxattr.c b/fuse-ext2/op_getxattr.c
|
||||
index 27f95c3..eea5ae3 100644
|
||||
--- a/fuse-ext2/op_getxattr.c
|
||||
+++ b/fuse-ext2/op_getxattr.c
|
||||
@@ -15,7 +15,8 @@
|
||||
static int do_getxattr(ext2_filsys e2fs, struct ext2_inode *node, const char *name,
|
||||
char *value, size_t size);
|
||||
|
||||
-int op_getxattr(const char *path, const char *name, char *value, size_t size) {
|
||||
+int op_getxattr(const char *path, const char *name, char *value, size_t size, uint32_t position) {
|
||||
+ (void)position;
|
||||
int rt;
|
||||
ext2_ino_t ino;
|
||||
struct ext2_inode inode;
|
||||
diff --git a/tools/macosx/Makefile.am b/tools/macosx/Makefile.am
|
||||
index 5afaaa4..533d09f 100644
|
||||
--- a/tools/macosx/Makefile.am
|
||||
+++ b/tools/macosx/Makefile.am
|
||||
@@ -26,7 +26,5 @@ install-exec-local:
|
||||
$(INSTALL) -m 644 $(top_srcdir)/tools/macosx/fuse-ext2.fs/Contents/Info.plist $(DESTDIR)/Library/Filesystems/fuse-ext2.fs/Contents/Info.plist
|
||||
$(INSTALL) -m 644 $(top_srcdir)/tools/macosx/fuse-ext2.fs/Contents/PkgInfo $(DESTDIR)/Library/Filesystems/fuse-ext2.fs/Contents/PkgInfo
|
||||
$(INSTALL) -m 644 $(top_srcdir)/tools/macosx/fuse-ext2.fs/Contents/Resources/English.lproj/InfoPlist.strings $(DESTDIR)/Library/Filesystems/fuse-ext2.fs/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
- $(INSTALL) -d $(DESTDIR)/Library/PreferencePanes
|
||||
- cp -R $(top_srcdir)/tools/macosx/prefpane/build/Release/fuse-ext2.prefPane $(DESTDIR)/Library/PreferencePanes/fuse-ext2.prefPane
|
||||
|
||||
endif
|
||||
--
|
||||
2.49.0
|
||||
@@ -0,0 +1,14 @@
|
||||
# Patches for fuse-ext2 on macOS
|
||||
|
||||
## `0001-Build-with-latest-macFUSE-on-macOS.patch`
|
||||
|
||||
Build with latest macFUSE on macOS
|
||||
|
||||
Adjusts the macOS build for current macFUSE headers and skips installing
|
||||
the legacy preference pane.
|
||||
|
||||
The `op_getxattr` signature gains a `position` parameter required by the
|
||||
macFUSE 4.x FUSE API. The preference pane install step is removed because
|
||||
the prebuilt `.prefPane` bundle is no longer shipped in the source tree.
|
||||
|
||||
https://github.com/alperakcan/fuse-ext2/issues/149
|
||||
Reference in new issue
Block a user