From 32648505f4b4fe27dd45a13b182bf1376acad586 Mon Sep 17 00:00:00 2001 From: Jason Coombs Date: Thu, 30 Jun 2016 15:28:49 -1000 Subject: [PATCH 1/4] Revised for compatibility with MSYS2/MINGW64 without MSYS=winsymlinks:nativestrict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Please see: https://sourceforge.net/p/msys2/tickets/41/ When the following is NOT enabled (when the line has NOT been uncommented) symlinks are unavailable in MSYS2 shell for WIN32 compatibility. rem To activate windows native symlinks uncomment next line rem set MSYS=winsymlinks:nativestrict which results in the following error due to the nested recursive symlinks within go-ethereum/build/ when _workspace/ was being created there: ``` JasonCoombs@Kauri_Forest MINGW64 ~/go-ethereum/build/_workspace/src/github.com/ethereum $ ln -s "/home/JasonCoombs/go-ethereum" go-ethereum ln: failed to create symbolic link ‘go-ethereum’ -> ‘/home/JasonCoombs/go-ethereum’: File name too long ``` The solution, for compatibility with MSYS2/MINGW64 in its default WIN32 mode of operation, is to set up fake Go workspace outside of $root Beware, MINGW64! FlashGordonW64 is coming to git you. Flash! Ah ahhhhh! The savior of the universe! @ForestMade #SuperHero64 --- build/env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/env.sh b/build/env.sh index c418dae441..c080689f6c 100755 --- a/build/env.sh +++ b/build/env.sh @@ -8,13 +8,13 @@ if [ ! -f "build/env.sh" ]; then fi # Create fake Go workspace if it doesn't exist yet. -workspace="$PWD/build/_workspace" +workspace="$PWD/../_go_build/_workspace" root="$PWD" ethdir="$workspace/src/github.com/ethereum" if [ ! -L "$ethdir/go-ethereum" ]; then mkdir -p "$ethdir" cd "$ethdir" - ln -s ../../../../../. go-ethereum + ln -s "$root" go-ethereum cd "$root" fi From 5d5ea2ffd0d31ef9df83276e893def93ff30c850 Mon Sep 17 00:00:00 2001 From: Jason Coombs Date: Thu, 30 Jun 2016 16:08:07 -1000 Subject: [PATCH 2/4] ensure mkdir build/bin -- for compatibility with MSYS2/MINGW64 if not exist $root/build/bin then mkdir --- build/env.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/env.sh b/build/env.sh index c080689f6c..ff8eb677d0 100755 --- a/build/env.sh +++ b/build/env.sh @@ -2,14 +2,20 @@ set -e -if [ ! -f "build/env.sh" ]; then +root="$PWD" + +if [ ! -f "$root/build/env.sh" ]; then echo "$0 must be run from the root of the repository." exit 2 fi +# Create build/bin if it doesn't exist yet. +if [ ! -L "$root/build/bin" ]; then + mkdir -p "$root/build/bin" +fi + # Create fake Go workspace if it doesn't exist yet. -workspace="$PWD/../_go_build/_workspace" -root="$PWD" +workspace="$root/../_go_build/_workspace" ethdir="$workspace/src/github.com/ethereum" if [ ! -L "$ethdir/go-ethereum" ]; then mkdir -p "$ethdir" From 9ce64fa6483ab87aa485415bae25638cdcffbe38 Mon Sep 17 00:00:00 2001 From: Jason Coombs Date: Thu, 30 Jun 2016 16:46:51 -1000 Subject: [PATCH 3/4] -a instead of -L - Bash conditional expressions see http://www.gnu.org/software/bash/manual/bashref.html#Bash-Conditional-Expressions --- build/env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/env.sh b/build/env.sh index ff8eb677d0..d0d9c31488 100755 --- a/build/env.sh +++ b/build/env.sh @@ -10,14 +10,14 @@ if [ ! -f "$root/build/env.sh" ]; then fi # Create build/bin if it doesn't exist yet. -if [ ! -L "$root/build/bin" ]; then +if [ ! -a "$root/build/bin" ]; then mkdir -p "$root/build/bin" fi # Create fake Go workspace if it doesn't exist yet. workspace="$root/../_go_build/_workspace" ethdir="$workspace/src/github.com/ethereum" -if [ ! -L "$ethdir/go-ethereum" ]; then +if [ ! -a "$ethdir/go-ethereum" ]; then mkdir -p "$ethdir" cd "$ethdir" ln -s "$root" go-ethereum From 4207f4b6c571638af8e0c60f520a02c3d6f35385 Mon Sep 17 00:00:00 2001 From: Jason Coombs Date: Thu, 30 Jun 2016 18:32:24 -1000 Subject: [PATCH 4/4] -e not -a -a did not work as expected but -e does. -e should detect existence of either symbolic link or directory and return true. see: http://www.gnu.org/software/bash/manual/bashref.html#Bash-Conditional-Expressions --- build/env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/env.sh b/build/env.sh index d0d9c31488..2cdd3553ec 100755 --- a/build/env.sh +++ b/build/env.sh @@ -10,14 +10,14 @@ if [ ! -f "$root/build/env.sh" ]; then fi # Create build/bin if it doesn't exist yet. -if [ ! -a "$root/build/bin" ]; then +if [ ! -e "$root/build/bin" ]; then mkdir -p "$root/build/bin" fi # Create fake Go workspace if it doesn't exist yet. workspace="$root/../_go_build/_workspace" ethdir="$workspace/src/github.com/ethereum" -if [ ! -a "$ethdir/go-ethereum" ]; then +if [ ! -e "$ethdir/go-ethereum" ]; then mkdir -p "$ethdir" cd "$ethdir" ln -s "$root" go-ethereum