Skip to content

Commit

Permalink
upgrade boost to 1.84.0 and replace jfrog (rime#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored and graphemecluster committed Jan 1, 2024
1 parent 44d8b5c commit 5ea7deb
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
build:
runs-on: macos-latest
env:
boost_version: 1.83.0
BOOST_ROOT: ${{ github.workspace }}/deps/boost_1_83_0
boost_version: 1.84.0
BOOST_ROOT: ${{ github.workspace }}/deps/boost-1.84.0
RIME_PLUGINS: ${{ inputs.rime_plugins }}
steps:
- name: Checkout last commit
Expand All @@ -43,14 +43,17 @@ jobs:
uses: actions/cache@v3
with:
path: |
${{ env.BOOST_ROOT }}.tar.bz2
${{ env.BOOST_ROOT }}.tar.xz
key: ${{ runner.os }}-boost-${{ env.boost_version }}

- name: Extract Boost source tarball
if: steps.cache-boost.outputs.cache-hit == 'true'
run: |
pushd deps
tar --bzip2 -xf ${{ env.BOOST_ROOT }}.tar.bz2
tar -xJf ${{ env.BOOST_ROOT }}.tar.xz
cd ${{ env.BOOST_ROOT }}
./bootstrap.sh
./b2 headers
popd
- name: Install Boost
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- { compiler: msvc, cc: cl, cxx: cl }
- { compiler: clang, cc: clang, cxx: clang++ }
env:
boost_version: 1.83.0
BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_83_0
boost_version: 1.84.0
BOOST_ROOT: ${{ github.workspace }}\deps\boost-1.84.0
RIME_PLUGINS: ${{ inputs.rime_plugins }}

steps:
Expand All @@ -36,7 +36,6 @@ jobs:
$envfile = ".\env.bat"
$envcontent = @"
set RIME_ROOT=%CD%
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_1_83_0
set CXX=${{ matrix.cxx }}
set CC=${{ matrix.cc }}
set CMAKE_GENERATOR=Ninja
Expand Down Expand Up @@ -74,12 +73,15 @@ jobs:
- name: Download Boost source
if: steps.cache-boost-src.outputs.cache-hit != 'true'
run: |
aria2c https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.7z -d deps
aria2c https://github.com/boostorg/boost/releases/download/boost-${{ env.boost_version }}/boost-${{ env.boost_version }}.7z -d deps
- name: Extract Boost source tarball
run: |
pushd deps
7z x ${{ env.BOOST_ROOT }}.7z
cd ${{ env.BOOST_ROOT }}
.\bootstrap.bat
.\b2 headers
popd
- name: Cache dependencies
Expand Down
9 changes: 4 additions & 5 deletions README-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ third-party dependencies separately.
## Install Boost C++ libraries

Boost is a third-party library which librime code heavily depend on.
These dependencies include a few compiled (non-header-only) Boost libraries.
These dependencies include a few header-only Boost libraries.

**Option 1 (recommended):** Download and build Boost from source.

Expand All @@ -31,14 +31,13 @@ bash install-boost.sh
```

The make script will download Boost source tarball, extract it to
`librime/deps/boost_<version>` and create needed static libraries
for building macOS uinversal binary.
`librime/deps/boost-<version>`.

Set shell variable `BOOST_ROOT` to the path to `boost_<version>` directory prior
Set shell variable `BOOST_ROOT` to the path to `boost-<version>` directory prior
to building librime.

``` sh
export BOOST_ROOT="$(pwd)/deps/boost_1_83_0"
export BOOST_ROOT="$(pwd)/deps/boost-1.84.0"
```

**Option 2:** Install Boost libraries from Homebrew.
Expand Down
2 changes: 1 addition & 1 deletion env.bat.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rem Customize your build environment and save the modified copy to env.bat
set RIME_ROOT=%CD%

rem REQUIRED: path to Boost source directory
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_1_83_0
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost-1.84.0

rem architecture, Visual Studio version and platform toolset
set ARCH=Win32
Expand Down
2 changes: 1 addition & 1 deletion env.vs2019.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rem Customize your build environment and save the modified copy to env.bat
set RIME_ROOT=%CD%

rem REQUIRED: path to Boost source directory
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_1_83_0
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost-1.84.0

rem architecture, Visual Studio version and platform toolset
set ARCH=Win32
Expand Down
2 changes: 1 addition & 1 deletion env.vs2022.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rem Customize your build environment and save the modified copy to env.bat
set RIME_ROOT=%CD%

rem REQUIRED: path to Boost source directory
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_1_83_0
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost-1.84.0

rem architecture, Visual Studio version and platform toolset
set ARCH=Win32
Expand Down
14 changes: 8 additions & 6 deletions install-boost.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ setlocal

if not defined RIME_ROOT set RIME_ROOT=%CD%

if not defined boost_version set boost_version=1.83.0
set boost_x_y_z=%boost_version:.=_%
if not defined boost_version set boost_version=1.84.0

if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_%boost_x_y_z%
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost-%boost_version%

if exist "%BOOST_ROOT%\boost" goto boost_found
if exist "%BOOST_ROOT%\libs" goto boost_found
for %%I in ("%BOOST_ROOT%\.") do set src_dir=%%~dpI
rem download boost source
aria2c https://sourceforge.net/projects/boost/files/boost/%boost_version%/boost_%boost_x_y_z%.7z -d %src_dir%
aria2c https://github.com/boostorg/boost/releases/download/boost-%boost_version%/boost-%boost_version%.7z -d %src_dir%
pushd %src_dir%
7z x boost_%boost_x_y_z%.7z
7z x boost-%boost_version%.7z
cd boost-%boost_version%
.\bootstrap.bat
.\b2 headers
popd
:boost_found

Expand Down
17 changes: 9 additions & 8 deletions install-boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ set -ex

RIME_ROOT="$(cd "$(dirname "$0")"; pwd)"

boost_version="${boost_version=1.83.0}"
boost_x_y_z="${boost_version//./_}"
boost_version="${boost_version=1.84.0}"

BOOST_ROOT="${BOOST_ROOT=${RIME_ROOT}/deps/boost_${boost_x_y_z}}"
BOOST_ROOT="${BOOST_ROOT=${RIME_ROOT}/deps/boost-${boost_version}}"

boost_tarball="boost_${boost_x_y_z}.tar.bz2"
download_url="https://boostorg.jfrog.io/artifactory/main/release/${boost_version}/source/${boost_tarball}"
boost_tarball_sha256sum_1_83_0='6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e boost_1_83_0.tar.bz2'
boost_tarball_sha256sum="${boost_tarball_sha256sum=${boost_tarball_sha256sum_1_83_0}}"
boost_tarball="boost-${boost_version}.tar.xz"
download_url="https://github.com/boostorg/boost/releases/download/boost-${boost_version}/${boost_tarball}"
boost_tarball_sha256sum="2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e ${boost_tarball}"

download_boost_source() {
cd "${RIME_ROOT}/deps"
if ! [[ -f "${boost_tarball}" ]]; then
curl -LO "${download_url}"
fi
echo "${boost_tarball_sha256sum}" | shasum -a 256 -c
tar --bzip2 -xf "${boost_tarball}"
tar -xJf "${boost_tarball}"
[[ -f "${BOOST_ROOT}/bootstrap.sh" ]]
}

Expand All @@ -29,4 +27,7 @@ if [[ $# -eq 0 || " $* " =~ ' --download ' ]]; then
else
echo "found boost at ${BOOST_ROOT}"
fi
cd "${BOOST_ROOT}"
./bootstrap.sh
./b2 headers
fi

0 comments on commit 5ea7deb

Please sign in to comment.