From 68074763c36843595058c0d6fa35a6d2ceec558f Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 8 Jun 2023 20:10:45 +0200 Subject: [PATCH 1/5] doc: provide specific build instructions Closes https://github.com/ooni/probe/issues/2463 --- Readme.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index 8ac4c1b8c1..62b8417922 100644 --- a/Readme.md +++ b/Readme.md @@ -58,10 +58,9 @@ to install `ooniprobe` precompiled binaries for Windows, macOS, and Debian/Ubuntu. Once `ooniprobe` is installed, refer to the [user guide](https://ooni.org/support/ooni-probe-cli). -## Build instructions +## Developer instructions -To build `ooniprobe` or other binaries manually, you need to -install and use the Go version mentioned by the +This repository requires _exactly_ the Go version mentioned by the [GOVERSION](GOVERSION) file. Using a different version of Go _may_ work as intended but is not recommended: we depend on packages forked from the standard library; so, it is @@ -72,14 +71,75 @@ You will also need a C compiler. On Linux and other Unix systems both GCC and Clang will work. If you're using Windows, we recommend installing Ubuntu or Debian on [the Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install). -If you're targeting Windows, you should install the +If you're targeting Windows, you should also install the mingw-w64 cross-compiler. +### Debian developer setup + +The following instructions show how to setup a development +environment using Debian 12 ("bookworm"). The same instructions +should also work for Debian-based distribution (e.g., Ubuntu). + +```bash +# install the compilers, git, and the root CA +sudo apt install golang build-essential ca-certificates git + +# [optional] install mingw-w64 if you're targeting windows +sudo apt install mingw-w64 + +# install the required go version binary +go install -v golang.org/dl/go1.20.5@latest + +# fetch the whole go distribution +$HOME/go/bin/go1.20.5 download +``` + +### Fedora developer setup + +The following instructions show how to setup a development +environment using Fedora. + +```bash +# install the compilers, git, and the root CA +sudo dnf install golang make gcc gcc-c++ git + +# [optional] install mingw-w64 if you're targeting windows +sudo dnf install mingw64-gcc mingw64-gcc-c++ + +# install the required go version binary +go install -v golang.org/dl/go1.20.5@latest + +# fetch the whole go distribution +$HOME/go/bin/go1.20.5 download +``` + +### macOS developer setup + +The following instructions show how to setup a development +environment using macOS. We assume you have already installed +[Homebrew](https://brew.sh), which should also install the +Xcode command line tools as part of its setup script. + +Then, you need to follow these instructions: + +```bash +# install the compiler +brew install go + +# install the required go version binary +go install -v golang.org/dl/go1.20.5@latest + +# fetch the whole go distribution +$HOME/go/bin/go1.20.5 download +``` + +### Build instructions + Once you have installed the correct Go version and a C compiler, you can compile `ooniprobe` using: ```bash -go build -v -ldflags '-s -w' ./cmd/ooniprobe +$HOME/go/bin/go1.20.5 build -v -ldflags '-s -w' ./cmd/ooniprobe ``` This command will generate a stripped binary called `ooniprobe` @@ -88,7 +148,7 @@ in the toplevel directory. Likewise, you can compile `miniooni` using: ```bash -go build -v -ldflags '-s -w' ./internal/cmd/miniooni +$HOME/go/bin/go1.20.5 build -v -ldflags '-s -w' ./internal/cmd/miniooni ``` This command will generate a stripped binary called `miniooni` @@ -97,7 +157,7 @@ in the toplevel directory. And `oohelperd` using: ```bash -go build -v -ldflags '-s -w' ./internal/cmd/oohelperd +$HOME/go/bin/go1.20.5 build -v -ldflags '-s -w' ./internal/cmd/oohelperd ``` This command will generate a stripped binary called `oohelperd` From c9f3a2f85e7a6fad05feb69e66f4888281f945a2 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 8 Jun 2023 20:12:32 +0200 Subject: [PATCH 2/5] x --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 62b8417922..8254b78ea6 100644 --- a/Readme.md +++ b/Readme.md @@ -118,7 +118,7 @@ $HOME/go/bin/go1.20.5 download The following instructions show how to setup a development environment using macOS. We assume you have already installed [Homebrew](https://brew.sh), which should also install the -Xcode command line tools as part of its setup script. +Xcode command line tools. Then, you need to follow these instructions: From ab92ba26d09c10006dee3f5a5a538d8fd6ed6098 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 8 Jun 2023 20:13:06 +0200 Subject: [PATCH 3/5] x --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 8254b78ea6..28d6fe783a 100644 --- a/Readme.md +++ b/Readme.md @@ -76,7 +76,7 @@ mingw-w64 cross-compiler. ### Debian developer setup -The following instructions show how to setup a development +The followingcommands show how to setup a development environment using Debian 12 ("bookworm"). The same instructions should also work for Debian-based distribution (e.g., Ubuntu). @@ -96,7 +96,7 @@ $HOME/go/bin/go1.20.5 download ### Fedora developer setup -The following instructions show how to setup a development +The following commands show how to setup a development environment using Fedora. ```bash @@ -115,7 +115,7 @@ $HOME/go/bin/go1.20.5 download ### macOS developer setup -The following instructions show how to setup a development +The following commands show how to setup a development environment using macOS. We assume you have already installed [Homebrew](https://brew.sh), which should also install the Xcode command line tools. From 4409c7e6c03a057bafdef1362e27a5ffb7f1fc04 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 8 Jun 2023 20:13:37 +0200 Subject: [PATCH 4/5] x --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 28d6fe783a..26770376d5 100644 --- a/Readme.md +++ b/Readme.md @@ -100,7 +100,7 @@ The following commands show how to setup a development environment using Fedora. ```bash -# install the compilers, git, and the root CA +# install the compilers and git sudo dnf install golang make gcc gcc-c++ git # [optional] install mingw-w64 if you're targeting windows From 2a4e04c7d2ba69eaca70d58c6f8af927072309c9 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 8 Jun 2023 20:13:53 +0200 Subject: [PATCH 5/5] x --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 26770376d5..6c3a2ccdfb 100644 --- a/Readme.md +++ b/Readme.md @@ -76,7 +76,7 @@ mingw-w64 cross-compiler. ### Debian developer setup -The followingcommands show how to setup a development +The following commands show how to setup a development environment using Debian 12 ("bookworm"). The same instructions should also work for Debian-based distribution (e.g., Ubuntu).