-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.js
71 lines (54 loc) · 2.04 KB
/
configure.js
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
/*
* c) 2016-2019 Sebastian Glaser <[email protected]>
This file is part of tagscale.
tagscale is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
tagscale is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with tagscale. If not, see <http://www.gnu.org/licenses/>.
*/
var fs = require('fs');
var cp = require('child_process');
var path = require('path');
var LD = process.env.LD || 'ld';
var CC = process.env.CC || 'gcc';
var CXX = process.env.CXX || 'g++';
var CPP = process.env.CPP || 'cpp';
cp.spawn( "sh",['-c',`
[ -n "$KEEP_FILES" ] && {
touch KEEP_FILES; export FROM_SOURCE=yes; }
ccache=$(which ccache 2>/dev/null);
diet=$(which diet 2>/dev/null);
if ! echo "$CC" | grep -q "$ccache"
then
export CC="$ccache $diet ${CC} -fPIC";
export LD="$ccache $diet ${LD} -fPIC";
export CXX="$ccache $diet ${CXX} -fPIC";
export CPP="$ccache $diet ${CPP}";
export ARFLAGS=cr;
fi
proc="-j$(nproc||echo 2)";
[ -d node_modules/mocha ] || npm i
[ -f ./dest/lib/libupscaledb.a ] && node-gyp configure && exit 0;
[ -d ./upscaledb ] ||
git clone --depth=1 https://github.com/cruppstahl/upscaledb;
cd upscaledb;
mkdir -p dest;
[ -f ./configure ] || bash ./bootstrap.sh;
[ -f ./Makefile ] || ./configure \
--disable-shared --enable-static-boost --with-pic=static \
--prefix=${path.join(__dirname,'upscaledb','dest')} \
--disable-java --disable-encryption --disable-remote
[ -f ./src/libupscaledb.la ] || {
make --trace -C 3rdparty $proc;
make --trace -C src $proc; }
[ -f ./dest/lib/libupscaledb.a ] ||
make --trace -C src install $proc;
cd ..;
node-gyp configure;
`],{stdio:'inherit'})