aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Schukraft <konstantin@schukraft.org>2021-01-02 19:30:36 +0100
committerKonstantin Schukraft <konstantin@schukraft.org>2021-01-02 19:30:56 +0100
commit2c7e30217188f49097ce86b081b1a694822ab363 (patch)
treebb3859bcf17166d1e08cfefc8c4f08d6d87970a0
parentc99fd56c7cb7e06749491384292d0a48e8ec953d (diff)
Add FreeBSD compatibility
-rw-r--r--fs/Makefile7
-rw-r--r--fs/tabfs.c2
-rwxr-xr-xinstall.sh8
-rw-r--r--tabfs.md2
4 files changed, 18 insertions, 1 deletions
diff --git a/fs/Makefile b/fs/Makefile
index e5a4b18..97ca01a 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -4,6 +4,9 @@ TARGETS = tabfs
OSXFUSE_ROOT = /usr/local
#OSXFUSE_ROOT = /opt/local
+# Root for libraries from FreeBSD's ports
+FREEBSD_ROOT = /usr/local
+
CFLAGS_EXTRA = -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -Wall -Wno-unused-function -g
ifeq ($(shell uname -s),Linux)
@@ -14,6 +17,10 @@ ifeq ($(shell uname -s),Darwin)
CFLAGS = -I$(OSXFUSE_ROOT)/include/osxfuse/fuse -L$(OSXFUSE_ROOT)/lib -D_DARWIN_USE_64_BIT_INODE $(CFLAGS_EXTRA)
LIBS = -losxfuse
endif
+ifeq ($(shell uname -s),FreeBSD)
+ CFLAGS += -L$(FREEBSD_ROOT)/lib -I$(FREEBSD_ROOT)/include $(CFLAGS_EXTRA)
+ LIBS = -lfuse
+endif
all: $(TARGETS)
diff --git a/fs/tabfs.c b/fs/tabfs.c
index c5ed91e..fecec22 100644
--- a/fs/tabfs.c
+++ b/fs/tabfs.c
@@ -216,6 +216,8 @@ int main(int argc, char **argv) {
system(killcmd);
#ifdef __APPLE__
system("diskutil umount force mnt > /dev/null");
+#elif __FreeBSD__
+ system("umount -f mnt");
#else
system("fusermount -u mnt");
#endif
diff --git a/install.sh b/install.sh
index fc0c3c3..bbc5379 100755
--- a/install.sh
+++ b/install.sh
@@ -1,4 +1,6 @@
-#!/bin/bash -eux
+#!/usr/bin/env bash
+
+set -eux
if [[ "$#" -lt 1 || (
! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
@@ -16,10 +18,14 @@ BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')"
case "$OS $BROWSER" in
"Linux firefox")
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
+ "FreeBSD firefox")
+ MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
"Darwin firefox")
MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";;
"Linux chrome")
MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";;
+ "FreeBSD chromium")
+ MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
"Linux chromium")
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
"Darwin chrome")
diff --git a/tabfs.md b/tabfs.md
index d3eac54..32d521d 100644
--- a/tabfs.md
+++ b/tabfs.md
@@ -324,6 +324,8 @@ $ mkdir mnt
$ make
```
+(GNU Make is required, so use gmake on FreeBSD)
+
Now install the native messaging host into your browser, so the
extension can launch and talk to the filesystem: