Fix linux build scripts.

Make seperate debug and release build scripts.

Strip the release build.

Add missing define flags.

Fix shared lib arg for libasan.
This commit is contained in:
redpolline 2024-12-21 13:21:42 -05:00
parent 59cb19e56a
commit c81c506b97
3 changed files with 48 additions and 4 deletions

View file

@ -1,4 +0,0 @@
#!/bin/bash
protoc -I"${PWD}/dll/" --cpp_out="${PWD}/dll/" "${PWD}"/dll/*.proto
clang++ -shared -fPIC -o libsteam_api.so dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++14 && echo built libsteam_api.so
clang++ -fPIC -o lobby_connect lobby_connect.cpp dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++14 && echo built lobby_connect

21
build_linux_debug.sh Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [ ! -d "${PWD}/debug" ]; then
mkdir "${PWD}/debug"
fi
if [ ! -d "${PWD}/debug/experimental" ]; then
mkdir "${PWD}/debug/experimental"
fi
if [ ! -d "${PWD}/debug/lobby_connect" ]; then
mkdir "${PWD}/debug/lobby_connect"
fi
protoc -I"${PWD}/dll/" --cpp_out="${PWD}/dll/" "${PWD}"/dll/*.proto
rm -rf "${PWD}/debug/experimental"/*
pushd "${PWD}/debug/experimental" >/dev/null
echo "Building debug libsteam_api.so...."
clang++ -shared -fPIC -o libsteam_api.so ../../dll/*.cpp ../../dll/*.cc -g3 -Wno-return-type -fsanitize=address -shared-libasan -lprotobuf-lite -std=c++14 && echo built libsteam_api.so
popd >/dev/null
rm -rf "${PWD}/debug/lobby_connect"/*
pushd "${PWD}/debug/lobby_connect" >/dev/null
echo "Building debug lobby_connect...."
clang++ -DNO_DISK_WRITES=1 -DLOBBY_CONNECT=1 -fPIC -o lobby_connect ../../lobby_connect.cpp ../../dll/*.cpp ../../dll/*.cc -g3 -Wno-return-type -fsanitize=address -shared-libasan -lprotobuf-lite -std=c++14 && echo built lobby_connect
popd >/dev/null

27
build_linux_release.sh Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
if [ ! -d "${PWD}/release" ]; then
mkdir "${PWD}/release"
fi
if [ ! -d "${PWD}/release/experimental" ]; then
mkdir "${PWD}/release/experimental"
fi
if [ ! -d "${PWD}/release/lobby_connect" ]; then
mkdir "${PWD}/release/lobby_connect"
fi
protoc -I"${PWD}/dll/" --cpp_out="${PWD}/dll/" "${PWD}"/dll/*.proto
rm -rf "${PWD}/release/experimental"/*
pushd "${PWD}/release/experimental" >/dev/null
echo "Building release libsteam_api.so...."
clang++ -DNDEBUG=1 -DEMU_RELEASE_BUILD=1 -shared -fPIC -o libsteam_api.so ../../dll/*.cpp ../../dll/*.cc -g3 -Wno-return-type -fsanitize=address -shared-libasan -lprotobuf-lite -std=c++14 && echo built libsteam_api.so
cp libsteam_api.so libsteam_api.so.dbg
strip --enable-deterministic-archives --strip-unneeded --remove-section=.comment --remove-section=.note libsteam_api.so
objcopy --add-gnu-debuglink=libsteam_api.so.dbg libsteam_api.so
popd >/dev/null
rm -rf "${PWD}/release/lobby_connect"/*
pushd "${PWD}/release/lobby_connect" >/dev/null
echo "Building release lobby_connect...."
clang++ -DNO_DISK_WRITES=1 -DLOBBY_CONNECT=1 -DNDEBUG=1 -DEMU_RELEASE_BUILD=1 -fPIC -o lobby_connect ../../lobby_connect.cpp ../../dll/*.cpp ../../dll/*.cc -g3 -Wno-return-type -fsanitize=address -shared-libasan -lprotobuf-lite -std=c++14 && echo built lobby_connect
cp lobby_connect lobby_connect.dbg
strip --enable-deterministic-archives --strip-unneeded --remove-section=.comment --remove-section=.note lobby_connect
objcopy --add-gnu-debuglink=lobby_connect.dbg lobby_connect
popd >/dev/null