Skip to contentSkip to conversation

config.mak.uname: set PERL_PATH for FreeBSD 5.0+

PATCH In review Eric Wong 4 participants 6 messages Jul 20, 2016 – Jul 21, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 config.mak.uname: set PERL_PATH for FreeBSD 5.0+

Perl has not been part of the base system since FreeBSD 5.0:

	https://www.freebsd.org/releases/5.0R/relnotes-i386.html

---
Does anybody still run git on FreeBSD 4.x or earlier? 4.11 was released a few months before git in 2005:

https://www.freebsd.org/releases/

 config.mak.uname | 5 +++++
 1 file changed, 5 insertions(+)
config.mak.uname +5 -0
index a88f139..6c29545 100644
@@ -202,6 +202,11 @@ ifeq ($(uname_S),FreeBSD)
 		NO_UINTMAX_T = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
+	R_MAJOR := $(shell expr "$(uname_R)" : '\([0-9]*\)\.')
+
+	ifeq ($(shell test "$(R_MAJOR)" -ge 5 && echo 1),1)
+		PERL_PATH = /usr/local/bin/perl
+	endif
 	PYTHON_PATH = /usr/local/bin/python
 	HAVE_PATHS_H = YesPlease
 	GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
Signature · 1 line
EW
#1 lore raw

Hi Eric,

config.mak.uname ifeq ($(uname_S),FreeBSD) · line 209

Quoted 13 lines · Eric Wong
config.mak.uname +5 -0
index a88f139..6c29545 100644
@@ -202,6 +202,11 @@ ifeq ($(uname_S),FreeBSD)
 		NO_UINTMAX_T = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
+	R_MAJOR := $(shell expr "$(uname_R)" : '\([0-9]*\)\.')
+
+	ifeq ($(shell test "$(R_MAJOR)" -ge 5 && echo 1),1)
+		PERL_PATH = /usr/local/bin/perl
+	endif

In keeping with other uname_R usage, should this not read

# Since FreeBSD 5.0, Perl is part of the core ifneq ($(shell expr "$(uname_R)" : '[1-4]\.'),2)
PERL_PATH = /usr/local/bin/perl
endif

instead?

Ciao,
Dscho

author
#2 lore raw
Quoted 20 lines · Johannes Schindelin

Hi Eric,

config.mak.uname ifeq ($(uname_S),FreeBSD) · line 209

Quoted 13 lines · Eric Wong
config.mak.uname +5 -0
index a88f139..6c29545 100644
@@ -202,6 +202,11 @@ ifeq ($(uname_S),FreeBSD)
 		NO_UINTMAX_T = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
+	R_MAJOR := $(shell expr "$(uname_R)" : '\([0-9]*\)\.')
+
+	ifeq ($(shell test "$(R_MAJOR)" -ge 5 && echo 1),1)
+		PERL_PATH = /usr/local/bin/perl
+	endif

In keeping with other uname_R usage, should this not read

Quoted 6 lines

# Since FreeBSD 5.0, Perl is part of the core ifneq ($(shell expr "$(uname_R)" : '[1-4]\.'),2)
PERL_PATH = /usr/local/bin/perl
endif

instead?

That's fine; however I don't use expr often, so it required a little more time to realize the '2' means 2 characters were matched.

Also, my use of a numeric comparison may be more future-proof in case FreeBSD decides to have /usr/bin/perl again.

I also wonder why we don't use which to search for somewhat standard path components, instead. Something like:

  PERL_PATH = $(shell PATH=/bin:/usr/bin:/usr/local/bin which perl)
#3 lore raw
Quoted 5 lines · Eric Wong

Also, my use of a numeric comparison may be more future-proof in case FreeBSD decides to have /usr/bin/perl again.

I also wonder why we don't use which to search for somewhat standard path components, instead. Something like:

Because historically output from "which" was not meant to be machine parseable (some implementation said 'perl is /usr/bin/perl')

#4 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 5 lines · Eric Wong

Also, my use of a numeric comparison may be more future-proof in case FreeBSD decides to have /usr/bin/perl again.

I also wonder why we don't use which to search for somewhat standard path components, instead. Something like:

Because historically output from "which" was not meant to be machine parseable (some implementation said 'perl is /usr/bin/perl')

The POSIXy way to write which is "command -v", which may or may not be more portable. It does have the desired output, though.

Signature · 3 lines
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
#5 lore raw
In reply to Eric Wong

Hi Eric,

Quoted 25 lines · Eric Wong
Quoted 24 lines · Johannes Schindelin

config.mak.uname ifeq ($(uname_S),FreeBSD) · line 209

Quoted 13 lines · Eric Wong
config.mak.uname +5 -0
index a88f139..6c29545 100644
@@ -202,6 +202,11 @@ ifeq ($(uname_S),FreeBSD)
 		NO_UINTMAX_T = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
+	R_MAJOR := $(shell expr "$(uname_R)" : '\([0-9]*\)\.')
+
+	ifeq ($(shell test "$(R_MAJOR)" -ge 5 && echo 1),1)
+		PERL_PATH = /usr/local/bin/perl
+	endif

In keeping with other uname_R usage, should this not read

# Since FreeBSD 5.0, Perl is part of the core ifneq ($(shell expr "$(uname_R)" : '[1-4]\.'),2)
PERL_PATH = /usr/local/bin/perl
endif

Quoted 5 lines
Quoted 1 line

instead?

That's fine; however I don't use expr often, so it required a little more time to realize the '2' means 2 characters were matched.

I never use expr, so I had to go and see the surrounding code to determine what the code style is.

Quoted 2 lines

Also, my use of a numeric comparison may be more future-proof in case FreeBSD decides to have /usr/bin/perl again.

That is a very theoretical concern ;-)

Ciao,
Dscho