Skip to content

Commit

Permalink
Merge branch 'main' into nix
Browse files Browse the repository at this point in the history
  • Loading branch information
leif committed Jun 17, 2023
2 parents d5c4b9b + a8fe6ab commit 1594864
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 54 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
*.out

# Builds
deploy/
vendor/
katzen

# Android
Expand Down
98 changes: 46 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,60 @@ A multiplatform chat client using catshadow and gio
## Getting the source code

git clone https://github.com/katzenpost/katzen
cd katzen
cd katzen/

## Building katzen for GNU/Linux

### Using docker or podman
## Building katzen

The easiest way to build katzen is in a container managed by
[podman](https://podman.io/) or
[docker](https://en.wikipedia.org/wiki/Docker_(software)). (Podman is a docker
[docker](https://en.wikipedia.org/wiki/Docker_(software)). Podman is a docker
replacement which has the advantages of not requiring root access or a daemon to
operate.)
operate and what we use by default. If you already have Docker installed proceed
to next step, otherwise run:

```
# apt install podman
```

### Building for GNU/Linux

```
$ make docker-build-linux
```

The Makefile in this repository has targets to create a container image with the
build environment, and to create a container with that image, and build katzen
in the container. Although the make target names are prefixed with `docker-`,
podman will be used by default if it is installed.

- `docker-build-linux` builds GNU/Linux binary (default target)
- `docker-build-windows` builds Windows
- `docker-build-android` builds Android APK
- `docker-shell` puts you in a shell inside an ephemeral build container with your local
checkout mounted at `/go/katzen`

The Makefile in this repository has targets to create a container image with
the build environment, and to create a container with that image, and build
katzen in the container.
**Docker or Podman**

Although the make target names are prefixed with `docker-`, podman will be used
by default if it is installed. If you have both podman and docker installed
and want to force the use of docker, or if you want to specify the path to a
different docker/podman compatible binary, you can specify `docker=docker` as
the first argument to the `make` command.
If you have both Podman and Docker installed and want to force the use of
Docker, or if you want to specify the path to a different docker/podman
compatible binary, you can specify `docker=docker` as the first argument to the
`make` command.

The default target is `docker-build-linux` which will produce a linux binary.
Other Makefile targets include `docker-build-windows` and
`docker-build-android`, which build for those platforms, and `docker-shell`
which puts you in a shell inside an ephemeral build container with your local
checkout mounted at `/go/katzen`.
```
$ make docker=docker docker-build-linux
```

To remove the docker images and containers created by the Makefile, run `make
docker-clean`. The Makefile contains targets which build intermediate images
for the Debian and go module dependencies, so that local changes can be built
without the need for internet access.
### Cleaning build

To remove the docker images and containers created by the Makefile, run:

```
# make docker-clean
```

The Makefile contains targets which build intermediate images for the Debian
and go module dependencies, so that local changes can be built without the
need for internet access.

To build using local uncomitted changes from the Katzenpost monorepo, add
`replace github.com/katzenpost/katzenpost => ./katzenpost` to katzen's `go.mod`
Expand Down Expand Up @@ -123,37 +145,9 @@ And then build the Android APK:

gogio -arch arm64,amd64 -x -target android -appid chat.katzen -version 1 -signkey sign.keystore -signpass YOURPASSWORD .

To create the Docker build environment:

docker build --no-cache -t katzenpost/android_build -f Dockerfile.android .

Optional: Before using the build environment, you can `go mod vendor` to copy
dependencies into a local path (`./vendor`). This will allow you to use go.mod
replace directives and copy cached go modules so that they will be available in
the docker container. This will speed up builds and enable you to make local
changes to test on android. Do not forget to update or remove the vendor path.

To run the build, execute the following command while in this project root:

docker run -v "$(pwd)":/go/build/ katzenpost/android_build bash -c "go install gioui.org/cmd/gogio && gogio -arch arm64,amd64 -x -target android -appid org.mixnetworks.katzen -version 1 -signkey sign.keystore -signpass YOURPASSWORD ."

Note that the contents of the local directory are copied into the docker environment - so your signing keystore ought to be in this path as well.

To install on an Android device using `adb` run the following

adb install katzen.apk

Between versions you might need to install uninstall a previous build

adb uninstall chat.katzen

#### Verify build: To verify that your local build matches the CI-built apk, use the included reproducible.keystore to sign the apk:

docker run --rm -v "$(pwd)":/go/build/ katzenpost/android_build bash -c "go install gioui.org/cmd/gogio && gogio -arch arm64,amd64 -x -target android -appid org.mixnetworks.katzen -version 1 -signkey reproducible.keystore -signpass reproducible ."

## Run it

Usage of ./deploy/linux/katzen:
Usage of ./katzen:
-f string
Path to the client config file. (default to baked-in testnet configuration)
-s string
Expand Down

0 comments on commit 1594864

Please sign in to comment.