From 69348dc2d4ed81a7d8dd68382c0606c6281b60b7 Mon Sep 17 00:00:00 2001 From: Mike Small Date: Fri, 3 Jul 2020 11:45:52 -0400 Subject: [PATCH] Handle Slackware 14.2 in a cleaner way via pkgsrc Didn't like the hack I was using to work around an old perl before. So when I noticed that using pkgsrc in Slackware pretty soon puts down a recent perl as a dependency to many things I decided that using that would be better than overlaying a newer List::Util version on perl 5.22. This change detects the newest perl on the system at install time and puts that in the script interpreter line. It removes the wrapper that included a library tree with new versions of core Perl modules. --- Makefile | 19 ++++++++++--------- frfac => frfac.in | 2 +- frfac.wrapper | 13 ------------- latest_perl | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 23 deletions(-) rename frfac => frfac.in (98%) delete mode 100644 frfac.wrapper create mode 100755 latest_perl diff --git a/Makefile b/Makefile index 4c0006f..70e6992 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,16 @@ -check: - perl -wc frfac - perlcritic frfac +frfac: + sed "1d;2i #!`./latest_perl`" frfac.in > frfac -install: +check: + `./latest_perl` -wc frfac.in + perlcritic frfac.in + +install: frfac install -o root -g wheel -m 0755 -d /usr/local/bin install -o root -g wheel -m 0555 frfac /usr/local/bin -install_with_newcore_hack: - install -o root -g wheel -m 0755 -d /usr/local/bin - install -o root -g wheel -m 0555 frfac /usr/local/share/perl5/ - install -o root -g wheel -m 0555 frfac.wrapper /usr/local/bin/frfac +clean: + rm -f frfac uninstall: - rm -f /usr/local/bin/frfac /usr/local/share/perl5/frfac + rm -f /usr/local/bin/frfac diff --git a/frfac b/frfac.in similarity index 98% rename from frfac rename to frfac.in index 6c51f09..3080f03 100755 --- a/frfac +++ b/frfac.in @@ -1,4 +1,4 @@ -#!/usr/bin/env perl +#!/usr/bin/perl # Print the URI of the most recent rfi francais facile episode. # Feed this to a downloader. (This script doesn't itself download.) diff --git a/frfac.wrapper b/frfac.wrapper deleted file mode 100644 index 9e72736..0000000 --- a/frfac.wrapper +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Use a newer List::Util than that in core of the -# system Perl. E.g. Slackware 14.2's perl is -# 5.22.2 and only has version 1.41 of List::Util. -# That version lacks the uniq function. -# The directory /usr/local/share/newperlcore is -# expected to have a new List::Util under it -# install via... -# perl Makefile.PL INSTALL_BASE=/usr/local/share/newperlcore - -perl -I /usr/local/share/newperlcore /usr/local/share/perl5/frfac - diff --git a/latest_perl b/latest_perl new file mode 100755 index 0000000..3dff960 --- /dev/null +++ b/latest_perl @@ -0,0 +1,15 @@ +#!/bin/sh +bestv=0 +for p in $(whereis perl) +do + if [ "$p" != "${p%bin/perl}" ]; + then + v=$($p -V:PERL_VERSION | sed "s/[^']*'//;s/'.*\$//") + if [ $v -gt $bestv ]; then + best=$p + bestv=$($p -V:PERL_VERSION | + sed "s/[^']*'//;s/'.*\$//") + fi + fi +done +echo $best