(fix)(mlk) if sb_getenc is unknown, then sb_stemmer_new API will leak… #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, | |
# software distributed under the License is distributed on an | |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
# KIND, either express or implied. See the License for the | |
# specific language governing permissions and limitations | |
# under the License. | |
name: Build | |
on: ['push', 'pull_request'] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
config: | |
- name: macOS | |
os: macos-12 | |
packages: >- | |
'automake' | |
'autoconf' | |
'libtool' | |
'pkg-config' | |
'texinfo' | |
'coreutils' | |
'gnu-getopt' | |
'python@3' | |
'cmake' | |
'ninja' | |
'ccache' | |
'bison' | |
'byacc' | |
'gettext' | |
'wget' | |
'pcre' | |
'openjdk@11' | |
'maven' | |
'node' | |
'llvm@16' | |
- name: Linux | |
os: ubuntu-22.04 | |
packages: >- | |
'build-essential' | |
'automake' | |
'autoconf' | |
'libtool-bin' | |
'pkg-config' | |
'cmake' | |
'ninja-build' | |
'ccache' | |
'python-is-python3' | |
'bison' | |
'byacc' | |
'flex' | |
'binutils-dev' | |
'libiberty-dev' | |
'curl' | |
'git' | |
'zip' | |
'unzip' | |
'autopoint' | |
'openjdk-11-jdk' | |
'openjdk-11-jdk-headless' | |
'maven' | |
name: Build (${{ matrix.config.name }}) | |
runs-on: ${{ matrix.config.os }} | |
steps: | |
- name: Prepare for ${{ matrix.config.os }} | |
run: | | |
cd /tmp | |
curl -L https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz | tar -zxf - | |
curl -L https://archives.boost.io/release/1.81.0/source/boost_1_81_0.tar.gz -o - | tar -zxf - | |
if [[ "${{ matrix.config.name }}" == 'macOS' ]]; then | |
pushd "$(brew --repo)" | |
git fetch | |
git reset --hard origin/master | |
brew update | |
popd | |
brew install ${{ matrix.config.packages }} || true | |
CELLARS=(${{ matrix.config.packages }}) | |
for cellar in "${CELLARS[@]}"; do | |
EXPORT_CELLARS="$(brew --prefix)/opt/${cellar}/bin:${EXPORT_CELLARS}" | |
done | |
export PATH="${EXPORT_CELLARS}:/usr/bin:${PATH}" | |
export CC="$(brew --prefix)/opt/llvm@16/bin/clang" | |
export CXX="$(brew --prefix)/opt/llvm@16/bin/clang++" | |
boost_toolset=clang | |
else | |
sudo apt update | |
sudo DEBIAN_FRONTEND=noninteractive apt install --yes ${{ matrix.config.packages }} | |
export DEFAULT_DIR='/opt' | |
export PATH="${DEFAULT_DIR}/ldb-toolchain/bin:${PATH}" | |
mkdir -p "${DEFAULT_DIR}" | |
wget https://github.com/amosbird/ldb_toolchain_gen/releases/download/v0.12/ldb_toolchain_gen.sh \ | |
-q -O /tmp/ldb_toolchain_gen.sh | |
bash /tmp/ldb_toolchain_gen.sh "${DEFAULT_DIR}/ldb-toolchain" | |
cxxflags='-static' | |
boost_toolset=gcc | |
fi | |
INSTALLED_DIR='/opt/installed' | |
# Install zlib | |
pushd zlib-1.2.11 | |
CFLAGS="-fPIC" \ | |
CPPFLAGS="-I${INSTALLED_DIR}/include" \ | |
LDFLAGS="-L${INSTALLED_DIR}/lib" \ | |
./configure --prefix="${INSTALLED_DIR}" --static | |
make -j "$(nproc)" | |
sudo make install | |
cd contrib/minizip | |
autoreconf --force --install | |
./configure --prefix="${INSTALLED_DIR}" --enable-static=yes --enable-shared=no | |
make -j "$(nproc)" | |
sudo make install | |
popd | |
# Install Boost | |
pushd boost_1_81_0 | |
CXXFLAGS="${cxxflags}" ./bootstrap.sh --prefix="${INSTALLED_DIR}" --with-toolset="${boost_toolset}" | |
# -q: Fail at first error | |
sudo ./b2 -q link=static runtime-link=static -j "$(nproc)" --without-mpi --without-graph \ | |
--without-graph_parallel --without-python \ | |
cxxflags="-std=c++17 -g -I${INSTALLED_DIR}/include -L${INSTALLED_DIR}/lib" install | |
popd | |
- name: Checkout ${{ github.ref }} | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Build | |
run: | | |
if [[ "${{ matrix.config.name }}" == 'macOS' ]]; then | |
CELLARS=(${{ matrix.config.packages }}) | |
for cellar in "${CELLARS[@]}"; do | |
EXPORT_CELLARS="$(brew --prefix)/opt/${cellar}/bin:${EXPORT_CELLARS}" | |
done | |
export PATH="${EXPORT_CELLARS}:/usr/bin:${PATH}" | |
export CC="$(brew --prefix)/opt/llvm@16/bin/clang" | |
export CXX="$(brew --prefix)/opt/llvm@16/bin/clang++" | |
warning_narrowing='-Wno-c++11-narrowing' | |
else | |
export DEFAULT_DIR='/opt' | |
export PATH="${DEFAULT_DIR}/ldb-toolchain/bin:${PATH}" | |
warning_narrowing='-Wno-narrowing' | |
fi | |
INSTALLED_DIR='/opt/installed' | |
mkdir build | |
cd build | |
cmake -G Ninja \ | |
-DCMAKE_INSTALL_PREFIX="${INSTALLED_DIR}" \ | |
-DBUILD_STATIC_LIBRARIES=ON \ | |
-DBUILD_SHARED_LIBRARIES=OFF \ | |
-DBOOST_ROOT="${INSTALLED_DIR}" \ | |
-DZLIB_ROOT="${INSTALLED_DIR}" \ | |
-DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer ${warning_narrowing}" \ | |
-DUSE_STAT64=0 \ | |
-DUSE_AVX2="ON" \ | |
-DUSE_BTHREAD="OFF" \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DBUILD_CONTRIBS_LIB=ON .. | |
ninja -j "$(nproc)" | |
sudo ninja install | |