diff options
author | Pierre Bourdon <delroth@gmail.com> | 2022-05-26 15:48:31 +0200 |
---|---|---|
committer | Pierre Bourdon <delroth@gmail.com> | 2022-05-28 02:04:15 +0200 |
commit | 58d2ebb2831fa3236598398c7dbba8e205d4e91c (patch) | |
tree | f65acdb1de618818789e7be0738db1dd9242686f /pkgs/tools/filesystems/ntfs-3g | |
parent | e1f7051794a71db9f3e03067cf345e68f01c48ba (diff) |
ntfs3g: 2021.8.22 -> 2022.5.17
This is unfortunately more complex than a simple version bump because upstream has not released a dist tarball for this release. This commit switches to using the github source and running autoreconf ourselves. Along the way, stop randomly patching sources and Makefiles and instead switch to upstreamable alternatives. The two (small) build system patches have been sent upstream, see tuxera/ntfs-3g#39.
Diffstat (limited to 'pkgs/tools/filesystems/ntfs-3g')
-rw-r--r-- | pkgs/tools/filesystems/ntfs-3g/autoconf-sbin-helpers.patch | 98 | ||||
-rw-r--r-- | pkgs/tools/filesystems/ntfs-3g/consistent-sbindir-usage.patch | 48 | ||||
-rw-r--r-- | pkgs/tools/filesystems/ntfs-3g/default.nix | 41 |
3 files changed, 171 insertions, 16 deletions
diff --git a/pkgs/tools/filesystems/ntfs-3g/autoconf-sbin-helpers.patch b/pkgs/tools/filesystems/ntfs-3g/autoconf-sbin-helpers.patch new file mode 100644 index 0000000000000..5e896063ba6a7 --- /dev/null +++ b/pkgs/tools/filesystems/ntfs-3g/autoconf-sbin-helpers.patch @@ -0,0 +1,98 @@ +diff --git a/configure.ac b/configure.ac +index 9aa25bd5..c7c0437b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -185,6 +185,30 @@ AC_ARG_ENABLE( + ] + ) + ++AC_ARG_WITH( ++ [mount-helper], ++ [AS_HELP_STRING([--with-mount-helper=BIN],[use the specified binary as mount helper @<:@default=/sbin/mount@:>@])], ++ [mount_helper="$withval"], ++ [mount_helper="/sbin/mount"] ++) ++AC_DEFINE_UNQUOTED([MOUNT_HELPER], ["$mount_helper"], [Binary used as mount helper.]) ++ ++AC_ARG_WITH( ++ [umount-helper], ++ [AS_HELP_STRING([--with-umount-helper=BIN],[use the specified binary as umount helper @<:@default=/sbin/umount@:>@])], ++ [umount_helper="$withval"], ++ [umount_helper="/sbin/umount"] ++) ++AC_DEFINE_UNQUOTED([UMOUNT_HELPER], ["$umount_helper"], [Binary used as umount helper.]) ++ ++AC_ARG_WITH( ++ [modprobe-helper], ++ [AS_HELP_STRING([--with-modprobe-helper=BIN],[use the specified binary as modprobe helper @<:@default=/sbin/modprobe@:>@])], ++ [modprobe_helper="$withval"], ++ [modprobe_helper="/sbin/modprobe"] ++) ++AC_DEFINE_UNQUOTED([MODPROBE_HELPER], ["$modprobe_helper"], [Binary used as modprobe helper.]) ++ + # pthread_rwlock_t requires _GNU_SOURCE + AC_GNU_SOURCE + +diff --git a/libfuse-lite/mount_util.c b/libfuse-lite/mount_util.c +index 8b317224..ee75ace6 100644 +--- a/libfuse-lite/mount_util.c ++++ b/libfuse-lite/mount_util.c +@@ -89,10 +89,10 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname, + exit(1); + } + rmdir(tmp); +- execle("/sbin/mount", "/sbin/mount", "-F", type, "-o", opts, ++ execle(MOUNT_HELPER, MOUNT_HELPER, "-F", type, "-o", opts, + fsname, mnt, NULL, &env); +- fprintf(stderr, "%s: failed to execute /sbin/mount: %s\n", progname, +- strerror(errno)); ++ fprintf(stderr, "%s: failed to execute %s: %s\n", progname, ++ MOUNT_HELPER, strerror(errno)); + exit(1); + } + res = waitpid(res, &status, 0); +@@ -126,14 +126,14 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy) + + setuid(geteuid()); + if (lazy) { +- execle("/sbin/umount", "/sbin/umount", mnt, ++ execle(UMOUNT_HELPER, UMOUNT_HELPER, mnt, + NULL, &env); + } else { +- execle("/sbin/umount", "/sbin/umount", "-f", mnt, ++ execle(UMOUNT_HELPER, UMOUNT_HELPER, "-f", mnt, + NULL, &env); + } +- fprintf(stderr, "%s: failed to execute /sbin/umount: %s\n", progname, +- strerror(errno)); ++ fprintf(stderr, "%s: failed to execute %s: %s\n", progname, ++ UMOUNT_HELPER, strerror(errno)); + exit(1); + } + res = waitpid(res, &status, 0); +diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c +index 9330500c..dd18a93f 100644 +--- a/src/lowntfs-3g.c ++++ b/src/lowntfs-3g.c +@@ -4463,7 +4463,7 @@ static fuse_fstype load_fuse_module(void) + int i; + struct stat st; + pid_t pid; +- const char *cmd = "/sbin/modprobe"; ++ const char *cmd = MODPROBE_HELPER; + char *env = (char*)NULL; + struct timespec req = { 0, 100000000 }; /* 100 msec */ + fuse_fstype fstype; +diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c +index d8227e71..f5d77252 100644 +--- a/src/ntfs-3g.c ++++ b/src/ntfs-3g.c +@@ -4171,7 +4171,7 @@ static fuse_fstype load_fuse_module(void) + int i; + struct stat st; + pid_t pid; +- const char *cmd = "/sbin/modprobe"; ++ const char *cmd = MODPROBE_HELPER; + char *env = (char*)NULL; + struct timespec req = { 0, 100000000 }; /* 100 msec */ + fuse_fstype fstype; diff --git a/pkgs/tools/filesystems/ntfs-3g/consistent-sbindir-usage.patch b/pkgs/tools/filesystems/ntfs-3g/consistent-sbindir-usage.patch new file mode 100644 index 0000000000000..29a35ecb1dd10 --- /dev/null +++ b/pkgs/tools/filesystems/ntfs-3g/consistent-sbindir-usage.patch @@ -0,0 +1,48 @@ +diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am +index 08228322..a390d8c7 100644 +--- a/ntfsprogs/Makefile.am ++++ b/ntfsprogs/Makefile.am +@@ -165,7 +165,7 @@ extras: libs $(EXTRA_PROGRAMS) + + if ENABLE_MOUNT_HELPER + install-exec-hook: +- $(INSTALL) -d $(DESTDIR)/$(sbindir) ++ $(INSTALL) -d $(DESTDIR)$(sbindir) + $(LN_S) -f $(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs + + install-data-hook: +@@ -173,7 +173,7 @@ install-data-hook: + $(LN_S) -f mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + + uninstall-local: +- $(RM) -f $(DESTDIR)/sbin/mkfs.ntfs ++ $(RM) -f $(DESTDIR)$(sbindir)/mkfs.ntfs + $(RM) -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + endif + +diff --git a/src/Makefile.am b/src/Makefile.am +index 8d984083..ea407067 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -66,9 +66,9 @@ endif + + if ENABLE_MOUNT_HELPER + install-exec-local: install-rootbinPROGRAMS +- $(MKDIR_P) "$(DESTDIR)/sbin" +- $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g" +- $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g" ++ $(MKDIR_P) "$(DESTDIR)$(rootsbindir)" ++ $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)$(rootsbindir)/mount.ntfs-3g" ++ $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)$(rootsbindir)/mount.lowntfs-3g" + + install-data-local: install-man8 + $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8" +@@ -76,7 +76,7 @@ install-data-local: install-man8 + + uninstall-local: + $(RM) -f "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8" +- $(RM) -f "$(DESTDIR)/sbin/mount.ntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g" ++ $(RM) -f "$(DESTDIR)$(rootsbindir)/mount.ntfs-3g" "$(DESTDIR)$(rootsbindir)/mount.lowntfs-3g" + endif + + endif # ENABLE_NTFS_3G diff --git a/pkgs/tools/filesystems/ntfs-3g/default.nix b/pkgs/tools/filesystems/ntfs-3g/default.nix index de110f61dd81c..fe0ae20f557ba 100644 --- a/pkgs/tools/filesystems/ntfs-3g/default.nix +++ b/pkgs/tools/filesystems/ntfs-3g/default.nix @@ -1,30 +1,34 @@ -{ lib, stdenv, fetchurl, pkg-config, mount, libuuid -, macfuse-stubs, DiskArbitration +{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config +, gettext, mount, libuuid, kmod, macfuse-stubs, DiskArbitration , crypto ? false, libgcrypt, gnutls }: stdenv.mkDerivation rec { pname = "ntfs3g"; - version = "2021.8.22"; + version = "2022.5.17"; outputs = [ "out" "dev" "man" "doc" ]; - buildInputs = [ libuuid ] ++ lib.optionals crypto [ gnutls libgcrypt ] + src = fetchFromGitHub { + owner = "tuxera"; + repo = "ntfs-3g"; + rev = version; + sha256 = "sha256-xh8cMNIHeJ1rtk5zwOsmcxeedgZ3+MSiWn2UC7y+gtQ="; + }; + + buildInputs = [ gettext libuuid ] + ++ lib.optionals crypto [ gnutls libgcrypt ] ++ lib.optionals stdenv.isDarwin [ macfuse-stubs DiskArbitration ]; - nativeBuildInputs = [ pkg-config ]; - src = fetchurl { - url = "https://tuxera.com/opensource/ntfs-3g_ntfsprogs-${version}.tgz"; - sha256 = "55b883aa05d94b2ec746ef3966cb41e66bed6db99f22ddd41d1b8b94bb202efb"; - }; + # Note: libgcrypt is listed here non-optionally because its m4 macros are + # being used in ntfs-3g's configure.ac. + nativeBuildInputs = [ autoreconfHook libgcrypt pkg-config ]; - patchPhase = '' - substituteInPlace src/Makefile.in --replace /sbin '@sbindir@' - substituteInPlace ntfsprogs/Makefile.in --replace /sbin '@sbindir@' - substituteInPlace libfuse-lite/mount_util.c \ - --replace /bin/mount ${mount}/bin/mount \ - --replace /bin/umount ${mount}/bin/umount - ''; + patches = [ + # https://github.com/tuxera/ntfs-3g/pull/39 + ./autoconf-sbin-helpers.patch + ./consistent-sbindir-usage.patch + ]; configureFlags = [ "--disable-ldconfig" @@ -34,6 +38,9 @@ stdenv.mkDerivation rec { "--enable-xattr-mappings" "--${if crypto then "enable" else "disable"}-crypto" "--enable-extras" + "--with-mount-helper=${mount}/bin/mount" + "--with-umount-helper=${mount}/bin/umount" + "--with-modprobe-helper=${kmod}/bin/modprobe" ]; postInstall = @@ -42,6 +49,8 @@ stdenv.mkDerivation rec { ln -sv mount.ntfs-3g $out/sbin/mount.ntfs ''; + enableParallelBuilding = true; + meta = with lib; { homepage = "https://github.com/tuxera/ntfs-3g"; description = "FUSE-based NTFS driver with full write support"; |