aboutsummaryrefslogtreecommitdiffstats
path: root/testing/racket/makefile-fix-bashism.patch
blob: 4f3ebbcfddf02d4e4599dfd2b8181caf7770e68a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 2ad51be9ccb1f0717732875edbb1bb0b33caa2a2 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 15 Mar 2018 01:24:49 +0100
Subject: [PATCH] Fix bashism in Makefile for better portability

Syntax `[[ "foo" != /* ]]` is not defined by POSIX Shell Command
Language. It's supported only by ksh, Bash and ZSH. Other POSIX
shells, such as ash or dash, does not support it.

This patch replaces this problematic syntax with simple case statement
that is supported by all POSIX-sh compatible shells, including (but not
limited to) ash, bash, dash, ZSH.

Upstream-Issue: https://github.com/racket/racket/pull/1990
---
 racket/src/Makefile.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/racket/src/Makefile.in b/racket/src/Makefile.in
index 76483c1793..24c2e5aeba 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -109,11 +109,10 @@ plain-install:
 	$(MAKE) plain-install-@MAIN_VARIANT@
 
 install-common-first:
-	if [ "$(DESTDIR)" != "" ]; then \
-          if [[ "$(DESTDIR)" != /* ]]; then \
-            echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1; \
-          fi; \
-        fi
+	case "$(DESTDIR)" in \
+	  "" | /*) ;; \
+	  *) echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1;; \
+        esac
 	mkdir -p $(ALLDIRINFO)
 
 install-common-middle: