From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_SBL,URIBL_SBL_A shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D0DE61FFAD for ; Fri, 18 Dec 2020 12:09:52 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 23/26] build: add lei.sh + "make symlink-install" target Date: Fri, 18 Dec 2020 12:09:47 +0000 Message-Id: <20201218120950.23272-24-e@80x24.org> In-Reply-To: <20201218120950.23272-1-e@80x24.org> References: <20201218120950.23272-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This could've been done ages ago, but I rarely invoked public-inbox-* commands from an interactive terminal like I would with lei. --- MANIFEST | 1 + Makefile.PL | 11 +++++++++++ lei.sh | 7 +++++++ 3 files changed, 19 insertions(+) create mode 100755 lei.sh diff --git a/MANIFEST b/MANIFEST index 1834e7bb..e2d4ef72 100644 --- a/MANIFEST +++ b/MANIFEST @@ -102,6 +102,7 @@ examples/unsubscribe-psgi@.service examples/unsubscribe.milter examples/unsubscribe.psgi examples/varnish-4.vcl +lei.sh lib/PublicInbox/Address.pm lib/PublicInbox/AddressPP.pm lib/PublicInbox/Admin.pm diff --git a/Makefile.PL b/Makefile.PL index 8e710df2..a1a9161f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -223,5 +223,16 @@ Makefile.PL : MANIFEST touch -r MANIFEST \$@ \$(PERLRUN) \$@ +# Install symlinks to ~/bin (which is hopefuly in PATH) which point to +# this source tree. +# prefix + bindir matches git.git Makefile: +prefix = \$(HOME) +bindir = \$(prefix)/bin +symlink-install : + mkdir -p \$(bindir) + lei=\$\$(realpath lei.sh) && cd \$(bindir) && \\ + for x in \$(EXE_FILES); do \\ + ln -sf "\$\$lei" \$\$(basename "\$\$x"); \\ + done EOF } diff --git a/lei.sh b/lei.sh new file mode 100755 index 00000000..f1510a73 --- /dev/null +++ b/lei.sh @@ -0,0 +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=$(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