summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--README.md2
-rwxr-xr-xbuild_single.sh34
m---------external/libexpat0
-rwxr-xr-xexternal/macos/build_unbound.sh22
-rwxr-xr-xexternal/macos/config.sh5
6 files changed, 45 insertions, 21 deletions
diff --git a/.gitmodules b/.gitmodules
index cbb27eb..d9a8e69 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -31,3 +31,6 @@
[submodule "external/libzmq"]
path = external/libzmq
url = https://github.com/zeromq/libzmq
+[submodule "external/libexpat"]
+ path = external/libexpat
+ url = https://github.com/libexpat/libexpat.git
diff --git a/README.md b/README.md
index 4092b65..3a9b1a5 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ While building I aim to compile the code at oldest supported release of debian,
| x86_64-w64-mingw32 | debian:buster | -"- |
| x86_64-apple-darwin11 | debian:bookworm | extra build step: `${HOST_ABI}-ranlib $PWD/$repo/contrib/depends/${HOST_ABI}/lib/libpolyseed.a` |
| aarch64-apple-darwin11 | debian:bookworm | -"- |
-| host-apple-darwin | arm64-apple-darwin23 | dependencies: `brew install unbound boost@1.76 zmq && brew link boost@1.76` |
+| host-apple-darwin | arm64-apple-darwin23 | dependencies: `brew install unbound boost@1.76 zmq cmake ccache autoconf automake libtool && brew link boost@1.76` |
| host-apple-ios | arm64-apple-darwin23 | |
## Design
diff --git a/build_single.sh b/build_single.sh
index d98af2a..a8368da 100755
--- a/build_single.sh
+++ b/build_single.sh
@@ -2,6 +2,15 @@
cd "$(realpath $(dirname $0))"
+proccount=1
+if [[ "x$(uname)" == "xDarwin" ]];
+then
+ proccount=$(sysctl -n hw.physicalcpu)
+elif [[ "x$(uname)" == "xLinux" ]];
+then
+ proccount=$(nproc)
+fi
+
function verbose_copy() {
echo "==> cp $1 $2"
cp $1 $2
@@ -11,13 +20,13 @@ set -e
repo=$1
if [[ "x$repo" == "x" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$(nproc)"
+ echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
exit 1
fi
if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$(nproc)"
+ echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
echo "Invalid target given, only monero and wownero are supported targets"
fi
@@ -31,7 +40,7 @@ fi
HOST_ABI="$2"
if [[ "x$HOST_ABI" == "x" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$(nproc)"
+ echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
exit 1
fi
@@ -39,7 +48,7 @@ NPROC="$3"
if [[ "x$NPROC" == "x" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$(nproc)"
+ echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
exit 1
fi
cd $(dirname $0)
@@ -181,20 +190,19 @@ pushd $repo/contrib/depends
make $NPROC
popd
fi
- pushd ../../../external/macos
- ./build_unbound.sh
- popd
MACOS_LIBS_DIR="${PWD}/${HOST_ABI}"
rm -rf ${MACOS_LIBS_DIR}
mkdir -p ${MACOS_LIBS_DIR}/lib
- if [[ "x$HOMEBREW_PREFIX" == "x" ]];
+ if [[ "$(uname -m)" == "arm64" ]];
then
- export HOMEBREW_PREFIX=/opt/homebrew
- if [[ ! -d "$HOMEBREW_PREFIX" ]];
- then
- export HOMEBREW_PREFIX=/usr/local
- fi
+ export HOMEBREW_PREFIX="/opt/homebrew"
+ elif [[ "$(uname -m)" == "x86_64" ]];
+ then
+ export HOMEBREW_PREFIX="/usr/local"
fi
+ pushd ../../../external/macos
+ ./build_unbound.sh
+ popd
# NOTE: we can use unbound from brew but app store rejects the app because of nghttp2 symbols being included
# verbose_copy "${HOMEBREW_PREFIX}/lib/libunbound.a" ${MACOS_LIBS_DIR}/lib/libunbound.a
verbose_copy "../../../external/macos/build/MACOS/lib/libunbound.a" ${MACOS_LIBS_DIR}/lib/libunbound.a
diff --git a/external/libexpat b/external/libexpat
new file mode 160000
+Subproject 3bab6c09bbe8bf42d84b81563ddbcf4cca4be83
diff --git a/external/macos/build_unbound.sh b/external/macos/build_unbound.sh
index e9e1ff8..d1c3825 100755
--- a/external/macos/build_unbound.sh
+++ b/external/macos/build_unbound.sh
@@ -9,9 +9,15 @@ EXPAT_VERSION=R_2_4_8
EXPAT_HASH="3bab6c09bbe8bf42d84b81563ddbcf4cca4be838"
EXPAT_SRC_DIR=${EXTERNAL_MACOS_SOURCE_DIR}/libexpat
rm -rf $EXPAT_SRC_DIR
-git clone https://github.com/libexpat/libexpat.git -b ${EXPAT_VERSION} ${EXPAT_SRC_DIR}
+if [ -d "$EXPAT_SRC_DIR" ]; then
+ echo "Unbound directory already exists."
+else
+ echo "Cloning Unbound from $Unbound_URL"
+ mkdir -p ${EXPAT_SRC_DIR} || true
+ rm -rf ${EXPAT_SRC_DIR}
+ cp -r "${MONEROC_DIR}/external/libexpat" ${EXPAT_SRC_DIR}
+fi
cd $EXPAT_SRC_DIR
-test `git rev-parse HEAD` = ${EXPAT_HASH} || exit 1
cd $EXPAT_SRC_DIR/expat
./buildconf.sh
@@ -28,10 +34,16 @@ UNBOUND_DIR_PATH="${EXTERNAL_MACOS_SOURCE_DIR}/unbound-1.16.2"
echo "============================ Unbound ============================"
rm -rf ${UNBOUND_DIR_PATH}
-git clone https://github.com/NLnetLabs/unbound.git -b ${UNBOUND_VERSION} ${UNBOUND_DIR_PATH}
+# Check if the directory already exists.
+if [ -d "$UNBOUND_DIR_PATH" ]; then
+ echo "Unbound directory already exists."
+else
+ echo "Cloning Unbound from $Unbound_URL"
+ mkdir -p ${UNBOUND_DIR_PATH} || true
+ rm -rf ${UNBOUND_DIR_PATH}
+ cp -r "${MONEROC_DIR}/external/unbound" ${UNBOUND_DIR_PATH}
+fi
cd $UNBOUND_DIR_PATH
-test `git rev-parse HEAD` = ${UNBOUND_HASH} || exit 1
-
./configure --prefix="${EXTERNAL_MACOS_DIR}" \
--with-ssl="${HOMEBREW_PREFIX}" \
--with-libexpat="${EXTERNAL_MACOS_DIR}" \
diff --git a/external/macos/config.sh b/external/macos/config.sh
index dcdf462..3c40625 100755
--- a/external/macos/config.sh
+++ b/external/macos/config.sh
@@ -7,6 +7,7 @@ export EXTERNAL_MACOS_DIR="${EXTERNAL_DIR}/MACOS"
export EXTERNAL_MACOS_SOURCE_DIR="${EXTERNAL_MACOS_DIR}/sources"
export EXTERNAL_MACOS_LIB_DIR="${EXTERNAL_MACOS_DIR}/lib"
export EXTERNAL_MACOS_INCLUDE_DIR="${EXTERNAL_MACOS_DIR}/include"
+export MONEROC_DIR="$(pwd)/../.."
-mkdir -p "$EXTERNAL_MACOS_LIB_DIR"
-mkdir -p "$EXTERNAL_MACOS_INCLUDE_DIR" \ No newline at end of file
+mkdir -p "$EXTERNAL_MACOS_LIB_DIR" || true
+mkdir -p "$EXTERNAL_MACOS_INCLUDE_DIR" || true \ No newline at end of file