Skip to content

Commit 3c6cf98

Browse files
committed
Rewrite Dependencies Build System.
Now also include Build Script, which previously was inside the Dependency archive. Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent 1af319f commit 3c6cf98

File tree

4 files changed

+153
-30
lines changed

4 files changed

+153
-30
lines changed

BuildDeps.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
deps=rieMinerDeps
6+
curl="curl-8.14.1"
7+
gmp="gmp-6.3.0"
8+
json="nlohmann-json-3.12.0-include"
9+
10+
incs="incs"
11+
libs="libs"
12+
13+
if test ${1:-native} = "Deb64" ; then
14+
target="x86_64-pc-linux-gnu"
15+
incs="incsDeb64"
16+
libs="libsDeb64"
17+
export CC=x86_64-linux-gnu-gcc
18+
export CXX=x86_64-linux-gnu-g++
19+
elif test ${1:-native} = "Deb32" ; then
20+
target="i686-pc-linux-gnu"
21+
incs="incsDeb32"
22+
libs="libsDeb32"
23+
export CC=i686-linux-gnu-gcc
24+
export CXX=i686-linux-gnu-g++
25+
elif test ${1:-native} = "Arm64" ; then
26+
target="aarch64-pc-linux-gnu"
27+
incs="incsArm64"
28+
libs="libsArm64"
29+
export CC=aarch64-linux-gnu-gcc
30+
export CXX=aarch64-linux-gnu-g++
31+
elif test ${1:-native} = "Arm32" ; then
32+
target="arm-pc-linux-gnu"
33+
incs="incsArm32"
34+
libs="libsArm32"
35+
export CC=arm-linux-gnueabihf-gcc
36+
export CXX=arm-linux-gnueabihf-g++
37+
elif test ${1:-native} = "Win64" ; then
38+
target="x86_64-w64-mingw32"
39+
incs="incsWin64"
40+
libs="libsWin64"
41+
export CC=x86_64-w64-mingw32-gcc-posix
42+
export CXX=x86_64-w64-mingw32-g++-posix
43+
export WINDRES=x86_64-w64-mingw32-windres
44+
elif test ${1:-native} = "Win32" ; then
45+
target="i686-w64-mingw32"
46+
incs="incsWin32"
47+
libs="libsWin32"
48+
export CC=i686-w64-mingw32-gcc-posix
49+
export CXX=i686-w64-mingw32-g++-posix
50+
export WINDRES=i686-w64-mingw32-windres
51+
elif test ${1:-native} = "And64" ; then
52+
target="aarch64-linux-android"
53+
incs="incsAnd64"
54+
libs="libsAnd64"
55+
export ANDROIDAPI=26
56+
export NDK=/home/user/dev/android-ndk-r25
57+
export HOST_TAG=linux-x86_64
58+
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
59+
export CC=$TOOLCHAIN/bin/aarch64-linux-android$ANDROIDAPI-clang
60+
export CXX=$TOOLCHAIN/bin/aarch64-linux-android$ANDROIDAPI-clang++
61+
elif test ${1:-native} = "And32" ; then
62+
target="armv7-linux-androideabi"
63+
incs="incsAnd32"
64+
libs="libsAnd32"
65+
export ANDROIDAPI=19
66+
export NDK=/home/user/dev/android-ndk-r25
67+
export HOST_TAG=linux-x86_64
68+
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
69+
export CC=$TOOLCHAIN/bin/armv7a-linux-androideabi$ANDROIDAPI-clang
70+
export CXX=$TOOLCHAIN/bin/armv7a-linux-androideabi$ANDROIDAPI-clang++
71+
fi
72+
73+
cd ${deps}
74+
75+
mkdir incs
76+
mkdir libs
77+
78+
unzip ${json}.zip -d ${json}
79+
80+
tar -xf ${curl}.tar.gz
81+
cd ${curl}
82+
./configure --host ${target} -disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --without-ssl --without-libssh2 --without-zlib --without-brotli --without-zstd --without-libidn2 --without-librtmp --without-libpsl --disable-headers-api --without-nghttp2 --disable-shared --disable-libcurl-option --disable-alt-svc
83+
make -j $(nproc)
84+
85+
mv include/curl ../incs
86+
mv lib/.libs/libcurl.a ../libs
87+
cd ..
88+
89+
tar -xf ${gmp}.tar.xz
90+
cd ${gmp}
91+
cp configfsf.guess config.guess
92+
cp configfsf.sub config.sub
93+
if test ${1:-native} = "And32" ; then
94+
./configure --host ${target} --disable-shared --enable-cxx --enable-fat ABI=32 CFLAGS='-fPIC -m32' CPPFLAGS=-DPIC
95+
else
96+
./configure --host ${target} --disable-shared --enable-cxx --enable-fat
97+
fi
98+
make -j $(nproc)
99+
mv gmp.h gmpxx.h ../incs
100+
mv .libs/libgmp.a .libs/libgmpxx.a ../libs
101+
cd ..
102+
103+
cp -r ${json}/include/nlohmann incs
104+
105+
mv incs ../${incs}
106+
mv libs ../${libs}
107+
rm -r ${json}
108+
rm -r ${curl}
109+
rm -r ${gmp}

GetDependencies.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

GetDeps.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
deps=rieMinerDeps
6+
url="https://opecia.xyz/files/src/"
7+
curl="curl-8.14.1"
8+
gmp="gmp-6.3.0"
9+
json="nlohmann-json-3.12.0-include"
10+
11+
if test -d "${deps}" ; then
12+
rm -r "${deps}"
13+
fi
14+
15+
mkdir ${deps}
16+
cd ${deps}
17+
18+
wget "${url}${curl}.tar.gz"
19+
wget "${url}${gmp}.tar.xz"
20+
wget "${url}${json}.zip"

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,32 +95,27 @@ git clone https://github.com/RiecoinTeam/rieMiner.git
9595
cd rieMiner
9696
```
9797

98-
A script that retrieves the dependencies' source codes from Riecoin.xyz and compiles them is provided. Run the script with
98+
#### Get Dependencies
9999

100-
```bash
101-
sh GetDependencies.sh
102-
```
103-
104-
A folder named `rieMiner2501Deps` must have appeared. We assume that you are in it when starting a subsection below.
100+
Retrieve the dependencies' source codes by running the `GetDeps.sh` script,
105101

106102
```bash
107-
cd rieMiner2501Deps
103+
sh GetDeps.sh
108104
```
109105

110-
If you are going to compile for several systems, doing `make clean`s in the rieMiner's directory will be very useful between builds (it will not delete rieMiner binaries). If you already built the dependencies once, you can usually reuse existing `incs` and `libs` folders and skip several steps, though the dependencies may be updated once a while on Riecoin.dev.
106+
A folder named `rieMinerDeps` must have appeared.
111107

112-
#### For Windows x64, Linux x64, or Linux Arm64
113-
114-
Here are the instructions to generate a binary for Windows x64. Just a few adaptations are needed for other systems. In the dependencies folder, build them by doing
108+
#### Build Dependencies for Windows x64, Linux x64, or Linux Arm64
115109

110+
Now, use the `BuildDeps.sh` script to build the dependencies. This takes an argument for the target operating system, `Win64` or `Deb64`. For example,
116111

117112
```bash
118-
sh Build.sh Win64
113+
sh BuildDeps.sh Win64
119114
```
120115

121-
The `incsWin64` and `libsWin64` folders must have appeared next to the dependencies folder (they will have another suffix when building dependencies for other systems).
116+
In this example, the `incsWin64` and `libsWin64` folders must have appeared.
122117

123-
Now, build rieMiner itself.
118+
Finally, build rieMiner itself.
124119

125120
```bash
126121
cd ..
@@ -133,7 +128,19 @@ For Linux x64, do the same steps, but with `Deb64` or `Deb64AVX2` instead of `Wi
133128

134129
For Linux Arm64, use `Arm64` instead of `Win64`.
135130

136-
#### For Android Arm64
131+
If you are going to compile for several systems, doing `make clean`s in the rieMiner's directory will be very useful between builds (it will not delete rieMiner binaries). For example, once you have built the dependencies for `Win64`, `Deb64`, and `Arm64`, you can do
132+
133+
```bash
134+
make clean ; make Win64
135+
make clean ; make Win64AVX2
136+
make clean ; make Deb64
137+
make clean ; make Deb64AVX2
138+
make clean ; make Arm64
139+
```
140+
141+
Which yields the five expected binaries.
142+
143+
#### Build Dependencies for Android Arm64
137144

138145
Note that this will not produce an Apk file, only a binary that can be launched in something like Termux. There is also no built-in temperature control and you are responsible that the heat does not damage your device.
139146

@@ -143,10 +150,10 @@ You should now have an `android-ndk-r25` folder or similar somewhere, remember i
143150

144151
You must now choose your target Android API Level. Each level correspond to a minimum Android version with which an application is compatible, for example API Level 30 corresponds to Android 11. A list can be found [here](https://developer.android.com/studio/releases/platforms). By default, it is set to 26.
145152

146-
Replace accordingly the `export ANDROIDAPI` and `export NDK` lines in the `Build.sh` file. Then, build the dependencies.
153+
Replace accordingly the `export ANDROIDAPI` and `export NDK` lines in the `BuildDeps.sh` file. Then, build the dependencies.
147154

148155
```bash
149-
sh Build.sh And64
156+
sh BuildDeps.sh And64
150157
```
151158

152159
The `incsAnd64` and `libsAnd64` folders must have appeared next to the dependencies folder. You must now adapt the `And64: CXX =` line in the rieMiner's Makefile (outside the dependencies folder) before building rieMiner itself.

0 commit comments

Comments
 (0)