Fix make deps on Windows License: MIT Signed-off-by: Dominic Della Valle <ddvpublic@gmail.com>
Fix make deps on Windows License: MIT Signed-off-by: Dominic Della Valle <ddvpublic@gmail.com>
Dominic Della Valle committed
Feb 10, 2018 at 21:22 UTC
e613e9dcfcb2619670089711abb3af54069957ca
2 files changed
+14
-3
bin/Rules.mk
+5
-1
@@ -11,8 +11,12 @@ DISTCLEAN += $(wildcard $(d)/gx-v*) $(wildcard $(d)/gx-go-v*) $(d)/tmp
11
PATH := $(realpath $(d)):$(PATH)
12
13
$(TGTS_$(d)):
14
- rm -f $@
14
+ rm -f $@$(?exe)
15
+ifeq ($(WINDOWS),1)
16
+ cp $^$(?exe) $@$(?exe)
17
+else
18
ln -s $(notdir $^) $@
19
+endif
20
21
bin/gx-v%:
22
@echo "installing gx $(@:bin/gx-%=%)"
bin/dist_get
+9
-2
@@ -57,6 +57,13 @@ unarchive() {
57
ua_infile="$2"
58
ua_outfile="$3"
59
ua_distname="$4"
60
+ ua_binpostfix=""
61
+ ua_os=$(uname -o)
62
+
63
+ if [ "$ua_os" = "Msys" ] || [ "$ua_os" = "Cygwin" ] ; then
64
+ ua_binpostfix=".exe"
65
+ fi
66
+ ua_outfile="$ua_outfile$ua_binpostfix"
67
68
if ! check_writeable "$ua_outfile"; then
69
die "unarchive error: cannot write to $ua_outfile"
@@ -66,7 +73,7 @@ unarchive() {
73
tar.gz)
74
if have_binary tar; then
75
echo "==> using 'tar' to extract binary from archive"
69
- < "$ua_infile" tar -Ozxf - "$ua_distname/$ua_distname" > "$ua_outfile" \
76
+ < "$ua_infile" tar -Ozxf - "$ua_distname/$ua_distname$ua_binpostfix" > "$ua_outfile" \
77
|| die "tar has failed"
78
else
79
die "no binary on system for extracting tar files"
@@ -75,7 +82,7 @@ unarchive() {
82
zip)
83
if have_binary unzip; then
84
echo "==> using 'unzip' to extract binary from archive"
78
- unzip -p "$ua_infile" "$ua_distname/$ua_distname" > "$ua_outfile" \
85
+ unzip -p "$ua_infile" "$ua_distname/$ua_distname$ua_binpostfix" > "$ua_outfile" \
86
|| die "unzip has failed"
87
else
88
die "no installed method for extracting .zip archives"