Made code block usage consistent across all .md files

This commit is contained in:
Rohaq 2019-05-12 05:16:26 +01:00
parent 6810307505
commit 1873af35bf
8 changed files with 405 additions and 245 deletions

View File

@ -15,23 +15,33 @@ You do not need anything from Qt in order to use the final translations.
To update ts files after changing source code: To update ts files after changing source code:
```bash
./utils/translations/update-translations.sh ./utils/translations/update-translations.sh
```
To add a new language, eg Spanish (ISO code es): To add a new language, eg Spanish (ISO code es):
```bash
cp translations/monero.ts translations/monero_es.ts cp translations/monero.ts translations/monero_es.ts
```
To edit translations for Spanish: To edit translations for Spanish:
```bash
linguist translations/monero_es.ts linguist translations/monero_es.ts
```
To build translations after modifying them: To build translations after modifying them:
```bash
./utils/translations/build-translations.sh ./utils/translations/build-translations.sh
```
To test a translation: To test a translation:
```bash
LANG=es ./build/release/bin/monero-wallet-cli LANG=es ./build/release/bin/monero-wallet-cli
```
To add new translatable strings in the source code: To add new translatable strings in the source code:
@ -39,6 +49,8 @@ Use the `tr(string)` function if possible. If the code is in a class, and this c
If you're getting messages of the form: If you're getting messages of the form:
```
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
```
all is fine, we don't actually need that here. all is fine, we don't actually need that here.

116
README.md
View File

