From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3FE321F454 for ; Wed, 4 Oct 2023 17:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1696441595; bh=Q63ksosi+PmLNtsog+Sm0WrQ6Pz5ON4NrWtHxvMEqBk=; h=From:To:Subject:Date:From; b=f3ErR3HP8NYYtIKd62vaZPbaVp9KvEjW14fJMXKnjdWCbZg98DHjlzzPSSpkTJIAv er5SDD5O62cMPHf5bkkv3KiD05y5HycDCxL8WgirzFJooVwBxz7GJykF6uFL/h8ngm TH35lTw83KvuKk+5gx/6cY9OxVUqNN0eOwes7TFo= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] makefile: symlink-install: do not depend on realpath Date: Wed, 4 Oct 2023 17:46:35 +0000 Message-ID: <20231004174635.3676071-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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