From: Habib Alamin <ha.alamin@gmail.com>

This patchset fixes the Makefile's use of install to be compatible with
BSD install by removing some flags which turned out to be not just
incompatible, but also unnecessary in this case.

I have tested this on macOS 12.1, but not GNU install, so while this
fixes the Makefile for BSD isntall, it's possible it has regressed on
GNU install, but I have outlined the justification for each change in
the respective patch's commit message.

Habib Alamin (2):
  Fix BSD install error when mixing `-d` and `-C` (via `-p`)
  Fix BSD install error when using `-t` option

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Seems like this doesn't regress with GNU tools. Both patches pushed, thanks!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/hut-dev/patches/31403/mbox | git am -3
Learn more about email & git

[PATCH 1/2] Fix BSD install error when mixing `-d` and `-C` (via `-p`) Export this patch

From: Habib Alamin <ha.alamin@gmail.com>

>install: the -d and -C options may not be specified together

This is because of the `-p` flag on the first `install` command line;

>     -p      Preserve the modification time.  Copy the file, as if the -C
>             (compare and copy) option is specified, except if the target file
>             doesn't already exist or is different, then preserve the
>             modification time of the file.

This reads to me like the target file will have the same modification
time as the source file, so at first, I thought we're copying
directories across and we want to preserve the modification times of the
directories, but even after a `make`, the directories being installed
don't exist in the repo directory, they're just being created directly
on the target path. Using the `-p` flag is just pointless in this case.
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 07947a0..5565e63 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ clean:
	$(RM) -f hut doc/hut.1 hut.bash hut.zsh hut.fish

	$(INSTALL) -dp \
	$(INSTALL) -d \
		$(DESTDIR)$(PREFIX)/$(MANDIR)/man1/ \

[PATCH 2/2] Fix BSD install error when using `-t` option Export this patch

From: Habib Alamin <ha.alamin@gmail.com>

>install: -t: No such file or directory

BSD install doesn't have the `-t` option, but according to the GNU info
page for `install`:

>   • If the ‘--target-directory’ (‘-t’) option is given, or failing that
>     if the last file is a directory and the ‘--no-target-directory’
>     (‘-T’) option is not given, ‘install’ copies each SOURCE file to
>     the specified directory, using the SOURCEs’ names.

The directories are strictly specified with a trailing slash, and I
suspect if the directory didn't exist, GNU install would still treat
it as a directory and complain about it being missing. That said, we
don't need to rely on that because the previous line which gives us the
error about combining `-C` and `-d` is exactly the line that creates the
required directories.
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 5565e63..90ddaef 100644
--- a/Makefile
+++ b/Makefile
@@ -42,8 +42,8 @@ install:
	$(INSTALL) -pm 0755 hut -t $(DESTDIR)$(PREFIX)/$(BINDIR)/
	$(INSTALL) -pm 0644 doc/hut.1 -t $(DESTDIR)$(PREFIX)/$(MANDIR)/man1/
	$(INSTALL) -pm 0755 hut $(DESTDIR)$(PREFIX)/$(BINDIR)/
	$(INSTALL) -pm 0644 doc/hut.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1/
	$(INSTALL) -pm 0644 hut.bash $(DESTDIR)$(BASHCOMPDIR)/hut
	$(INSTALL) -pm 0644 hut.zsh $(DESTDIR)$(ZSHCOMPDIR)/_hut
	$(INSTALL) -pm 0644 hut.fish $(DESTDIR)$(FISHCOMPDIR)/hut.fish
Seems like this doesn't regress with GNU tools. Both patches pushed, thanks!