Skip to content

Instantly share code, notes, and snippets.

@coffnix
Created December 6, 2025 15:28
Show Gist options
  • Select an option

  • Save coffnix/72dc5939b2d1b1d665f0573ec0598597 to your computer and use it in GitHub Desktop.

Select an option

Save coffnix/72dc5939b2d1b1d665f0573ec0598597 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# prepara deps
brew list cmake >/dev/null 2>&1 || brew install cmake
brew list hwloc >/dev/null 2>&1 || brew install hwloc
brew list openssl@3 >/dev/null 2>&1 || brew install openssl@3
brew list libuv >/dev/null 2>&1 || brew install libuv
rm -rf xmrig
git clone --recursive https://github.com/xmrig/xmrig.git -b dev
cd xmrig
# patch força argon2 neon no armv9
ARGON=src/3rdparty/argon2/lib/argon2.c
git restore -- "$ARGON" 2>/dev/null || true
if ! grep -q 'XMRIG_FEATURE_ARGON2_NEON' "$ARGON"; then
tmpfile="$(mktemp)"
{
echo "#if defined(__aarch64__) || defined(__ARM_NEON) || defined(XMRIG_ARM)"
echo "#ifndef XMRIG_FEATURE_ARGON2_NEON"
echo "#define XMRIG_FEATURE_ARGON2_NEON 1"
echo "#endif"
echo "#endif"
cat "$ARGON"
} > "$tmpfile"
mv "$tmpfile" "$ARGON"
fi
# build limpa
rm -rf build
mkdir build
cd build
export CFLAGS="-O3 -Ofast -funroll-loops -mcpu=apple-m4"
export CXXFLAGS="$CFLAGS"
cmake .. \
-DXMRIG_ARM=ON \
-DWITH_OPENCL=ON \
-DWITH_HWLOC=ON \
-DOPENSSL_ROOT_DIR=\"$(brew --prefix openssl@3)\" \
-DHWLOC_ROOT=\"$(brew --prefix hwloc)\"
make -j"$(sysctl -n hw.ncpu)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment