aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
commit500caaeda74dd9c660279036293f4b2997cf0b03 (patch)
tree1226f60231a408b0aae67867faaa3f2cfbac8c83 /vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh
parent413560591fc2d89a73eb8a33ba28b0cc3407b1db (diff)
Add vendor
Diffstat (limited to 'vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh')
-rwxr-xr-xvendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh b/vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh
new file mode 100755
index 0000000..78e6cff
--- /dev/null
+++ b/vendor/github.com/kylelemons/gousb/fixlibusb_darwin.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+function die {
+ echo "$@"
+ exit 1
+}
+
+FILE="$1"
+if [[ -z "$FILE" ]]; then
+ die "Usage: $0 <path to libusb.h>"
+fi
+
+if [[ $(gcc --version | grep -i "llvm") == "" ]]; then
+ die "Error: This change is unnecessary unless your gcc uses llvm"
+fi
+
+BACKUP="${FILE}.orig"
+if [[ -f "$BACKUP" ]]; then
+ die "It looks like you've already run this script ($BACKUP exists)"
+fi
+
+cp $FILE $BACKUP || die "Could not create backup"
+
+{
+ echo 'H' # Turn on error printing
+ echo 'g/\[0\].*non-standard/s/\[0\]/[1]/' # Use [1] instead of [0] so the size is unambiguous
+ echo 'g/\[.\].*non-standard/p' # Print the lines changed
+ echo 'w' # Write output
+} | ed $FILE