Add FreeBSD compatibility

This commit is contained in:
Konstantin Schukraft 2021-01-02 19:30:36 +01:00
parent c99fd56c7c
commit 2c7e302171
No known key found for this signature in database
GPG key ID: ED359AB0BF214D6E
4 changed files with 18 additions and 1 deletions

View file

@ -4,6 +4,9 @@ TARGETS = tabfs
OSXFUSE_ROOT = /usr/local OSXFUSE_ROOT = /usr/local
#OSXFUSE_ROOT = /opt/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 CFLAGS_EXTRA = -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -Wall -Wno-unused-function -g
ifeq ($(shell uname -s),Linux) 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) CFLAGS = -I$(OSXFUSE_ROOT)/include/osxfuse/fuse -L$(OSXFUSE_ROOT)/lib -D_DARWIN_USE_64_BIT_INODE $(CFLAGS_EXTRA)
LIBS = -losxfuse LIBS = -losxfuse
endif endif
ifeq ($(shell uname -s),FreeBSD)
CFLAGS += -L$(FREEBSD_ROOT)/lib -I$(FREEBSD_ROOT)/include $(CFLAGS_EXTRA)
LIBS = -lfuse
endif
all: $(TARGETS) all: $(TARGETS)

View file

@ -216,6 +216,8 @@ int main(int argc, char **argv) {
system(killcmd); system(killcmd);
#ifdef __APPLE__ #ifdef __APPLE__
system("diskutil umount force mnt > /dev/null"); system("diskutil umount force mnt > /dev/null");
#elif __FreeBSD__
system("umount -f mnt");
#else #else
system("fusermount -u mnt"); system("fusermount -u mnt");
#endif #endif

View file

@ -1,4 +1,6 @@
#!/bin/bash -eux #!/usr/bin/env bash
set -eux
if [[ "$#" -lt 1 || ( if [[ "$#" -lt 1 || (
! ( ( "$1" == "firefox" && "$#" -eq 1 ) || ! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
@ -16,10 +18,14 @@ BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')"
case "$OS $BROWSER" in case "$OS $BROWSER" in
"Linux firefox") "Linux firefox")
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";; MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
"FreeBSD firefox")
MANIFEST_LOCATION="$HOME/.mozilla/native-messaging-hosts";;
"Darwin firefox") "Darwin firefox")
MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";; MANIFEST_LOCATION="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";;
"Linux chrome") "Linux chrome")
MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";; MANIFEST_LOCATION="$HOME/.config/google-chrome/NativeMessagingHosts";;
"FreeBSD chromium")
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
"Linux chromium") "Linux chromium")
MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";; MANIFEST_LOCATION="$HOME/.config/chromium/NativeMessagingHosts";;
"Darwin chrome") "Darwin chrome")

View file

@ -324,6 +324,8 @@ $ mkdir mnt
$ make $ make
``` ```
(GNU Make is required, so use gmake on FreeBSD)
Now install the native messaging host into your browser, so the Now install the native messaging host into your browser, so the
extension can launch and talk to the filesystem: extension can launch and talk to the filesystem: