forked from forknote/cryptonote-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
91 lines (74 loc) · 3.19 KB
/
compile.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
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
#! /usr/bin/env bash
# Bash script for change coin files
# Exit immediately if an error occurs, or if an undeclared variable is used
set -o errexit
[ "$OSTYPE" != "win"* ] || die "Windows is not supported"
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts "c:z" opt; do
case "$opt" in
c) COMPILE_ARGS=${OPTARG}
;;
z) archive=1
esac
done
archive=${archive:-0}
shift $((OPTIND-1))
cd ${NEW_COIN_PATH}
rm -rf build; mkdir -p build/release; cd build/release
# Compile!
if [[ "$OSTYPE" == "msys" ]]; then
cmake -G "Visual Studio 12 Win64" "..\.."
msbuild.exe Bytecoin.sln /property:Configuration=Release ${COMPILE_ARGS}
else
cmake -D STATIC=ON -D ARCH="default" -D CMAKE_BUILD_TYPE=Release ../..
echo "make ${COMPILE_ARGS}"
PORTABLE=1 make ${COMPILE_ARGS}
fi
if [[ $? == "0" ]]; then
echo "Compilation successful"
fi
# Move and zip binaries
if [[ $archive == "1" ]]; then
BUILD_PATH="${WORK_FOLDERS_PATH}/builds"
MAC_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-mac"
LINUX_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-linux"
WINDOWS_BUILD_NAME="${__CONFIG_core_CRYPTONOTE_NAME}-windows"
ALL_BUILD_FILES="${__CONFIG_core_CRYPTONOTE_NAME}-all-files"
case "$OSTYPE" in
msys*) rm -f ${BUILD_PATH}/${WINDOWS_BUILD_NAME}.zip
rm -rf ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/Release/${__CONFIG_core_CRYPTONOTE_NAME}d.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/Release/simplewallet.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/Release/walletd.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/Release/miner.exe ${BUILD_PATH}/${WINDOWS_BUILD_NAME}
cd ${BUILD_PATH}
zip -r ${WINDOWS_BUILD_NAME}.zip ${WINDOWS_BUILD_NAME}/
;;
darwin*) rm -f ${BUILD_PATH}/${MAC_BUILD_NAME}.zip
rm -rf ${BUILD_PATH}/${MAC_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/${__CONFIG_core_CRYPTONOTE_NAME}d ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/simplewallet ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/walletd ${BUILD_PATH}/${MAC_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/miner ${BUILD_PATH}/${MAC_BUILD_NAME}
cd ${BUILD_PATH}
zip -r ${MAC_BUILD_NAME}.zip ${MAC_BUILD_NAME}/
;;
*) rm -f ${BUILD_PATH}/${LINUX_BUILD_NAME}.tar.gz
rm -rf ${BUILD_PATH}/${LINUX_BUILD_NAME}
mkdir -p ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/${__CONFIG_core_CRYPTONOTE_NAME}d ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/simplewallet ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/walletd ${BUILD_PATH}/${LINUX_BUILD_NAME}
cp ${NEW_COIN_PATH}/build/release/src/miner ${BUILD_PATH}/${LINUX_BUILD_NAME}
cd ${BUILD_PATH}
tar -zcvf ${LINUX_BUILD_NAME}.tar.gz ${LINUX_BUILD_NAME}
;;
esac
rm -rf ${BUILD_PATH}/${ALL_BUILD_FILES}
mkdir -p ${BUILD_PATH}/${ALL_BUILD_FILES}
cp -R ${NEW_COIN_PATH}/build/release/src/ ${BUILD_PATH}/${ALL_BUILD_FILES}/
rm -rf "${NEW_COIN_PATH}/build"
fi