forked from vtnerd/monero_c
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_single.sh
More file actions
executable file
·110 lines (98 loc) · 3.46 KB
/
build_single.sh
File metadata and controls
executable file
·110 lines (98 loc) · 3.46 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
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
#!/bin/bash
cd "$(realpath $(dirname $0))"
proccount=1
if [[ "x$(uname)" == "xDarwin" ]];
then
proccount=$(sysctl -n hw.physicalcpu)
elif [[ "x$(uname)" == "xLinux" ]];
then
proccount=$(nproc)
fi
function verbose_copy() {
echo "==> cp $1 $2"
cp $1 $2
}
set -e
repo=$1
if [[ "x$repo" == "x" ]];
then
echo "Usage: $0 monero/wownero/zano $(gcc -dumpmachine) -j$proccount"
exit 1
fi
if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" && "x$repo" != "xzano" ]];
then
echo "Usage: $0 monero/wownero/zano $(gcc -dumpmachine) -j$proccount"
echo "Invalid target given"
exit 1
fi
if [[ ! -d "$repo" ]]
then
echo "no '$repo' directory found. clone with --recursive or run:"
echo "$ git submodule init && git submodule update --force";
exit 1
fi
HOST_ABI="$2"
if [[ "x$HOST_ABI" == "x" ]];
then
echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
exit 1
fi
NPROC="$3"
if [[ "x$NPROC" == "x" ]];
then
echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
exit 1
fi
cd $(dirname $0)
WDIR=$PWD
pushd contrib/depends
if [[ -d $HOST_ABI ]];
then
echo "Not building depends, directory exists"
else
env -i PATH="$PATH" CC=gcc CXX=g++ make "$NPROC" HOST="$HOST_ABI" DEPENDS_UNTRUSTED_FAST_BUILDS=$DEPENDS_UNTRUSTED_FAST_BUILDS
fi
popd
buildType=Debug
pushd ${repo}_libwallet2_api_c
rm -rf build/${HOST_ABI} || true
mkdir -p build/${HOST_ABI} -p
if [[ "$repo" == "zano" ]];
then
EXTRA_CMAKE_FLAGS="-DCAKEWALLET=ON"
fi
pushd build/${HOST_ABI}
cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../../contrib/depends/${HOST_ABI}/share/toolchain.cmake $EXTRA_CMAKE_FLAGS -DUSE_DEVICE_TREZOR=OFF -DMONERO_FLAVOR=$repo -DCMAKE_BUILD_TYPE=Debug -DHOST_ABI=${HOST_ABI} ../..
make $NPROC
popd
popd
mkdir -p release/$repo 2>/dev/null || true
pushd release/$repo
APPENDIX=""
if [[ "${HOST_ABI}" == "x86_64-w64-mingw32" || "${HOST_ABI}" == "i686-w64-mingw32" ]];
then
echo "TODO: check if it's still needed"
APPENDIX="${APPENDIX}dll"
# cp ../../$repo/build/${HOST_ABI}/external/polyseed/libpolyseed.${APPENDIX} ${HOST_ABI}_libpolyseed.${APPENDIX}
# rm ${HOST_ABI}_libpolyseed.${APPENDIX}.xz || true
# xz -e ${HOST_ABI}_libpolyseed.${APPENDIX}
elif [[ "${HOST_ABI}" == "x86_64-apple-darwin11" || "${HOST_ABI}" == "aarch64-apple-darwin11" || "${HOST_ABI}" == "host-apple-darwin" || "${HOST_ABI}" == "x86_64-host-apple-darwin" || "${HOST_ABI}" == "aarch64-apple-darwin" || "${HOST_ABI}" == "x86_64-apple-darwin" || "${HOST_ABI}" == "host-apple-ios" || "${HOST_ABI}" == "aarch64-apple-ios" || "${HOST_ABI}" == "aarch64-apple-iossimulator" ]];
then
APPENDIX="${APPENDIX}dylib"
else
APPENDIX="${APPENDIX}so"
fi
xz -ek ../../${repo}_libwallet2_api_c/build/${HOST_ABI}/libwallet2_api_c.${APPENDIX}
mv ../../${repo}_libwallet2_api_c/build/${HOST_ABI}/libwallet2_api_c.${APPENDIX}.xz ${HOST_ABI}_libwallet2_api_c.${APPENDIX}.xz
# Extra libraries
if [[ "$HOST_ABI" == "x86_64-w64-mingw32" || "$HOST_ABI" == "i686-w64-mingw32" ]];
then
cp /usr/${HOST_ABI}/lib/libwinpthread-1.dll ${HOST_ABI}_libwinpthread-1.dll
rm ${HOST_ABI}_libwinpthread-1.dll.xz || true
xz -ek ${HOST_ABI}_libwinpthread-1.dll
####
cp /usr/lib/gcc/${HOST_ABI}/*-posix/libssp-0.dll ${HOST_ABI}_libssp-0.dll
rm ${HOST_ABI}_libssp-0.dll.xz || true
xz -ek ${HOST_ABI}_libssp-0.dll
fi
popd