Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package binaries for various architectures to gem and npm packages #168

Merged
merged 6 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions .npm/bin/lefthook
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,50 @@

dir="$(cd "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"

UNAME=$(uname)
case "$UNAME" in
OS=$(uname -s)
ARCH=$(uname -m)
EXT=

# Detect OS
case $OS in
Linux)
"$dir/lefthook-linux" "$@"
GOOS=linux
;;
Darwin)
"$dir/lefthook-mac" "$@"
GOOS=darwin
;;
Windows*|CYGWIN*)
GOOS=windows
EXT=.exe
;;
Windows*)
"$dir/lefthook-win.exe" "$@"
*)
echo "Unsupported OS: ${OS}"
exit 1
;;
CYGWIN*)
"$dir/lefthook-win.exe" "$@"
esac

# Detect architecture
case $ARCH in
x86_64)
GOARCH=amd64
;;
x86)
GOARCH=386
;;
arm64)
GOOS=arm64
;;
*)
echo "Unsupported OS"
echo "Unsupported CPU architecture: ${ARCH}"
exit 1
;;
esac

executable="$dir/lefthook_${GOOS}_${GOARCH}/lefthook${EXT}"

if [ -x "$executable" ]; then
exec "$executable" "$@"
else
echo "Lefthook wasn't build for ${OS} ${ARCH}"
exit 1
fi
Loading