use all cores for build, used shared ssl libs for both linux and macos, add build support for x64 and arm64

This commit is contained in:
Harvey Fong 2026-01-04 03:20:36 +00:00
parent 17b42553b2
commit bb9281db48
2 changed files with 14 additions and 9 deletions

View File

@ -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:

View File

@ -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