Skip to content

Commit 3a67c68

Browse files
soypatdeadprogram
authored andcommitted
add @francdoc suggestions to build steps
1 parent 01419e8 commit 3a67c68

File tree

2 files changed

+66
-12
lines changed

2 files changed

+66
-12
lines changed

content/docs/guides/build/_index.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ You'll need [Go](https://go.dev) installed on your machine to build TinyGo. The
1111

1212
A major dependency of TinyGo is [LLVM](https://llvm.org/). You can either use a version of LLVM already on your system or build LLVM manually. Building manually takes a long time (around an hour depending on how fast your system is) so it is recommended to use a version of LLVM already on your system if that's possible. The links provided below show how to install LLVM one way or the other.
1313

14-
### Repository cloning (before build)
14+
15+
16+
## Repository cloning (before build)
1517
Start with getting the source code. On Windows, you might want to install the [build dependencies](#build-dependencies) first.
1618

1719
```shell
@@ -31,4 +33,45 @@ Once the branch is selected, pull submodules:
3133
git submodule update --init --recursive
3234
```
3335

34-
Now you are ready to build TinyGo- but you must choose whether to build with a [manual LLVM install](./manual-llvm) or with a [system installed LLVM](./bring-your-own-llvm). After building you should also read [additional requirements](./additional-requirements) to make sure you've fulfilled all the requirements for the features of TinyGo you'll be using.
36+
Now you are ready to build TinyGo- but you must choose whether to build with a [manual LLVM install](./manual-llvm) or with a [system installed LLVM](./bring-your-own-llvm). After building you should also read [additional requirements](./additional-requirements) to make sure you've fulfilled all the requirements for the features of TinyGo you'll be using.
37+
38+
## Uninstalling TinyGo
39+
It's highly suggested you uninstall an existing installation of TinyGo before proceeding.
40+
41+
***If you installed TinyGo via a package manager the command will depend on your operating system.***
42+
43+
**Linux Debian and Ubuntu** users may run the following command to uninstall TinyGo:
44+
```shell
45+
sudo apt remove tinygo
46+
```
47+
48+
---
49+
50+
**Linux Fedora** users may uninstall TinyGo with:
51+
```shell
52+
sudo dnf remove tinygo
53+
```
54+
55+
---
56+
57+
**MacOS** users may uninstall TinyGo with the following command:
58+
```shell
59+
brew uninstall tinygo
60+
```
61+
62+
---
63+
64+
**Windows** users who installed with Scoop may run the following command to uninstall TinyGo:
65+
```shell
66+
scoop uninstall tinygo
67+
```
68+
69+
---
70+
71+
**Any OS with a manually installed TinyGo**: Remove the cloned repository. This will remove LLVM along with the TinyGo root.
72+
73+
You should also check if there's a remaining `tinygo` executable in your path and remove it too.
74+
75+
**Linux and MacOS** run `echo $(which tinygo)` to print the path to the existing TinyGo executable.
76+
77+
**Windows** users may run `where tinygo` to see the where any remaining TinyGo executable is located at.

content/docs/guides/build/manual-llvm.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,52 @@ description: >
1313
| Your Linux distribution (if you use Linux) does not ship the right LLVM version. |
1414

1515

16-
#### Build dependencies
16+
## Build dependencies
17+
***Depending on which OS you use the command to install
18+
the dependencies needed to build LLVM will differ.*** Skip over to the command for your Operating System (OS) in this section (OS names are bolded):
1719

18-
Debian and Ubuntu users can install all required tools this way:
1920

21+
**Debian and Ubuntu** users may install all required tools this way:
2022
```shell
2123
sudo apt-get install build-essential git cmake ninja-build
2224
```
2325

24-
Fedora users can install all required tools with:
26+
---
2527

28+
**Fedora** users may install all required tools with:
2629
```shell
2730
sudo dnf groupinstall "Development Tools"
2831
sudo dnf install cmake ninja-build
2932
```
3033

31-
On MacOS you can install these tools using [Homebrew](https://brew.sh/):
34+
---
35+
36+
**MacOS** users may install these tools using [Homebrew](https://brew.sh/):
3237

3338
```shell
3439
brew install cmake ninja
3540
```
3641

37-
On Windows you can install them using [Chocolatey](https://chocolatey.org/). Install Chocolatey first, then run the following in a command prompt or PowerShell with administrative privileges:
42+
---
43+
44+
**Windows** users may install build dependencies using [Chocolatey](https://chocolatey.org/). Install Chocolatey first, then run the following in a command prompt or PowerShell with administrative privileges:
3845

3946
```shell
4047
choco install --confirm git golang mingw make cmake ninja python
4148
```
42-
43-
Use *Git Bash* (installed above) to run all the build commands like `make`. The TinyGo build system expects a Unix-like environment that is not normally provided by Windows but is included already in *Git Bash*.
49+
**Windows** users should also use *Git Bash* (installed above) to run all the build commands like `make`. The TinyGo build system expects a Unix-like environment that is not normally provided by Windows but is included already in *Git Bash*.
4450

4551
Choco doesn't seem to add CMake automatically to the `$PATH` variable. You can do this manually if needed, in Git bash:
4652

4753
```shell
4854
export PATH="$PATH:/c/Program Files/CMake/bin"
4955
```
5056

51-
#### Building LLVM
57+
## Building LLVM
58+
***The following instructions are common to all operating systems.***
59+
60+
Background: *[LLVM](https://llvm.org/) is used by TinyGo to create smaller programs than can be compiled with normal Go distribution. It is commonly referred to as a *compiler infrastructure* since it provides several tools to build, link and optimize programs which adhere to its framework.*
61+
5262
We build LLVM from inside the TinyGo repository we cloned in the [previous step](../). The following command when run inside the TinyGo repo will take care of first downloading the LLVM source code to later build it in the next step. It places the source code in `llvm-project/` and the build output in `llvm-build/`. It only needs to be done once until the next LLVM release (every half year).
5363

5464
Note that the build step may take some time- feel free to grab a drink meanwhile. Warnings emitted through the compilation in this part are normal as of LLVM 17.
@@ -64,7 +74,7 @@ make llvm-source llvm-build CCACHE=OFF
6474
```
6575

6676

67-
#### Building TinyGo
77+
## Building TinyGo
6878

6979
Once this is finished, you can build TinyGo against this manually built LLVM:
7080

@@ -81,7 +91,8 @@ tinygo version 0.31.0-dev-d4189fec linux/amd64 (using go version go1.21.4 and LL
8191

8292
You have successfully built TinyGo from source. Congratulations!
8393

84-
To run TinyGo from any directory you may want to move the built binary to a location on your path
94+
95+
**Linux** users may choose to run TinyGo from any directory you may want to move the built binary to a location on your path
8596
or add the `./build` directory to your path. The following shell command moves the TinyGo binary to `/user/bin`. You may need root privileges to complete this step.
8697
```shell
8798
mv ./build/tinygo /usr/bin/

0 commit comments

Comments
 (0)