Skip to content

Commit

Permalink
Merge branch 'master' into cyjan-fix_cakewallet_build
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK authored Aug 14, 2024
2 parents 2ccb12e + 5de323b commit 6948e08
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] zmq && brew link [email protected]` |
| host-apple-darwin | arm64-apple-darwin23 | dependencies: `brew install unbound [email protected] zmq cmake ccache autoconf automake libtool && brew link [email protected]` |
| host-apple-ios | arm64-apple-darwin23 | |

## Design
Expand Down
34 changes: 21 additions & 13 deletions build_single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -31,15 +40,15 @@ 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

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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions external/libexpat
Submodule libexpat added at 3bab6c
22 changes: 17 additions & 5 deletions external/macos/build_unbound.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}" \
Expand Down
5 changes: 3 additions & 2 deletions external/macos/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
mkdir -p "$EXTERNAL_MACOS_LIB_DIR" || true
mkdir -p "$EXTERNAL_MACOS_INCLUDE_DIR" || true

0 comments on commit 6948e08

Please sign in to comment.