mac build changes
This commit is contained in:
15
build.sh
15
build.sh
@@ -52,6 +52,21 @@ if [[ "${1:-}" == "--linux-release" ]]; then
|
|||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for --mac-release flag for macOS release build (must be run on macOS)
|
||||||
|
if [[ "${1:-}" == "--mac-release" ]]; then
|
||||||
|
check_and_clean_target "macos-release"
|
||||||
|
shift
|
||||||
|
if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||||
|
echo "ERROR: --mac-release must be run on a native macOS system."
|
||||||
|
echo " Copy this repo to a Mac and run: ./build.sh --mac-release $*"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Building macOS release natively..."
|
||||||
|
./util/build-mac.sh "$@"
|
||||||
|
echo "macOS release build complete."
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
# run correct build script for detected OS
|
# run correct build script for detected OS
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
check_and_clean_target "linux"
|
check_and_clean_target "linux"
|
||||||
|
|||||||
@@ -51,8 +51,12 @@ LIBHUSH=libhush.a
|
|||||||
if TARGET_WINDOWS
|
if TARGET_WINDOWS
|
||||||
LIBRANDOMX=RandomX/build-win64/librandomx.a
|
LIBRANDOMX=RandomX/build-win64/librandomx.a
|
||||||
else
|
else
|
||||||
|
if TARGET_DARWIN
|
||||||
|
LIBRANDOMX=RandomX/build-darwin/librandomx.a
|
||||||
|
else
|
||||||
LIBRANDOMX=RandomX/build-linux/librandomx.a
|
LIBRANDOMX=RandomX/build-linux/librandomx.a
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if BUILD_BITCOIN_LIBS
|
if BUILD_BITCOIN_LIBS
|
||||||
LIBZCASH_CONSENSUS=libzcashconsensus.la
|
LIBZCASH_CONSENSUS=libzcashconsensus.la
|
||||||
|
|||||||
@@ -1,10 +1,37 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2016-2024 The Hush developers
|
# Copyright (c) 2016-2026 The Hush developers
|
||||||
# Distributed under the GPLv3 software license, see the accompanying
|
# Distributed under the GPLv3 software license, see the accompanying
|
||||||
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
#
|
||||||
|
# Native macOS build script.
|
||||||
|
# Requires: Xcode Command Line Tools, cmake, autoconf, automake, libtool, pkgconfig
|
||||||
|
# Optional: Homebrew GCC (brew install gcc) for better C++ compatibility
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
# --- Detect architecture ---
|
||||||
|
ARCH=$(uname -m) # arm64 or x86_64
|
||||||
|
|
||||||
|
# --- Detect compiler ---
|
||||||
|
# Prefer Homebrew GCC if available, otherwise use system clang
|
||||||
|
if command -v brew &>/dev/null; then
|
||||||
|
# Find newest Homebrew GCC version
|
||||||
|
GCC_PATH=$(ls -d /opt/homebrew/bin/gcc-[0-9]* /usr/local/bin/gcc-[0-9]* 2>/dev/null | sort -t- -k2 -n | tail -1 || true)
|
||||||
|
GXX_PATH=$(echo "$GCC_PATH" | sed 's/gcc-/g++-/')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${GCC_PATH:-}" ] && [ -x "$GCC_PATH" ]; then
|
||||||
|
export CC="$GCC_PATH"
|
||||||
|
export CXX="$GXX_PATH"
|
||||||
|
echo "Using Homebrew GCC: $CC / $CXX"
|
||||||
|
EXTRA_CXXFLAGS="-fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g"
|
||||||
|
else
|
||||||
|
export CC=clang
|
||||||
|
export CXX=clang++
|
||||||
|
echo "Using system clang: $CC / $CXX"
|
||||||
|
EXTRA_CXXFLAGS="-fwrapv -fno-strict-aliasing -Werror -g"
|
||||||
|
fi
|
||||||
|
|
||||||
export CC=gcc-8
|
|
||||||
export CXX=g++-8
|
|
||||||
export LIBTOOL=libtool
|
export LIBTOOL=libtool
|
||||||
export AR=ar
|
export AR=ar
|
||||||
export RANLIB=ranlib
|
export RANLIB=ranlib
|
||||||
@@ -12,8 +39,6 @@ export STRIP=strip
|
|||||||
export OTOOL=otool
|
export OTOOL=otool
|
||||||
export NM=nm
|
export NM=nm
|
||||||
|
|
||||||
set -eu -o pipefail
|
|
||||||
|
|
||||||
if [ "x$*" = 'x--help' ]
|
if [ "x$*" = 'x--help' ]
|
||||||
then
|
then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -53,22 +78,22 @@ echo $PWD
|
|||||||
./makecustom
|
./makecustom
|
||||||
cd $WD
|
cd $WD
|
||||||
|
|
||||||
# Build RandomX
|
# Build RandomX for macOS
|
||||||
cd src/RandomX
|
cd src/RandomX
|
||||||
if [ -d "build" ]
|
if [ -f "build-darwin/librandomx.a" ]
|
||||||
then
|
then
|
||||||
ls -la build/librandomx*
|
ls -la build-darwin/librandomx*
|
||||||
else
|
else
|
||||||
mkdir build && cd build
|
mkdir -p build-darwin && cd build-darwin
|
||||||
CC="${CC} -g " CXX="${CXX} -g " cmake ..
|
CC="${CC} -g " CXX="${CXX} -g " cmake -DARCH=native ..
|
||||||
make
|
make
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $WD
|
cd $WD
|
||||||
|
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
|
CPPFLAGS="-I$PREFIX/include" LDFLAGS="-L$PREFIX/lib -Wl,-undefined -Wl,dynamic_lookup" \
|
||||||
CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \
|
CXXFLAGS="${EXTRA_CXXFLAGS} -I$PREFIX/include" \
|
||||||
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
|
./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG"
|
||||||
|
|
||||||
make "$@" V=1 NO_GTEST=1 STATIC=1
|
make "$@" V=1 NO_GTEST=1 STATIC=1
|
||||||
|
|||||||
Reference in New Issue
Block a user