From 7fe3dab96b8519282050d2f047bbff1b1e36d296 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sat, 13 Oct 2018 22:57:43 +0200 Subject: [PATCH] libfuse: add first attempt at package it probably doesn't work in arm and i686 --- root-packages/libfuse/build.sh | 10 +++++++ root-packages/libfuse/fuse.c.patch | 11 ++++++++ root-packages/libfuse/fuse_common.h.patch | 17 +++++++++++ root-packages/libfuse/fuse_loop_mt.c.patch | 21 ++++++++++++++ root-packages/libfuse/fusermount.c.patch | 28 +++++++++++++++++++ root-packages/libfuse/install_helper.sh.patch | 10 +++++++ root-packages/libfuse/lib-meson.build.patch | 26 +++++++++++++++++ root-packages/libfuse/poll.c.patch | 11 ++++++++ root-packages/libfuse/test_setattr.c.patch | 11 ++++++++ 9 files changed, 145 insertions(+) create mode 100644 root-packages/libfuse/build.sh create mode 100644 root-packages/libfuse/fuse.c.patch create mode 100644 root-packages/libfuse/fuse_common.h.patch create mode 100644 root-packages/libfuse/fuse_loop_mt.c.patch create mode 100644 root-packages/libfuse/fusermount.c.patch create mode 100644 root-packages/libfuse/install_helper.sh.patch create mode 100644 root-packages/libfuse/lib-meson.build.patch create mode 100644 root-packages/libfuse/poll.c.patch create mode 100644 root-packages/libfuse/test_setattr.c.patch diff --git a/root-packages/libfuse/build.sh b/root-packages/libfuse/build.sh new file mode 100644 index 000000000..cb9269905 --- /dev/null +++ b/root-packages/libfuse/build.sh @@ -0,0 +1,10 @@ +TERMUX_PKG_MAINTINER="Henrik Grimler @Grimler91" +TERMUX_PKG_HOMEPAGE=https://github.com/libfuse/libfuse +TERMUX_PKG_DESCRIPTION="FUSE (Filesystem in Userspace) is an interface for userspace programs to export a filesystem to the Linux kernel" +TERMUX_PKG_VERSION=3.2.6 +TERMUX_PKG_SHA256=686b98afac4ca322498f68d37d598ae3d07919fe21a4700c76572fae59a6256b +TERMUX_PKG_SRCURL=https://github.com/libfuse/libfuse/archive/fuse-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-Dudevrulesdir=$TERMUX_PREFIX/etc/udev" +# Code uses telldir() and seekdir(): +TERMUX_PKG_API_LEVEL=23 +# Requires 64bit off_t, we use super-ugly probably none-functioning patch to work around that for now diff --git a/root-packages/libfuse/fuse.c.patch b/root-packages/libfuse/fuse.c.patch new file mode 100644 index 000000000..89fc723b7 --- /dev/null +++ b/root-packages/libfuse/fuse.c.patch @@ -0,0 +1,11 @@ +--- ../fuse.c.orig 2018-10-13 19:16:53.752578568 +0200 ++++ ./lib/fuse.c 2018-10-13 19:19:03.135469989 +0200 +@@ -4754,7 +4754,7 @@ + { + if (lru_enabled(f)) { + pthread_mutex_lock(&f->lock); +- pthread_cancel(f->prune_thread); ++ pthread_kill(f->prune_thread, 0); + pthread_mutex_unlock(&f->lock); + pthread_join(f->prune_thread, NULL); + } diff --git a/root-packages/libfuse/fuse_common.h.patch b/root-packages/libfuse/fuse_common.h.patch new file mode 100644 index 000000000..939b24e33 --- /dev/null +++ b/root-packages/libfuse/fuse_common.h.patch @@ -0,0 +1,17 @@ +--- ../fuse_common.h.orig 2018-10-13 19:54:21.093146271 +0200 ++++ ./include/fuse_common.h 2018-10-13 19:57:05.539651897 +0200 +@@ -759,12 +760,12 @@ + * + * On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags! + */ +- ++/* This probably introduces problem for arm and i686 + #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus + _Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit"); + #else + struct _fuse_off_t_must_be_64bit_dummy_struct \ + { unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1); }; + #endif +- ++*/ + #endif /* FUSE_COMMON_H_ */ diff --git a/root-packages/libfuse/fuse_loop_mt.c.patch b/root-packages/libfuse/fuse_loop_mt.c.patch new file mode 100644 index 000000000..6217be1d2 --- /dev/null +++ b/root-packages/libfuse/fuse_loop_mt.c.patch @@ -0,0 +1,21 @@ +--- ../fuse_loop_mt.c.orig 2018-10-13 18:59:55.777282699 +0200 ++++ ./lib/fuse_loop_mt.c 2018-10-13 22:22:25.057485369 +0200 +@@ -120,9 +120,7 @@ + int isforget = 0; + int res; + +- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + res = fuse_session_receive_buf_int(mt->se, &w->fbuf, w->ch); +- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + if (res == -EINTR) + continue; + if (res <= 0) { +@@ -330,7 +328,7 @@ + + pthread_mutex_lock(&mt.lock); + for (w = mt.main.next; w != &mt.main; w = w->next) +- pthread_cancel(w->thread_id); ++ pthread_kill(w->thread_id, 0); + mt.exit = 1; + pthread_mutex_unlock(&mt.lock); + diff --git a/root-packages/libfuse/fusermount.c.patch b/root-packages/libfuse/fusermount.c.patch new file mode 100644 index 000000000..8239f1bfa --- /dev/null +++ b/root-packages/libfuse/fusermount.c.patch @@ -0,0 +1,28 @@ +--- ../fusermount.c.orig 2018-10-13 19:06:31.957898402 +0200 ++++ ./util/fusermount.c 2018-10-13 19:13:39.298247332 +0200 +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -114,7 +115,7 @@ + progname, strerror(errno)); + return -1; + } +- res = lockf(mtablock, F_LOCK, 0); ++ res = flock(mtablock, F_LOCK); + if (res < 0) { + fprintf(stderr, "%s: error getting lock: %s\n", progname, + strerror(errno)); +@@ -130,7 +131,7 @@ + if (mtablock >= 0) { + int res; + +- res = lockf(mtablock, F_ULOCK, 0); ++ res = flock(mtablock, F_ULOCK); + if (res < 0) { + fprintf(stderr, "%s: error releasing lock: %s\n", + progname, strerror(errno)); diff --git a/root-packages/libfuse/install_helper.sh.patch b/root-packages/libfuse/install_helper.sh.patch new file mode 100644 index 000000000..d9a1605bd --- /dev/null +++ b/root-packages/libfuse/install_helper.sh.patch @@ -0,0 +1,10 @@ +--- ../install_helper.sh.orig 2018-10-13 19:35:25.807091492 +0200 ++++ ./util/install_helper.sh 2018-10-13 19:35:42.210952193 +0200 +@@ -22,7 +22,6 @@ + DESTDIR="${DESTDIR%/}" + fi + +-chown root:root "${DESTDIR}${bindir}/fusermount3" + chmod u+s "${DESTDIR}${bindir}/fusermount3" + + install -D -m 644 "${MESON_SOURCE_ROOT}/util/fuse.conf" \ diff --git a/root-packages/libfuse/lib-meson.build.patch b/root-packages/libfuse/lib-meson.build.patch new file mode 100644 index 000000000..c64c8664c --- /dev/null +++ b/root-packages/libfuse/lib-meson.build.patch @@ -0,0 +1,26 @@ +--- ../lib-meson.build.orig 2018-10-13 18:50:35.614173402 +0200 ++++ ./lib/meson.build 2018-10-13 19:31:58.316854967 +0200 +@@ -3,11 +3,8 @@ + 'fuse_signals.c', 'buffer.c', 'cuse_lowlevel.c', + 'helper.c', 'modules/subdir.c' ] + +-if host_machine.system().startswith('linux') +- libfuse_sources += [ 'mount.c', 'mount_util.c' ] +-else +- libfuse_sources += [ 'mount_bsd.c' ] +-endif ++libfuse_sources += [ 'mount.c', 'mount_util.c' ] ++ + + if cfg.get('HAVE_ICONV') + libfuse_sources += [ 'modules/iconv.c' ] +@@ -22,9 +19,6 @@ + if host_machine.system().startswith('netbsd') + deps += [ cc.find_library('perfuse'), + cc.find_library('puffs') ] +-else +- # Required for clock_gettime before glibc 2.17 +- deps += cc.find_library('rt') + endif + + fusermount_path = join_paths(get_option('prefix'), get_option('bindir')) diff --git a/root-packages/libfuse/poll.c.patch b/root-packages/libfuse/poll.c.patch new file mode 100644 index 000000000..e52400b59 --- /dev/null +++ b/root-packages/libfuse/poll.c.patch @@ -0,0 +1,11 @@ +--- ../poll.c.orig 2018-10-13 19:17:31.400255853 +0200 ++++ ./example/poll.c 2018-10-13 19:19:54.007034483 +0200 +@@ -289,7 +289,7 @@ + + ret = fuse_main(argc, argv, &fsel_oper, NULL); + +- pthread_cancel(producer); ++ pthread_kill(producer, 0); + pthread_join(producer, NULL); + + return ret; diff --git a/root-packages/libfuse/test_setattr.c.patch b/root-packages/libfuse/test_setattr.c.patch new file mode 100644 index 000000000..4c28b47cd --- /dev/null +++ b/root-packages/libfuse/test_setattr.c.patch @@ -0,0 +1,11 @@ +--- ../test_setattr.c.orig 2018-10-13 19:16:39.896697370 +0200 ++++ ./test/test_setattr.c 2018-10-13 19:19:37.399176638 +0200 +@@ -170,7 +170,7 @@ + test_fs(fuse_opts.mountpoint); + + /* Stop file system */ +- assert(pthread_cancel(fs_thread) == 0); ++ assert(pthread_kill(fs_thread, 0) == 0); + + fuse_session_unmount(se); + assert(got_fh == 1);