-
Notifications
You must be signed in to change notification settings - Fork 40
191 lines (166 loc) · 6.16 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# 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-15
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