aboutsummaryrefslogtreecommitdiffstats
path: root/community/crystal/makefile-shell.patch
blob: 84b2b7984832b5c522ebf5d8fd887befba540379 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From 80f94f33956a758444f6c6918036b41288cd4da9 Mon Sep 17 00:00:00 2001
From: Julien Reichardt <mi@jrei.ch>
Date: Tue, 2 Jan 2018 14:52:14 +0100
Subject: [PATCH] Change from `bash` to `sh` (#5468)

* Removes bash as a dependency
* Better compliance to POSIX

diff --git a/Makefile b/Makefile
index a4b2281dc1..a6b2f5d1d4 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,8 @@ SOURCES := $(shell find src -name '*.cr')
 SPEC_SOURCES := $(shell find spec -name '*.cr')
 FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )
 SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )
-EXPORTS := $(if $(release),,CRYSTAL_CONFIG_PATH=`pwd`/src)
-SHELL = bash
+EXPORTS := $(if $(release),,CRYSTAL_CONFIG_PATH=$PWD/src)
+SHELL = sh
 LLVM_CONFIG_FINDER := \
   [ -n "$(LLVM_CONFIG)" ] && command -v "$(LLVM_CONFIG)" || \
   command -v llvm-config-4.0 || command -v llvm-config40 || \
@@ -118,7 +118,7 @@ $(O)/crystal: $(DEPS) $(SOURCES)
 	$(BUILD_PATH) $(EXPORTS) ./bin/crystal build $(FLAGS) -o $@ src/compiler/crystal.cr -D without_openssl -D without_zlib
 
 $(LLVM_EXT_OBJ): $(LLVM_EXT_DIR)/llvm_ext.cc
-	$(CXX) -c $(CXXFLAGS) -o $@ $< `$(LLVM_CONFIG) --cxxflags`
+	$(CXX) -c $(CXXFLAGS) -o $@ $< $(shell $(LLVM_CONFIG) --cxxflags)
 
 $(LIB_CRYSTAL_TARGET): $(LIB_CRYSTAL_OBJS)
 	$(AR) -rcs $@ $^
diff --git a/Vagrantfile b/Vagrantfile
index 83bcf8c3ce..859f682dbf 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -15,7 +15,7 @@ Vagrant.configure("2") do |config|
       c.vm.box = "ubuntu/#{box_name}"
 
       c.vm.provision :shell, inline: %(
-        curl -s https://dist.crystal-lang.org/apt/setup.sh | bash
+        curl -s https://dist.crystal-lang.org/apt/setup.sh | sh
         apt-get install -y crystal git libgmp3-dev zlib1g-dev libedit-dev libxml2-dev libssl-dev libyaml-dev libreadline-dev g++
         curl -s https://crystal-lang.s3.amazonaws.com/llvm/llvm-3.5.0-1-linux-`uname -m`.tar.gz | tar xz -C /opt
         echo 'export LIBRARY_PATH="/opt/crystal/embedded/lib"' > /etc/profile.d/crystal.sh
diff --git a/bin/crystal b/bin/crystal
index 698ed9b2b3..c901d9b37f 100755
--- a/bin/crystal
+++ b/bin/crystal
@@ -37,7 +37,7 @@ _resolve_symlinks() {
 
     local dir_context path
     path=$(readlink -- "$1")
-    if [ $? -eq 0 ]; then
+    if [ $? = 0 ]; then
         dir_context=$(dirname -- "$1")
         _resolve_symlinks "$(_prepend_dir_context_if_necessary "$dir_context" "$path")" "$@"
     else
@@ -141,16 +141,13 @@ CRYSTAL_DIR="$CRYSTAL_ROOT/.build"
 export CRYSTAL_PATH=$CRYSTAL_ROOT/src:lib
 export CRYSTAL_HAS_WRAPPER=true
 
-if [ -x "$CRYSTAL_DIR/crystal" ]
-then
+if [ -x "$CRYSTAL_DIR/crystal" ]; then
   __warning_msg "Using compiled compiler at \`.build/crystal'"
   exec "$CRYSTAL_DIR/crystal" "$@"
-elif ! command -v crystal > /dev/null
-then
+elif ! command -v crystal > /dev/null; then
   __error_msg 'You need to have a crystal executable in your path!'
   exit 1
-elif [ "$(command -v crystal)" = "$SCRIPT_PATH" ] || [ "$(command -v crystal)" = "bin/crystal" ]
-then
+elif [ "$(command -v crystal)" = "$SCRIPT_PATH" ] || [ "$(command -v crystal)" = "bin/crystal" ]; then
   export PATH="$(remove_path_item "$(remove_path_item "$PATH" "$SCRIPT_ROOT")" "bin")"
   exec "$SCRIPT_PATH" "$@"
 else