From bb9281db485b6e0d7fde64f0f32455a864cb44f5 Mon Sep 17 00:00:00 2001 From: Harvey Fong Date: Sun, 4 Jan 2026 03:20:36 +0000 Subject: [PATCH] use all cores for build, used shared ssl libs for both linux and macos, add build support for x64 and arm64 --- Makefile | 5 +++++ README.md | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 29e4059..e4efe22 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,10 @@ else else \ cp $(DPP_BUILD_DIR)/$(DPP_LIB_NAME) $(BIN_DIR)/$(DPP_LIB_NAME); \ fi + @# Copy OpenSSL shared libraries for runtime + @if [ -f ../libssl/libssl.so ]; then \ + cp ../libssl/libssl.so ../libssl/libcrypto.so $(BIN_DIR)/; \ + fi endif @echo "Build complete: $(OUTPUT_FILE)" @@ -169,3 +173,4 @@ cleanall: + diff --git a/README.md b/README.md index 3b30443..742b2bf 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Prototype C++ Discord bot, that supports 2 features ## Build -### Ubuntu Linux +### Ubuntu Linux x64 ``` sudo apt install build-essential git cmake -y @@ -25,26 +25,26 @@ mkdir workdir && cd workdir mkdir zlib libssl DPP poomer-discord sqlite3 && cd zlib git clone https://github.com/madler/zlib.git . ./configure --static -make -j4 +make -j$(sysctl -n hw.ncpu) cd ../libssl && git clone https://github.com/openssl/openssl.git . -./Configure linux-x86_64 no-shared -make -j4 +./Configure $([ "$(uname -m)" = "aarch64" ] && echo "linux-aarch64" || echo "linux-x86_64") +make -j$(sysctl -n hw.ncpu) cd ../DPP && git clone https://github.com/brainboxdotcc/DPP.git . #zlib wants an absolute path to help cmake find_package work, ssl requires explicit vars cmake -B ./build \ -DCMAKE_PREFIX_PATH="$PWD/../zlib;$PWD/../libssl" -cmake --build ./build -j4 +cmake --build ./build -j$(sysctl -n hw.ncpu) cd ../sqlite3 wget https://www.sqlite.org/2025/sqlite-autoconf-3510100.tar.gz tar xzf sqlite-autoconf-3510100.tar.gz --strip-components=1 -./configure --enable-static --disable-shared && make -j4 +./configure --enable-static --disable-shared && make -j$(sysctl -n hw.ncpu) cd ../poomer-discord && git clone https://git.indoodle.com/oomer/poomer-discord.git . wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h wget https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h -make all -j4 +make all -j$(sysctl -n hw.ncpu) ``` -### MacOS +### MacOS x64 and arm64 ``` mkdir workdir && cd workdir @@ -57,7 +57,7 @@ make -j$(sysctl -n hw.ncpu) # Build OpenSSL (creates dynamic .dylib libraries needed for DPP) cd ../libssl && git clone https://github.com/openssl/openssl.git . -./Configure darwin64-arm64-cc +./Configure $([ "$(uname -m)" = "arm64" ] && echo "darwin64-arm64-cc" || echo "darwin64-x86_64-cc") make -j$(sysctl -n hw.ncpu) # Fix OpenSSL library install names for portability # Run this after OpenSSL is built to make the libraries use @rpath instead of hardcoded paths