@ -226,9 +226,11 @@ invokes cmake commands as needed.
* Install the dependencies * Install the dependencies
* Change to the root of the source code directory, change to the most recent release branch, and build: * Change to the root of the source code directory, change to the most recent release branch, and build:
```bash
cd monero cd monero
git checkout release-v0.14 git checkout release-v0.14
make make
```
*Optional*: If your machine has several cores and enough memory, enable *Optional*: If your machine has several cores and enough memory, enable
parallel build by running `make -j<number of threads>` instead of `make`. For parallel build by running `make -j<number of threads>` instead of `make`. For
@ -252,23 +254,31 @@ invokes cmake commands as needed.
* **Optional**: build and run the test suite to verify the binaries: * **Optional**: build and run the test suite to verify the binaries:
```bash
make release-test make release-test
```
*NOTE*: `core_tests` test may take a few hours to complete. *NOTE*: `core_tests` test may take a few hours to complete.
* **Optional**: to build binaries suitable for debugging: * **Optional**: to build binaries suitable for debugging:
```bash
make debug make debug
```
* **Optional**: to build statically-linked binaries: * **Optional**: to build statically-linked binaries:
```bash
make release-static make release-static
```
Dependencies need to be built with -fPIC. Static libraries usually aren't, so you may have to build them yourself with -fPIC. Refer to their documentation for how to build them. Dependencies need to be built with -fPIC. Static libraries usually aren't, so you may have to build them yourself with -fPIC. Refer to their documentation for how to build them.
* **Optional**: build documentation in `doc/html` (omit `HAVE_DOT=YES` if `graphviz` is not installed): * **Optional**: build documentation in `doc/html` (omit `HAVE_DOT=YES` if `graphviz` is not installed):
```bash
HAVE_DOT=YES doxygen Doxyfile HAVE_DOT=YES doxygen Doxyfile
```
#### On the Raspberry Pi #### On the Raspberry Pi
@ -279,24 +289,30 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
* Install the dependencies for Monero from the 'Debian' column in the table above. * Install the dependencies for Monero from the 'Debian' column in the table above.
* Increase the system swap size: * Increase the system swap size:
```
```bash
sudo /etc/init.d/dphys-swapfile stop sudo /etc/init.d/dphys-swapfile stop
sudo nano /etc/dphys-swapfile sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=2048 CONF_SWAPSIZE=2048
sudo /etc/init.d/dphys-swapfile start sudo /etc/init.d/dphys-swapfile start
``` ```
* If using an external hard disk without an external power supply, ensure it gets enough power to avoid hardware issues when syncing, by adding the line "max_usb_current=1" to /boot/config.txt * If using an external hard disk without an external power supply, ensure it gets enough power to avoid hardware issues when syncing, by adding the line "max_usb_current=1" to /boot/config.txt
* Clone monero and checkout the most recent release version: * Clone monero and checkout the most recent release version:
```
```bash
git clone https://github.com/monero-project/monero.git git clone https://github.com/monero-project/monero.git
cd monero cd monero
git checkout tags/v0.14.1.0 git checkout tags/v0.14.1.0
``` ```
* Build: * Build:
```
```bash
make release make release
``` ```
* Wait 4-6 hours * Wait 4-6 hours
* The resulting executables can be found in `build/release/bin` * The resulting executables can be found in `build/release/bin`
@ -313,17 +329,19 @@ If you are using the older Raspbian Jessie image, compiling Monero is a bit more
* As before, `apt-get update && apt-get upgrade` to install all of the latest software, and increase the system swap size * As before, `apt-get update && apt-get upgrade` to install all of the latest software, and increase the system swap size
``` ```bash
sudo /etc/init.d/dphys-swapfile stop sudo /etc/init.d/dphys-swapfile stop
sudo nano /etc/dphys-swapfile sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=2048 CONF_SWAPSIZE=2048
sudo /etc/init.d/dphys-swapfile start sudo /etc/init.d/dphys-swapfile start
``` ```
* Then, install the dependencies for Monero except `libunwind` and `libboost-all-dev` * Then, install the dependencies for Monero except `libunwind` and `libboost-all-dev`
* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*` to remove a previous version if you're not using a clean install): * Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*` to remove a previous version if you're not using a clean install):
```
```bash
cd cd
wget https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2 wget https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2
tar xvfo boost_1_64_0.tar.bz2 tar xvfo boost_1_64_0.tar.bz2
@ -331,10 +349,13 @@ If you are using the older Raspbian Jessie image, compiling Monero is a bit more
./bootstrap.sh ./bootstrap.sh
sudo ./b2 sudo ./b2
``` ```
* Wait ~8 hours * Wait ~8 hours
```
```bash
sudo ./bjam cxxflags=-fPIC cflags=-fPIC -a install sudo ./bjam cxxflags=-fPIC cflags=-fPIC -a install
``` ```
* Wait ~4 hours * Wait ~4 hours
* From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the "Clone monero and checkout most recent release version" step. * From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the "Clone monero and checkout most recent release version" step.
@ -353,24 +374,32 @@ application.
* Open the MSYS shell via the `MSYS2 Shell` shortcut * Open the MSYS shell via the `MSYS2 Shell` shortcut
* Update packages using pacman: * Update packages using pacman:
```bash
pacman -Syu pacman -Syu
```
* Exit the MSYS shell using Alt+F4 * Exit the MSYS shell using Alt+F4
* Edit the properties for the `MSYS2 Shell` shortcut changing "msys2_shell.bat" to "msys2_shell.cmd -mingw64" for 64-bit builds or "msys2_shell.cmd -mingw32" for 32-bit builds * Edit the properties for the `MSYS2 Shell` shortcut changing "msys2_shell.bat" to "msys2_shell.cmd -mingw64" for 64-bit builds or "msys2_shell.cmd -mingw32" for 32-bit builds
* Restart MSYS shell via modified shortcut and update packages again using pacman: * Restart MSYS shell via modified shortcut and update packages again using pacman:
```bash
pacman -Syu pacman -Syu
```
* Install dependencies: * Install dependencies:
To build for 64-bit Windows: To build for 64-bit Windows:
```bash
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi
```
To build for 32-bit Windows: To build for 32-bit Windows:
```bash
pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-zeromq mingw-w64-i686-libsodium mingw-w64-i686-hidapi pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-zeromq mingw-w64-i686-libsodium mingw-w64-i686-hidapi
```
* Open the MingW shell via `MinGW-w64-Win64 Shell` shortcut on 64-bit Windows * Open the MingW shell via `MinGW-w64-Win64 Shell` shortcut on 64-bit Windows
or `MinGW-w64-Win64 Shell` shortcut on 32-bit Windows. Note that if you are or `MinGW-w64-Win64 Shell` shortcut on 32-bit Windows. Note that if you are
@ -380,35 +409,49 @@ application.
* To git clone, run: * To git clone, run:
```bash
git clone --recursive https://github.com/monero-project/monero.git git clone --recursive https://github.com/monero-project/monero.git
```
**Building** **Building**
* Change to the cloned directory, run: * Change to the cloned directory, run:
```bash
cd monero cd monero
```
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.14.1.0'. If you don't care about the version and just want binaries from master, skip this step: * If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.14.1.0'. If you don't care about the version and just want binaries from master, skip this step:
```bash
git checkout v0.14.1.0 git checkout v0.14.1.0
```
* If you are on a 64-bit system, run: * If you are on a 64-bit system, run:
```bash
make release-static-win64 make release-static-win64
```
* If you are on a 32-bit system, run: * If you are on a 32-bit system, run:
```bash
make release-static-win32 make release-static-win32
```
* The resulting executables can be found in `build/release/bin` * The resulting executables can be found in `build/release/bin`
* **Optional**: to build Windows binaries suitable for debugging on a 64-bit system, run: * **Optional**: to build Windows binaries suitable for debugging on a 64-bit system, run:
```bash
make debug-static-win64 make debug-static-win64
```
* **Optional**: to build Windows binaries suitable for debugging on a 32-bit system, run: * **Optional**: to build Windows binaries suitable for debugging on a 32-bit system, run:
```bash
make debug-static-win32 make debug-static-win32
```
* The resulting executables can be found in `build/debug/bin` * The resulting executables can be found in `build/debug/bin`
@ -448,7 +491,7 @@ We assume you are compiling with a non-root user and you have `doas` enabled.
Note: do not use the boost package provided by OpenBSD, as we are installing boost to `/usr/local`. Note: do not use the boost package provided by OpenBSD, as we are installing boost to `/usr/local`.
``` ```bash
# Create boost building directory # Create boost building directory
mkdir ~/boost mkdir ~/boost
cd ~/boost cd ~/boost
@ -484,7 +527,7 @@ Build the cppzmq bindings.
We assume you are compiling with a non-root user and you have `doas` enabled. We assume you are compiling with a non-root user and you have `doas` enabled.
``` ```bash
# Create cppzmq building directory # Create cppzmq building directory
mkdir ~/cppzmq mkdir ~/cppzmq
cd ~/cppzmq cd ~/cppzmq
@ -504,7 +547,10 @@ cmake ..
doas make install doas make install
``` ```
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static` Build monero:
```bash
env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static
```
#### OpenBSD >= 6.4 #### OpenBSD >= 6.4
@ -527,15 +573,18 @@ Then you need to increase the data ulimit size to 2GB and try again: `ulimit -d
The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld: The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld:
```bash
mkdir -p build/release mkdir -p build/release
cd build/release cd build/release
cmake -DCMAKE_LINKER=/path/to/ld -D CMAKE_BUILD_TYPE=Release ../.. cmake -DCMAKE_LINKER=/path/to/ld -D CMAKE_BUILD_TYPE=Release ../..
cd ../.. cd ../..
```
Then you can run make as usual. Then you can run make as usual.
### On Linux for Android (using docker): ### On Linux for Android (using docker):
```bash
# Build image (for ARM 32-bit) # Build image (for ARM 32-bit)
docker build -f utils/build_scripts/android32.Dockerfile -t monero-android . docker build -f utils/build_scripts/android32.Dockerfile -t monero-android .
# Build image (for ARM 64-bit) # Build image (for ARM 64-bit)
@ -544,6 +593,7 @@ Then you can run make as usual.
docker create -it --name monero-android monero-android bash docker create -it --name monero-android monero-android bash
# Get binaries # Get binaries
docker cp monero-android:/src/build/release/bin . docker cp monero-android:/src/build/release/bin .
```
### Building portable statically linked binaries ### Building portable statically linked binaries
@ -562,12 +612,18 @@ By default, in either dynamically or statically linked builds, binaries target t
You can also cross-compile static binaries on Linux for Windows and macOS with the `depends` system. You can also cross-compile static binaries on Linux for Windows and macOS with the `depends` system.
* ```make depends target=x86_64-linux-gnu``` for 64-bit linux binaries. * ```make depends target=x86_64-linux-gnu``` for 64-bit linux binaries.
* ```make depends target=x86_64-w64-mingw32``` for 64-bit windows binaries. Requires: python3 g++-mingw-w64-x86-64 wine1.6 bc * ```make depends target=x86_64-w64-mingw32``` for 64-bit windows binaries.
* ```make depends target=x86_64-apple-darwin11``` for macOS binaries. Requires: cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev * Requires: `python3 g++-mingw-w64-x86-64 wine1.6 bc`
* ```make depends target=i686-linux-gnu``` for 32-bit linux binaries. Requires: g++-multilib bc * ```make depends target=x86_64-apple-darwin11``` for macOS binaries.
* ```make depends target=i686-w64-mingw32``` for 32-bit windows binaries. Requires: python3 g++-mingw-w64-i686 * Requires: `cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev`
* ```make depends target=arm-linux-gnueabihf``` for armv7 binaries. Requires: g++-arm-linux-gnueabihf * ```make depends target=i686-linux-gnu``` for 32-bit linux binaries.
* ```make depends target=aarch64-linux-gnu``` for armv8 binaries. Requires: g++-aarch64-linux-gnu * Requires: `g++-multilib bc`
* ```make depends target=i686-w64-mingw32``` for 32-bit windows binaries.
* Requires: `python3 g++-mingw-w64-i686`
* ```make depends target=arm-linux-gnueabihf``` for armv7 binaries.
* Requires: `g++-arm-linux-gnueabihf`
* ```make depends target=aarch64-linux-gnu``` for armv8 binaries.
* Requires: `g++-aarch64-linux-gnu`
The required packages are the names for each toolchain on apt. Depending on your distro, they may have different names. The required packages are the names for each toolchain on apt. Depending on your distro, they may have different names.
@ -583,7 +639,9 @@ Packages are available for
* Ubuntu and [snap supported](https://snapcraft.io/docs/core/install) systems, via a community contributed build. * Ubuntu and [snap supported](https://snapcraft.io/docs/core/install) systems, via a community contributed build.
```bash
snap install monero --beta snap install monero --beta
```
Installing a snap is very quick. Snaps are secure. They are isolated with all of their dependencies. Snaps also auto update when a new version is released. Installing a snap is very quick. Snaps are secure. They are isolated with all of their dependencies. Snaps also auto update when a new version is released.
@ -593,14 +651,19 @@ Installing a snap is very quick. Snaps are secure. They are isolated with all of
* Void Linux: * Void Linux:
```bash
xbps-install -S monero xbps-install -S monero
```
* GuixSD * GuixSD
```bash
guix package -i monero guix package -i monero
```
* Docker * Docker
```bash
# Build using all available cores # Build using all available cores
docker build -t monero . docker build -t monero .
@ -612,6 +675,7 @@ Installing a snap is very quick. Snaps are secure. They are isolated with all of
# or in background # or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
```
* The build needs 3 GB space. * The build needs 3 GB space.
* Wait one hour or more * Wait one hour or more
@ -624,7 +688,9 @@ The build places the binary in `bin/` sub-directory within the build directory
from which cmake was invoked (repository root by default). To run in from which cmake was invoked (repository root by default). To run in
foreground: foreground:
```bash
./bin/monerod ./bin/monerod
```
To list all available options, run `./bin/monerod --help`. Options can be To list all available options, run `./bin/monerod --help`. Options can be
specified either on the command line or in a configuration file passed by the specified either on the command line or in a configuration file passed by the
@ -634,7 +700,9 @@ of the argument without the leading dashes, for example `log-level=1`.
To run in background: To run in background:
```bash
./bin/monerod --log-file monerod.log --detach ./bin/monerod --log-file monerod.log --detach
```
To run as a systemd service, copy To run as a systemd service, copy
[monerod.service](utils/systemd/monerod.service) to `/etc/systemd/system/` and [monerod.service](utils/systemd/monerod.service) to `/etc/systemd/system/` and
@ -682,7 +750,9 @@ setting the following configuration parameters and environment variables:
Example command line to start monerod through Tor: Example command line to start monerod through Tor:
```bash
DNS_PUBLIC=tcp torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd DNS_PUBLIC=tcp torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd
```
### Using Tor on Tails ### Using Tor on Tails
@ -690,9 +760,11 @@ TAILS ships with a very restrictive set of firewall rules. Therefore, you need
to add a rule to allow this connection too, in addition to telling torsocks to to add a rule to allow this connection too, in addition to telling torsocks to
allow inbound connections. Full example: allow inbound connections. Full example:
```bash
sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT
DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \ DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
--data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain
```
## Debugging ## Debugging
@ -702,13 +774,13 @@ This section contains general instructions for debugging failed installs or prob
We generally use the tool `gdb` (GNU debugger) to provide stack trace functionality, and `ulimit` to provide core dumps in builds which crash or segfault. We generally use the tool `gdb` (GNU debugger) to provide stack trace functionality, and `ulimit` to provide core dumps in builds which crash or segfault.
* To use gdb in order to obtain a stack trace for a build that has stalled: * To use `gdb` in order to obtain a stack trace for a build that has stalled:
Run the build. Run the build.
Once it stalls, enter the following command: Once it stalls, enter the following command:
``` ```bash
gdb /path/to/monerod `pidof monerod` gdb /path/to/monerod `pidof monerod`
``` ```
@ -726,7 +798,9 @@ When it terminates with an output along the lines of "Segmentation fault (core d
You can now analyse this core dump with `gdb` as follows: You can now analyse this core dump with `gdb` as follows:
`gdb /path/to/monerod /path/to/dumpfile` ```bash
gdb /path/to/monerod /path/to/dumpfile`
```
Print the stack trace with `bt` Print the stack trace with `bt`
@ -746,7 +820,9 @@ There are two tools available:
Configure Monero with the -D SANITIZE=ON cmake flag, eg: Configure Monero with the -D SANITIZE=ON cmake flag, eg:
```bash
cd build/debug && cmake -D SANITIZE=ON -D CMAKE_BUILD_TYPE=Debug ../.. cd build/debug && cmake -D SANITIZE=ON -D CMAKE_BUILD_TYPE=Debug ../..
```
You can then run the monero tools normally. Performance will typically halve. You can then run the monero tools normally. Performance will typically halve.
@ -760,7 +836,9 @@ Instructions for debugging suspected blockchain corruption as per @HYC
There is an `mdb_stat` command in the LMDB source that can print statistics about the database but it's not routinely built. This can be built with the following command: There is an `mdb_stat` command in the LMDB source that can print statistics about the database but it's not routinely built. This can be built with the following command:
`cd ~/monero/external/db_drivers/liblmdb && make` ```bash
cd ~/monero/external/db_drivers/liblmdb && make
```
The output of `mdb_stat -ea <path to blockchain dir>` will indicate inconsistencies in the blocks, block_heights and block_info table. The output of `mdb_stat -ea <path to blockchain dir>` will indicate inconsistencies in the blocks, block_heights and block_info table.

View File

@ -2,21 +2,29 @@
To build dependencies for the current arch+OS: To build dependencies for the current arch+OS:
```bash
make make
```
To build for another arch/OS: To build for another arch/OS:
```bash
make HOST=host-platform-triplet make HOST=host-platform-triplet
```
For example: For example:
```bash
make HOST=x86_64-w64-mingw32 -j4 make HOST=x86_64-w64-mingw32 -j4
```
A toolchain will be generated that's suitable for plugging into Monero's A toolchain will be generated that's suitable for plugging into Monero's
cmake. In the above example, a dir named x86_64-w64-mingw32 will be cmake. In the above example, a dir named x86_64-w64-mingw32 will be
created. To use it for Monero: created. To use it for Monero:
```bash
cmake -DCMAKE_TOOLCHAIN=`pwd`/contrib/depends/x86_64-w64-mingw32 cmake -DCMAKE_TOOLCHAIN=`pwd`/contrib/depends/x86_64-w64-mingw32
```
Common `host-platform-triplets` for cross compilation are: Common `host-platform-triplets` for cross compilation are:
@ -31,6 +39,7 @@ No other options are needed, the paths are automatically configured.
Dependency Options: Dependency Options:
The following can be set when running make: make FOO=bar The following can be set when running make: make FOO=bar
```
SOURCES_PATH: downloaded sources will be placed here SOURCES_PATH: downloaded sources will be placed here
BASE_CACHE: built packages will be placed here BASE_CACHE: built packages will be placed here
SDK_PATH: Path where sdk's can be found (used by OSX) SDK_PATH: Path where sdk's can be found (used by OSX)
@ -38,13 +47,16 @@ The following can be set when running make: make FOO=bar
DEBUG: disable some optimizations and enable more runtime checking DEBUG: disable some optimizations and enable more runtime checking
HOST_ID_SALT: Optional salt to use when generating host package ids HOST_ID_SALT: Optional salt to use when generating host package ids
BUILD_ID_SALT: Optional salt to use when generating build package ids BUILD_ID_SALT: Optional salt to use when generating build package ids
```
Additional targets: Additional targets:
```
download: run 'make download' to fetch all sources without building them download: run 'make download' to fetch all sources without building them
download-osx: run 'make download-osx' to fetch all sources needed for osx builds download-osx: run 'make download-osx' to fetch all sources needed for osx builds
download-win: run 'make download-win' to fetch all sources needed for win builds download-win: run 'make download-win' to fetch all sources needed for win builds
download-linux: run 'make download-linux' to fetch all sources needed for linux builds download-linux: run 'make download-linux' to fetch all sources needed for linux builds
```
#Darwin (macos) builds: #Darwin (macos) builds:

View File

@ -9,6 +9,7 @@ General tips:
## Identifiers ## Identifiers
Each package is required to define at least these variables: Each package is required to define at least these variables:
```
$(package)_version: $(package)_version:
Version of the upstream library or program. If there is no version, a Version of the upstream library or program. If there is no version, a
placeholder such as 1.0 can be used. placeholder such as 1.0 can be used.
@ -22,9 +23,11 @@ Each package is required to define at least these variables:
$(package)_sha256_hash: $(package)_sha256_hash:
The sha256 hash of the upstream file The sha256 hash of the upstream file
```
These variables are optional: These variables are optional:
```
$(package)_build_subdir: $(package)_build_subdir:
cd to this dir before running configure/build/stage commands. cd to this dir before running configure/build/stage commands.
@ -42,6 +45,7 @@ These variables are optional:
$(package)_extra_sources: $(package)_extra_sources:
Any extra files that will be fetched via $(package)_fetch_cmds. These are Any extra files that will be fetched via $(package)_fetch_cmds. These are
specified so that they can be fetched and verified via 'make download'. specified so that they can be fetched and verified via 'make download'.
```
## Build Variables: ## Build Variables:
@ -49,20 +53,25 @@ After defining the main identifiers, build variables may be added or customized
before running the build commands. They should be added to a function called before running the build commands. They should be added to a function called
$(package)_set_vars. For example: $(package)_set_vars. For example:
```
define $(package)_set_vars define $(package)_set_vars
... ...
endef endef
```
Most variables can be prefixed with the host, architecture, or both, to make Most variables can be prefixed with the host, architecture, or both, to make
the modifications specific to that case. For example: the modifications specific to that case. For example:
```
Universal: $(package)_cc=gcc Universal: $(package)_cc=gcc
Linux only: $(package)_linux_cc=gcc Linux only: $(package)_linux_cc=gcc
x86_64 only: $(package)_x86_64_cc = gcc x86_64 only: $(package)_x86_64_cc = gcc
x86_64 linux only: $(package)_x86_64_linux_cc = gcc x86_64 linux only: $(package)_x86_64_linux_cc = gcc
```
These variables may be set to override or append their default values. These variables may be set to override or append their default values.
```
$(package)_cc $(package)_cc
$(package)_cxx $(package)_cxx
$(package)_objc $(package)_objc
@ -80,16 +89,19 @@ These variables may be set to override or append their default values.
$(package)_stage_env $(package)_stage_env
$(package)_build_opts $(package)_build_opts
$(package)_config_opts $(package)_config_opts
```
The *_env variables are used to add environment variables to the respective The `*_env` variables are used to add environment variables to the respective
commands. commands.
Many variables respect a debug/release suffix as well, in order to use them for Many variables respect a debug/release suffix as well, in order to use them for
only the appropriate build config. For example: only the appropriate build config. For example:
```
$(package)_cflags_release = -O3 $(package)_cflags_release = -O3
$(package)_cflags_i686_debug = -g $(package)_cflags_i686_debug = -g
$(package)_config_opts_release = --disable-debug $(package)_config_opts_release = --disable-debug
```
These will be used in addition to the options that do not specify These will be used in addition to the options that do not specify
debug/release. All builds are considered to be release unless DEBUG=1 is set by debug/release. All builds are considered to be release unless DEBUG=1 is set by
@ -102,6 +114,7 @@ the user. Other variables may be defined as needed.
The following build commands are available for each recipe: The following build commands are available for each recipe:
```
$(package)_fetch_cmds: $(package)_fetch_cmds:
Runs from: build dir Runs from: build dir
Fetch the source file. If undefined, it will be fetched and verified Fetch the source file. If undefined, it will be fetched and verified
@ -127,21 +140,26 @@ the user. Other variables may be defined as needed.
$(package)_stage_cmds: $(package)_stage_cmds:
Runs from: build dir/$(package)_build_subdir Runs from: build dir/$(package)_build_subdir
Stage the build results. If undefined, does nothing. Stage the build results. If undefined, does nothing.
```
The following variables are available for each recipe: The following variables are available for each recipe:
```
$(1)_staging_dir: package's destination sysroot path $(1)_staging_dir: package's destination sysroot path
$(1)_staging_prefix_dir: prefix path inside of the package's staging dir $(1)_staging_prefix_dir: prefix path inside of the package's staging dir
$(1)_extract_dir: path to the package's extracted sources $(1)_extract_dir: path to the package's extracted sources
$(1)_build_dir: path where configure/build/stage commands will be run $(1)_build_dir: path where configure/build/stage commands will be run
$(1)_patch_dir: path where the package's patches (if any) are found $(1)_patch_dir: path where the package's patches (if any) are found
```
Notes on build commands: Notes on build commands:
For packages built with autotools, $($(package)_autoconf) can be used in the For packages built with autotools, `$($(package)_autoconf)` can be used in the
configure step to (usually) correctly configure automatically. Any configure step to (usually) correctly configure automatically. Any
$($(package)_config_opts) will be appended. `$($(package)_config_opts`) will be appended.
Most autotools projects can be properly staged using: Most autotools projects can be properly staged using:
```bash
$(MAKE) DESTDIR=$($(package)_staging_dir) install $(MAKE) DESTDIR=$($(package)_staging_dir) install
```

View File

@ -119,7 +119,7 @@ In order to sign gitian builds on your host machine, which has your PGP key,
fork the gitian.sigs repository and clone it on your host machine, fork the gitian.sigs repository and clone it on your host machine,
or pass the signed assert file back to your build machine. or pass the signed assert file back to your build machine.
``` ```bash
git clone git@github.com:monero-project/gitian.sigs.git git clone git@github.com:monero-project/gitian.sigs.git
git remote add fluffypony git@github.com:fluffypony/gitian.sigs.git git remote add fluffypony git@github.com:fluffypony/gitian.sigs.git
``` ```

View File

@ -79,7 +79,7 @@ LMDB flags (more than one may be specified):
## Examples: ## Examples:
``` ```bash
$ monero-blockchain-import --database lmdb#fastest $ monero-blockchain-import --database lmdb#fastest
$ monero-blockchain-import --database lmdb#nosync $ monero-blockchain-import --database lmdb#nosync

View File

@ -2,7 +2,7 @@
To run all tests, run: To run all tests, run:
``` ```bash
cd /path/to/monero cd /path/to/monero
make [-jn] debug-test # where n is number of compiler processes make [-jn] debug-test # where n is number of compiler processes
``` ```
@ -17,7 +17,7 @@ Tests are located in `tests/core_tests/`, and follow a straightforward naming co
To run only Monero's core tests (after building): To run only Monero's core tests (after building):
``` ```bash
cd build/debug/tests/core_tests cd build/debug/tests/core_tests
ctest ctest
``` ```
@ -36,7 +36,7 @@ Tests correspond to components under `src/crypto/`. A quick comparison reveals t
To run only Monero's crypto tests (after building): To run only Monero's crypto tests (after building):
``` ```bash
cd build/debug/tests/crypto cd build/debug/tests/crypto
ctest ctest
``` ```
@ -53,13 +53,13 @@ To run the same tests on a release build, replace `debug` with `release`.
Functional tests are located under the `tests/functional` directory. Functional tests are located under the `tests/functional` directory.
First, run a regtest daemon in the offline mode and with a fixed difficulty: First, run a regtest daemon in the offline mode and with a fixed difficulty:
``` ```bash
monerod --regtest --offline --fixed-difficulty 1 monerod --regtest --offline --fixed-difficulty 1
``` ```
Alternatively, you can run multiple daemons and let them connect with each other by using `--add-exclusive-node`. In this case, make sure that the same fixed difficulty is given to all the daemons. Alternatively, you can run multiple daemons and let them connect with each other by using `--add-exclusive-node`. In this case, make sure that the same fixed difficulty is given to all the daemons.
Next, restore a mainnet wallet with the following seed and restore height 0 (the file path doesn't matter): Next, restore a mainnet wallet with the following seed and restore height 0 (the file path doesn't matter):
``` ```bash
velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted
``` ```
@ -77,7 +77,7 @@ Hash tests exist under `tests/hash`, and include a set of target hashes in text
To run only Monero's hash tests (after building): To run only Monero's hash tests (after building):
``` ```bash
cd build/debug/tests/hash cd build/debug/tests/hash
ctest ctest
``` ```
@ -98,7 +98,7 @@ Performance tests are located in `tests/performance_tests`, and test features fo
To run only Monero's performance tests (after building): To run only Monero's performance tests (after building):
``` ```bash
cd build/debug/tests/performance_tests cd build/debug/tests/performance_tests
./performance_tests ./performance_tests
``` ```
@ -115,7 +115,7 @@ Unit tests are defined under the `tests/unit_tests` directory. Independent compo
To run only Monero's unit tests (after building): To run only Monero's unit tests (after building):
``` ```bash
cd build/debug/tests/unit_tests cd build/debug/tests/unit_tests
ctest ctest
``` ```

View File

@ -14,15 +14,19 @@ Suppose you put Google Test in directory `${GTEST_DIR}`. To build it,
create a library build target (or a project as called by Visual Studio create a library build target (or a project as called by Visual Studio
and Xcode) to compile and Xcode) to compile
```bash
${GTEST_DIR}/src/gtest-all.cc ${GTEST_DIR}/src/gtest-all.cc
```
with `${GTEST_DIR}/include` in the system header search path and `${GTEST_DIR}` with `${GTEST_DIR}/include` in the system header search path and `${GTEST_DIR}`
in the normal header search path. Assuming a Linux-like system and gcc, in the normal header search path. Assuming a Linux-like system and gcc,
something like the following will do: something like the following will do:
```bash
g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \ g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
-pthread -c ${GTEST_DIR}/src/gtest-all.cc -pthread -c ${GTEST_DIR}/src/gtest-all.cc
ar -rv libgtest.a gtest-all.o ar -rv libgtest.a gtest-all.o
```
(We need `-pthread` as Google Test uses threads.) (We need `-pthread` as Google Test uses threads.)
@ -30,8 +34,10 @@ Next, you should compile your test source file with
`${GTEST_DIR}/include` in the system header search path, and link it `${GTEST_DIR}/include` in the system header search path, and link it
with gtest and any other necessary libraries: with gtest and any other necessary libraries:
```bash
g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \ g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \
-o your_test -o your_test
```
As an example, the make/ directory contains a Makefile that you can As an example, the make/ directory contains a Makefile that you can
use to build Google Test on systems where GNU make is available use to build Google Test on systems where GNU make is available
@ -43,9 +49,11 @@ script.
If the default settings are correct for your environment, the If the default settings are correct for your environment, the
following commands should succeed: following commands should succeed:
```bash
cd ${GTEST_DIR}/make cd ${GTEST_DIR}/make
make make
./sample1_unittest ./sample1_unittest
```
If you see errors, try to tweak the contents of `make/Makefile` to make If you see errors, try to tweak the contents of `make/Makefile` to make
them go away. There are instructions in `make/Makefile` on how to do them go away. There are instructions in `make/Makefile` on how to do
@ -62,14 +70,18 @@ CMake works by generating native makefiles or build projects that can
be used in the compiler environment of your choice. The typical be used in the compiler environment of your choice. The typical
workflow starts with: workflow starts with:
```bash
mkdir mybuild # Create a directory to hold the build output. mkdir mybuild # Create a directory to hold the build output.
cd mybuild cd mybuild
cmake ${GTEST_DIR} # Generate native build scripts. cmake ${GTEST_DIR} # Generate native build scripts.
```
If you want to build Google Test's samples, you should replace the If you want to build Google Test's samples, you should replace the
last command with last command with
```bash
cmake -Dgtest_build_samples=ON ${GTEST_DIR} cmake -Dgtest_build_samples=ON ${GTEST_DIR}
```
If you are on a \*nix system, you should now see a Makefile in the If you are on a \*nix system, you should now see a Makefile in the
current directory. Just type 'make' to build gtest. current directory. Just type 'make' to build gtest.
@ -108,7 +120,9 @@ end up in your selected build directory (selected in the Xcode
"Preferences..." -> "Building" pane and defaults to xcode/build). "Preferences..." -> "Building" pane and defaults to xcode/build).
Alternatively, at the command line, enter: Alternatively, at the command line, enter:
```bash
xcodebuild xcodebuild
```
This will build the "Release" configuration of gtest.framework in your This will build the "Release" configuration of gtest.framework in your
default build location. See the "xcodebuild" man page for more default build location. See the "xcodebuild" man page for more
@ -152,18 +166,24 @@ tell Google Test to use the same TR1 tuple library the rest of your
project uses, or the two tuple implementations will clash. To do project uses, or the two tuple implementations will clash. To do
that, add that, add
```bash
-DGTEST_USE_OWN_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0
```
to the compiler flags while compiling Google Test and your tests. If to the compiler flags while compiling Google Test and your tests. If
you want to force Google Test to use its own tuple library, just add you want to force Google Test to use its own tuple library, just add
```bash
-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_USE_OWN_TR1_TUPLE=1
```
to the compiler flags instead. to the compiler flags instead.
If you don't want Google Test to use tuple at all, add If you don't want Google Test to use tuple at all, add
```bash
-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_HAS_TR1_TUPLE=0
```
and all features using tuple will be disabled. and all features using tuple will be disabled.
@ -177,11 +197,15 @@ macro to see whether this is the case (yes if the macro is `#defined` to
If Google Test doesn't correctly detect whether pthread is available If Google Test doesn't correctly detect whether pthread is available
in your environment, you can force it with in your environment, you can force it with
```bash
-DGTEST_HAS_PTHREAD=1 -DGTEST_HAS_PTHREAD=1
```
or or
```bash
-DGTEST_HAS_PTHREAD=0 -DGTEST_HAS_PTHREAD=0
```
When Google Test uses pthread, you may need to add flags to your When Google Test uses pthread, you may need to add flags to your
compiler and/or linker to select the pthread library, or you'll get compiler and/or linker to select the pthread library, or you'll get
@ -198,7 +222,9 @@ as a shared library (known as a DLL on Windows) if you prefer.
To compile *gtest* as a shared library, add To compile *gtest* as a shared library, add
```bash
-DGTEST_CREATE_SHARED_LIBRARY=1 -DGTEST_CREATE_SHARED_LIBRARY=1
```
to the compiler flags. You'll also need to tell the linker to produce to the compiler flags. You'll also need to tell the linker to produce
a shared library instead - consult your linker's manual for how to do a shared library instead - consult your linker's manual for how to do
@ -206,7 +232,9 @@ it.
To compile your *tests* that use the gtest shared library, add To compile your *tests* that use the gtest shared library, add
```bash
-DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DGTEST_LINKED_AS_SHARED_LIBRARY=1
```
to the compiler flags. to the compiler flags.
@ -229,18 +257,24 @@ conflict.
Specifically, if both Google Test and some other code define macro Specifically, if both Google Test and some other code define macro
FOO, you can add FOO, you can add
```bash
-DGTEST_DONT_DEFINE_FOO=1 -DGTEST_DONT_DEFINE_FOO=1
```
to the compiler flags to tell Google Test to change the macro's name to the compiler flags to tell Google Test to change the macro's name
from `FOO` to `GTEST_FOO`. Currently `FOO` can be `FAIL`, `SUCCEED`, from `FOO` to `GTEST_FOO`. Currently `FOO` can be `FAIL`, `SUCCEED`,
or `TEST`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll or `TEST`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll
need to write need to write
```c++
GTEST_TEST(SomeTest, DoesThis) { ... } GTEST_TEST(SomeTest, DoesThis) { ... }
```
instead of instead of
```c++
TEST(SomeTest, DoesThis) { ... } TEST(SomeTest, DoesThis) { ... }
```
in order to define a test. in order to define a test.
@ -254,9 +288,11 @@ To make sure your changes work as intended and don't break existing
functionality, you'll want to compile and run Google Test's own tests. functionality, you'll want to compile and run Google Test's own tests.
For that you can use CMake: For that you can use CMake:
```bash
mkdir mybuild mkdir mybuild
cd mybuild cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR} cmake -Dgtest_build_tests=ON ${GTEST_DIR}
```
Make sure you have Python installed, as some of Google Test's tests Make sure you have Python installed, as some of Google Test's tests
are written in Python. If the cmake command complains about not being are written in Python. If the cmake command complains about not being
@ -264,12 +300,16 @@ able to find Python (`Could NOT find PythonInterp (missing:
PYTHON_EXECUTABLE)`), try telling it explicitly where your Python PYTHON_EXECUTABLE)`), try telling it explicitly where your Python
executable can be found: executable can be found:
```bash
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR} cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
```
Next, you can build Google Test and all of its own tests. On \*nix, Next, you can build Google Test and all of its own tests. On \*nix,
this is usually done by 'make'. To run the tests, do this is usually done by 'make'. To run the tests, do
```bash
make test make test
```
All tests should pass. All tests should pass.