-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·52 lines (42 loc) · 1.05 KB
/
build.sh
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
#!/bin/bash
##
# Helper script to build core and plugins
# Ignores plugin folders starting with an underscore _
# .so files are placed in ./search_providers
##
# get current dir
ETHANOLDIR=$(pwd)
# setup some variables
SEARCHPROVIDERSDIR="$ETHANOLDIR"/search_providers
PLUGINSFOLDER="$ETHANOLDIR"/ethanol_plugins
GO=$(which go)
# upgrade modules
"$GO" get -u
# cleanup modules list
echo "[+] cleanup module list"
go mod tidy
# upgrade modules
echo "[+] upgrade go modules"
"$GO" get -u ./...
echo "[+] building ethanol core"
# build
"$GO" build
# enter ethanol plugins folder
cd "$PLUGINSFOLDER"
echo "[*] building plugins"
# iterate folders and build plugins
for f in *; do
if [[ ! -L "$f" && -d "$f" ]]; then # ignore symlinks
if [[ "$f" == _* ]]; then
echo "[-] ignoring folder $f"
else
echo "[+] building $f plugin"
cd $f
"$GO" build -buildmode=plugin -o "$SEARCHPROVIDERSDIR"/"$f".so ./*.go
cd ..
fi
else
echo "[-] $f is not a folder"
fi
done
cd $ETHANOLDIR