Skip to content

Commit

Permalink
Update build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga authored Jan 30, 2024
1 parent 043a34b commit 7a0ea25
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,15 @@
#!/usr/bin/env bash
set -euxo pipefail
# Remove all local files related to npm/node to avoid conflict
sudo rm -f "/usr/local/bin/node"
sudo rm -f "/usr/local/bin/npm"
sudo rm -f "/usr/local/bin/npx"
sudo rm -rf "/usr/local/include/node"
sudo rm -rf "/usr/local/lib/dtrace/node.d"
sudo rm -rf "/usr/local/lib/node_modules/npm"
sudo rm -rf "/usr/local/share/doc/node"
sudo rm -rf "/usr/local/share/man/man1/node.1"
sudo rm -rf "/usr/local/share/systemtap/tapset/node.stp"
# INSTALL latest brew

# Install latest brew
if [[ $(command -v brew) == "" ]]; then
echo "Installing brew in order to build MetaCall"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Found brew installation, skipping..."
fi
# uninstall npm/node/npm globally
brew uninstall npm &> /dev/null || echo "npm not installed"
brew uninstall node &> /dev/null || echo "node not installed"
brew unlink node@16 &> /dev/null || echo "brew node@16 probably not installed"
# Remove all files related to node
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/lib/node
sudo rm -rf /usr/local/bin/corepack

# Build metacall brew
HOMEBREW_NO_AUTO_UPDATE=1 brew install ./metacall.rb --build-from-source -dv
echo "Installing MetaCall with brew"

# Fixing linking brew step
# See: https://github.com/Homebrew/brew/issues/1742
brew install ./metacall.rb --build-from-source -v || brew link --overwrite ./metacall.rb
echo "Testing MetaCall"
./test.sh
# Removing build files
find /private/tmp/ -type d -name "metacall*" -exec rm -rf {} \;

0 comments on commit 7a0ea25

Please sign in to comment.