From 6dad15bcb2fcc1a5a9ecc2bd30308892cefe0fef Mon Sep 17 00:00:00 2001 From: Lander Gallastegi Date: Wed, 9 Jul 2025 01:21:21 +0200 Subject: [PATCH] Build instructions for linux, unify boost lib list --- README.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ Readme.md | 23 ------------------ boost_libs.txt | 17 ++++++++++++++ build.cmd | 35 +++++++++++++--------------- build.sh | 30 ++++++++---------------- 5 files changed, 106 insertions(+), 62 deletions(-) create mode 100644 README.md delete mode 100644 Readme.md create mode 100644 boost_libs.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..719ba40 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +Boost libraries - trimmed down for shadPS4 +======================================== + +This is a subset of Boost v1.82.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the `boost_libs.txt` file. This is intended to be used with the shadPS4 emulator. + +Updating this repo +================== + +To update the Boost version (or to add a new library) follow these steps: + + 1. Download Boost and extract the package, then `cd` to the `boost_1_xx_0` directory. If you are on Windows, use PowerShell. + ``` + git clone https://github.com/boostorg/boost + ``` + 1. Checkout to a specific boost version and init submodules. For example, for boost 1.82: + ``` + git checkout boost-1.82.0 + git submodule update --init --recursive + ``` + 1. Build the `bcp` tool: + * Windows + ``` + .\bootstrap.bat + .\b2 tools\bcp + ``` + * Linux + ``` + ./bootstrap.sh + ./b2 tools/bcp + ``` + 1. Store the boost directory in a variable for later use: + * Windows + ``` + $boost_dir = $pwd + ``` + * Linux + ``` + export boost_dir=$(pwd) + ``` + 1. Add bcp to your path: (The correct output path should be printed by b2 during the build, this is an example. Don't include the `bcp` executable name at the end, just the path to the directory containing it.) + * Windows + ``` + $env:Path += ";$boost_dir\bin.v2\tools\bcp\msvc-14.3\release\link-static\threading-multi" + ``` + * Linux (don't forget the `:PATH` at the end) + ``` + export PATH="$boost_dir/bin.v2/tools/bcp/gcc-15/release/link-static:$PATH" + ``` + 1. `cd` to this repo's directory (shadPS4's `ext-boost`, it is important you stay in the same terminal session to not lose your env vars.) + 1. Remove the existing boost by removing the `boost` and `libs` dirs. (This is only necessary if doing a Boost version upgrade, in case they removed any files in the new version.) + 1. If doing a boost version update, also remember to update the boost version on this README to keep it consistent, + 1. Now you can modify `boost_libs.txt` to add/remove libraries. + 1. Build a new trimmed down distro. + * Windows + ``` + .\build.cmd $boost_dir + ``` + * Linux + ``` + ./build.sh $boost_dir + ``` + 1. You may need to modify `CMakeLists.txt` to adjust include dirs. + 1. Add/remove all files in git and commit. diff --git a/Readme.md b/Readme.md deleted file mode 100644 index dab08d9..0000000 --- a/Readme.md +++ /dev/null @@ -1,23 +0,0 @@ -Boost libraries - trimmed down for shadPS4 -======================================== - -This is a subset of Boost v1.82.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script. - -Updating this repo (on Windows) -=============================== - -To update the Boost version (or to add a new library) follow these steps: - - - Download Boost and extract the package, then launch Powershell and `cd` to the `boost_1_xx_0` directory. - - Build the `bcp` tool: - ``` - .\bootstrap.bat - .\b2 tools\bcp - ``` - - - Store the boost directory in a variable for later use: `$boost_dir = $pwd`. - - Add bcp to your path: `$env:Path += ";$boost_dir\bin.v2\tools\bcp\msvc-14.3\release\link-static\threading-multi"` (The correct output path should be printed by b2 during the build.) - - `cd` to this repo's directory (`...\externals\boost\`) - - Remove the existing boost from the repo: `rm -r boost` (This is only necessary if doing a Boost version upgrade, in case they removed any files in the new version.) - - Run `.\build.cmd $boost_dir` to build a new trimmed down distro. - - Add/remove all files in git and commit. diff --git a/boost_libs.txt b/boost_libs.txt new file mode 100644 index 0000000..c73fd0f --- /dev/null +++ b/boost_libs.txt @@ -0,0 +1,17 @@ +boost/asio/asio.hpp +boost/container/flat_map.hpp +boost/container/flat_set.hpp +boost/container/list.hpp +boost/container/small_vector.hpp +boost/container/static_vector.hpp +boost/icl/interval_map.hpp +boost/icl/split_interval_map.hpp +boost/icl/separate_interval_set.hpp +boost/intrusive/list.hpp +boost/intrusive/set.hpp +align +range +optional +utility +tuple +iterator diff --git a/build.cmd b/build.cmd index b208ab7..f6ea3d8 100644 --- a/build.cmd +++ b/build.cmd @@ -1,19 +1,16 @@ -bcp ^ - boost/asio/asio.hpp ^ - boost/container/flat_map.hpp ^ - boost/container/flat_set.hpp ^ - boost/container/list.hpp ^ - boost/container/small_vector.hpp ^ - boost/container/static_vector.hpp ^ - boost/icl/interval_map.hpp ^ - boost/icl/split_interval_map.hpp ^ - boost/icl/separate_interval_set.hpp ^ - boost/intrusive/list.hpp ^ - boost/intrusive/set.hpp ^ - align ^ - range ^ - optional ^ - utility ^ - tuple ^ - iterator ^ - --boost="%1" . +@echo off +setlocal enabledelayedexpansion + +if "%~1"=="" ( + echo Usage: %0 path\to\boost + exit /b 1 +) + +set BOOST_SRC=%1 + +set LIBS= +for /f "usebackq delims=" %%a in ("boost_libs.txt") do ( + set LIBS=!LIBS! %%a +) + +bcp %LIBS% --boost="%BOOST_SRC%" . diff --git a/build.sh b/build.sh index 20b89ca..6d2836f 100755 --- a/build.sh +++ b/build.sh @@ -1,23 +1,13 @@ #!/bin/sh +set -e -bcp \ - boost/asio/asio.hpp \ - boost/container/flat_map.hpp \ - boost/container/flat_set.hpp \ - boost/container/list.hpp \ - boost/container/small_vector.hpp \ - boost/container/static_vector.hpp \ - boost/icl/interval_map.hpp \ - boost/icl/split_interval_map.hpp \ - boost/icl/separate_interval_set.hpp \ - boost/intrusive/list.hpp \ - boost/intrusive/set.hpp \ - align \ - range \ - optional \ - utility \ - tuple \ - iterator \ - --boost="$1" . +BOOST_SRC="$1" +if [ -z "$BOOST_SRC" ]; then + echo "Usage: $0 /path/to/boost" + exit 1 +fi -find . -type f -print0 | xargs -0 dos2unix \ No newline at end of file +# Read all non-empty, non-comment lines into an array +LIBS=$(grep -vE '^\s*#|^\s*$' boost_libs.txt | xargs) + +bcp $LIBS --boost="$BOOST_SRC" .