Skip to content

Commit

Permalink
Merge pull request #5 from dlang-community/dub
Browse files Browse the repository at this point in the history
Dub, macOS fixes, and GitHub Actions
  • Loading branch information
CyberShadow authored Sep 1, 2021
2 parents fc4bc32 + 567ab31 commit a4a1c28
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 137 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test
on: [ push, pull_request ]
jobs:
test:
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: dlang-community/setup-dlang@v1
with:
compiler: dmd-2.096.0
- name: Setup (Linux)
if: runner.os == 'Linux'
run: |
sudo apt install libfuse-dev
- name: Setup (macOS)
if: runner.os == 'macOS'
run: |
brew install --cask osxfuse
- name: Test
run: |
dub build
dub --root=example build
82 changes: 0 additions & 82 deletions Makefile

This file was deleted.

48 changes: 14 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dfuse
# dfuse [![test](https://github.com/dlang-community/dfuse/actions/workflows/test.yml/badge.svg)](https://github.com/dlang-community/dfuse/actions/workflows/test.yml)
*dfuse* is a [D language binding](http://dlang.org) for the high level
[fuse](http://fuse.sourceforge.net) library. It allows to write a fuse
filesystem for Linux or Mac OS (using [osxfuse](http://osxfuse.github.io)) in D.
Expand All @@ -11,7 +11,8 @@ HTTP libraries, etc. For more information about fuse see: http://fuse.sourceforg
A simple filesystems implementing a directory listing can be found in the [example/](https://github.com/dlang-community/dfuse/tree/master/example) directory.
You can build the examples using:
```Shell
$ make examples
$ cd example
$ dub build # or: $ dmd -i -I../source -L-lfuse simplefs.d
$ mkdir /mnt/simplefs
$ ./simplefs /mnt/simplefs
```
Expand Down Expand Up @@ -42,7 +43,7 @@ class MyFS : Operations
}
```

A minimal filesystem implements `Operations.getattr()`, `Operations.readdir()`, `Operations.read()`. See [dfuse/fuse.d](https://github.com/dlang-community/dfuse/blob/master/source/dfuse/fuse.d) for implementation specific details.
A minimal filesystem implements `Operations.getattr()`, `Operations.access()`, `Operations.readdir()`, `Operations.read()`. See [dfuse/fuse.d](https://github.com/dlang-community/dfuse/blob/master/source/dfuse/fuse.d) for implementation specific details.

To mount a filesystem use a Fuse object and call mount:
```D
Expand All @@ -65,44 +66,23 @@ dfuse requires:
* DMD/Druntime/Phobos >= 2.065

## Building dfuse
dfuse comes with a standard makefile that assumes that DMD (the D-compiler) is
in your $PATH.
dfuse comes with a [Dub](https://dub.pm/) configuration file, making it usable as a Dub package.

### Linux
Alternatively, it is usable with common D recursive compilation tools (`dmd -i` / `rdmd` / `rund`).

### Dub
In order to compile dfuse on Linux:
```Shell
$ make dfuse
$ dub build -b release
or
$ make dfuse ENABLE_DEBUG=1
$ dub build -b debug
to build a debug version
```

### MacOS
MacOS supports two inode sizes which are both supported by OSXfuse, however when
compiling dfuse you have to be aware which OSXfuse should be linked.

By default dfuse is trying to build with a 32bit inode size and link against
osxfuse_i32 which is part of OSXfuse for compatibility. Please note that your
library itself will still be 64bit on a 64bit system. The setting only affects
the size of the inode.

To build just run
```Shell
$ make dfuse
```

If you want to compile with 64bit inodes you need a at least DMD, Druntime,
Phobos in version 2.066:
```Shell
$ make dfuse ENABLE_64BIT=1
```

### Dub
dfuse comes with experimental support for [dub](http://code.dlang.org/), a package manager for D. See the dub documentation how to build and use dub.

## Installing dfuse
At the moment the dfuse makefile doesn't support an install target. It is
recommended to just include the library in a project at this point.
### Recursive compilation
- Make sure the dfuse `source` directory is in your compiler search path.
- `import dfuse.fuse;` in your program.
- Link against the `fuse` library, e.g. by adding `-L-lfuse` to the compiler's command line, or by adding `pragma(lib, "fuse");` in your program.

## How dfuse works
dfuse is a simple D wrapper. It exposes a lowelevel interface to the libfuse C
Expand Down
20 changes: 0 additions & 20 deletions dub.json

This file was deleted.

12 changes: 12 additions & 0 deletions dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name "dfuse"
description "A D binding for libfuse"
authors "David Soria Parra"
copyright "Copyright (c) 2014, Facebook, Inc."
homepage "https://github.com/dlang-community/dfuse"
license "BSL-1.0"
targetType "library"

configuration "default" {
platforms "osx" "linux"
libs "fuse"
}
5 changes: 5 additions & 0 deletions example/dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name "simplefs"
targetType "executable"
sourceFiles "simplefs.d"

dependency "dfuse" version="*" path=".."
5 changes: 5 additions & 0 deletions example/simplefs.d
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class SimpleFS : Operations

throw new FuseException(ENOENT);
}

override bool access(const(char)[] path, int mode)
{
return true;
}
}

int main(string[] args)
Expand Down
2 changes: 1 addition & 1 deletion source/c/fuse/fuse_common.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum FUSE_MINOR_VERSION = 9;
auto FUSE_MAKE_VERSION(Maj, Min)(Maj maj, Min min) { return ((maj) * 10 + (min)); }
enum FUSE_VERSION = FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION);

static assert(_FILE_OFFSET_BITS == 64);
version (linux) static assert(_FILE_OFFSET_BITS == 64);

extern (C):

Expand Down

0 comments on commit a4a1c28

Please sign in to comment.