Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Added Build & Install (using cargo) (#271)
Browse files Browse the repository at this point in the history
* added Install using cargo, build for all OS

* added small info on optimized binary

* minor info modification

* minor change

* updated as per comment

https://github.com/subspace/pulsar/pull/271\#discussion_r1347247886
  • Loading branch information
abhi3700 authored Oct 6, 2023
1 parent 0ec0a5c commit a1ada38
Showing 1 changed file with 82 additions and 7 deletions.
89 changes: 82 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Instead of running a terminal instance for the farmer, and running another termi

## How to Use (commands)

1. download the executable from [releases](https://github.com/subspace/pulsar/releases)
2. in your terminal, change your directory to where you download the file for example: if you downloaded your file to your `Downloads` folder, `cd Downloads`)
3. we will address your executable name as `pulsar`, change the below commands accordingly to your full executable name.
3. run `./pulsar init` -> this will initialize your config file, which will store the necessary information for you to farm.
4. run `./pulsar farm` -> this will start farming. Yes, it is that simple! Enjoy!
1. Download the executable from [releases](https://github.com/subspace/pulsar/releases)
2. In your terminal, change your directory to where you download the file for example: if you downloaded your file to your `Downloads` folder, `cd Downloads`.
3. We will address your executable name as `pulsar`, change the below commands accordingly to your full executable name.
4. Run `./pulsar init` -> this will initialize your config file, which will store the necessary information for you to farm.
5. Run `./pulsar farm` -> this will start farming. Yes, it is that simple! Enjoy! 🎉

## Other commands

Expand Down Expand Up @@ -51,7 +51,7 @@ $ ./pulsar farm

Once it's running, you can detach the process by pressing `CTRL+b d` (read more about [detaching a sessions](https://linuxhint.com/detach-session-tmux/))

That's it, you should be back to your terminal, with *subspace farming* running in the background as a session.
That's it, you should be back to your terminal, with _subspace farming_ running in the background as a session.

To re-attach to your session, use tmux:

Expand All @@ -67,7 +67,6 @@ tmux kill-session -t farming

### Example with `screen`


```sh
screen -S farming
```
Expand All @@ -91,3 +90,79 @@ If you ever want to delete/kill your farming session, enter the command:
```sh
screen -S farming -X quit
```

## Developer

### Pre-requisites

You'll have to have [Rust toolchain](https://rustup.rs/) installed as well as LLVM, Clang and CMake in addition to usual developer tooling.

Below are some examples of how to install these dependencies on different operating systems.

#### Ubuntu

```bash
sudo apt-get install llvm clang cmake
```

#### macOS

1. Install via Homebrew:

```bash
brew install llvm@15 clang cmake
```

2. Add `llvm` to your `~/.zshrc` or `~/.bashrc`:

```bash
export PATH="/opt/homebrew/opt/llvm@15/bin:$PATH"
```

3. Activate the changes:

```bash
source ~/.zshrc
# or
source ~/.bashrc
```

4. Verify that `llvm` is installed:

```bash
llvm-config --version
```

### Build from Source

Ensure the [pre-requisites](#pre-requisites).

And then run:

```sh
$ cargo build
```

> Use `--release` flag for a release build and optimized binary - `./target/release/pulsar`
### Install CLI

#### Using cargo

After ensuring the [pre-requisites](#pre-requisites), just run:

```sh
$ cargo run --release
```

This would generate an optimized binary.

And then, you can install the binary (optimized) to your system:

```sh
$ cargo install --path .
```

The binary gets added to `~/.cargo/bin`, which is included in the PATH environment variable by default during installation of Rust tools. So you can run it immediately from the shell.

Using this, one doesn't need to download the executable (binary) from the [releases](https://github.com/subspace/pulsar/releases) page each time when there is a new release. They just need to pull the latest code (if already maintained) from the repository and build it locally.

0 comments on commit a1ada38

Please sign in to comment.