Replace remote with local repo
This commit is contained in:
59
scripts/mkp224o-build.sh
Executable file
59
scripts/mkp224o-build.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cathugger/mkp224o (Tor v3 vanity .onion key generator) into vendor/mkp224o/mkp224o.
|
||||
# Requires: git, make, gcc or clang, autoconf, pkg-config, libsodium-dev (Debian: libsodium-dev)
|
||||
#
|
||||
# bash scripts/mkp224o-build.sh
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
VEND="${REPO}/vendor/mkp224o"
|
||||
BIN="${VEND}/mkp224o"
|
||||
|
||||
if [[ -x "${BIN}" ]]; then
|
||||
echo "Already built: ${BIN}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v git >/dev/null 2>&1; then
|
||||
echo "Install git and retry."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${REPO}/vendor"
|
||||
if [[ ! -d "${VEND}/.git" ]]; then
|
||||
echo "[*] Cloning mkp224o..."
|
||||
git clone --depth 1 https://github.com/cathugger/mkp224o.git "${VEND}"
|
||||
fi
|
||||
|
||||
cd "${VEND}"
|
||||
if [[ ! -f "./configure" ]]; then
|
||||
if [[ -f "./autogen.sh" ]]; then
|
||||
echo "[*] autogen.sh..."
|
||||
./autogen.sh
|
||||
else
|
||||
echo "No configure/autogen in ${VEND}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "./Makefile" ]]; then
|
||||
echo "[*] configure..."
|
||||
# Prefer AMD64 fast curve implementation when available
|
||||
if ./configure --help 2>/dev/null | grep -q 'enable-amd64-64-24k'; then
|
||||
./configure --enable-amd64-64-24k
|
||||
else
|
||||
./configure
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[*] make -j \$(nproc)..."
|
||||
make -j"$(nproc)"
|
||||
|
||||
if [[ ! -x "${BIN}" ]]; then
|
||||
echo "Build failed: ${BIN} not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Built: ${BIN}"
|
||||
echo "Mine a prefix: bash ${REPO}/scripts/vanity-onion-mine.sh <prefix>"
|
||||
Reference in New Issue
Block a user