From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] makefile: symlink-install: do not depend on realpath
Date: Wed, 4 Oct 2023 17:46:35 +0000 [thread overview]
Message-ID: <20231004174635.3676071-1-e@80x24.org> (raw)
For the Makefile, we can use $(PWD) make macro from make(1posix)
as POSIX requires all environment variables be accessible as
macros, and $PWD is a standard sh(1) environment variable.
lei.sh must quiet the stderr of realpath before falling back to
readlink(1) which is available on NetBSD.
---
Makefile.PL | 2 +-
lei.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 8bd39e6c..38e030f5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -264,7 +264,7 @@ prefix = \$(HOME)
bindir = \$(prefix)/bin
symlink-install : lib/PublicInbox.pm
mkdir -p \$(bindir)
- lei=\$\$(realpath lei.sh) && cd \$(bindir) && \\
+ lei="\$(PWD)/lei.sh" && cd \$(bindir) && \\
for x in \$(EXE_FILES); do \\
ln -sf "\$\$lei" \$\$(basename "\$\$x"); \\
done
diff --git a/lei.sh b/lei.sh
index f1510a73..afb03f3e 100755
--- a/lei.sh
+++ b/lei.sh
@@ -1,7 +1,7 @@
#!/bin/sh -e
# symlink this file to a directory in PATH to run lei (or anything in script/*)
# without needing perms to install globally. Used by "make symlink-install"
-p=$(realpath "$0" || readlink "$0") # neither is POSIX, but common
+p=$(realpath "$0" 2>/dev/null || readlink "$0") # neither is POSIX, but common
p=$(dirname "$p") c=$(basename "$0") # both are POSIX
exec ${PERL-perl} -w -I"$p"/lib "$p"/script/"${c%.sh}" "$@"
: this script is too short to copyright
reply other threads:[~2023-10-04 17:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231004174635.3676071-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).