-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmake_patch.sh
More file actions
52 lines (44 loc) · 1.91 KB
/
make_patch.sh
File metadata and controls
52 lines (44 loc) · 1.91 KB
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
#!/usr/bin/env bash
# Copyright (c) 2022 Feedzai
#
# Licensed 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.
#
# @author Alberto Ferreira (alberto.ferreira@feedzai.com)
################################################################
# ************************ ImplNote ************************** #
# #
# This patch only applies to AMD64 builds. It doesn't change #
# other architectures' builds (e.g., ARM64) #
# #
################################################################
set -e
function echo_stage () { echo -e "\n\n\e[1m\e[32m>>>\e[0m \e[1m$1\e[0m\n"; }
function echo_bold() { echo -e "\e[1m$1\e[0m"; }
BUILD_LGBM_PATCH_FROM="$1"
if [[ -z "$BUILD_LGBM_PATCH_FROM" ]]; then
echo "ERROR: Specify lightgbm/build/ folder where to build a patch from."
exit 1
fi
if [[ ! -f build/amd64/lib_lightgbm.so ]]; then
echo "ERROR: Run make.sh before make_patch.sh."
exit 1
fi
echo_stage "Building LGBM patch from source!"
echo_bold "Compiling with existing CMake settings at build_dir=${BUILD_LGBM_PATCH_FROM}"
CWD="$(pwd)"
cd "$BUILD_LGBM_PATCH_FROM"
make -j4
find . -name "*.so" -exec cp {} "${CWD}/build/amd64" \;
cp lightgbmlib.jar "${CWD}/build"
cp $(ldd "${CWD}/build/amd64/lib_lightgbm.so" | awk '/libgomp/{print $3}') "${CWD}/build/amd64/libgomp.so.1.0.0"
echo_bold "Patched LightGBM build."