Skip to content

Commit

Permalink
Restore Docker files and GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
welps authored and baskerville committed Mar 17, 2020
1 parent 82886cb commit f07921b
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/armhf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: armhf

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: (armhf) build image
run: docker build . -f Dockerfile -t plato:armhf
- name: (armhf) build plato
run: docker run --rm plato:armhf
13 changes: 13 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: dev

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: (dev) build image
run: docker build . -f Dockerfile.dev -t plato:dev
- name: (dev) run tests and build all features
run: docker run --rm plato:dev
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM rust:1.42-buster

RUN /usr/bin/dpkg --add-architecture armhf
RUN apt-get update && apt-get install -y pkg-config \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
jq

RUN rustup target add arm-unknown-linux-gnueabihf

# Build plato
WORKDIR /plato

ADD . /plato

# Plato requires a specific version of the mupdf dev library for src/mupdf_wrapper
RUN cd /plato/thirdparty && ./download.sh mupdf

CMD ["./build.sh"]
26 changes: 26 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:1.42-buster

RUN apt-get update && apt-get install -y libtool \
pkg-config \
jq \
libdjvulibre-dev \
libharfbuzz-dev \
libsdl2-dev \
# start mupdf dependencies
libjbig2dec0-dev \
patch
# end mupdf dependencies

RUN echo "deb http:https://deb.debian.org/debian testing main" > /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y mupdf libmupdf-dev

# Referenced in build.rs for mupdf_wrapper
ENV CARGO_TARGET_OS=linux

# Build plato
WORKDIR /plato

ADD . /plato

CMD ["bash", "-c", "cd /plato/src/mupdf_wrapper && ./build.sh && cd /plato/ && cargo test && cargo build --all-features"]
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ case "$method" in
ln -s libharfbuzz.so.0 libharfbuzz.so

ln -s libdjvulibre.so.21 libdjvulibre.so

cd ..
;;

slow)
Expand Down
49 changes: 43 additions & 6 deletions doc/BUILD.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## Plato
# Build

### Preliminary
Start by cloning the repository:

```sh
git clone https://github.com/baskerville/plato.git
cd plato
```

There are two ways to build *Plato*:
- [Local *Rust* Setup](#local)
- [With *Docker*/*Podman*](#docker)

## Local

### Plato

#### Preliminary

Install the appropriate [compiler toolchain](https://github.com/kobolabs/Kobo-Reader/tree/master/toolchain) (the binaries of the `bin` directory need to be in your path).

Expand All @@ -16,11 +31,9 @@ Install the appropriate target:
rustup target add arm-unknown-linux-gnueabihf
```

### Build phase
### Build Phase

```sh
git clone https://github.com/baskerville/plato.git
cd plato
./build.sh
```

Expand All @@ -30,7 +43,7 @@ cd plato
./dist.sh
```

## Emulator and importer
## Developer Tools

Install the required dependencies: *MuPDF 1.16.1*, *DjVuLibre*, *HarfBuzz*, *OpenJPEG*, *jpeg*, *jbig2dec*, *zlib*.

Expand All @@ -49,3 +62,27 @@ You can install the importer with:
```sh
./install-importer.sh
```

## Docker

### Plato

1. Build the image for armhf: `docker build . -t plato:armhf`
2. The following compiles, mounts a local volume, and outputs the `plato` binary to your local folder `target/arm-unknown-linux-gnueabihf`:

```sh
docker run --rm -t -v $(pwd)/target:/plato/target plato:armhf
```

You can copy the binary to your Kobo device (make sure you install an existing release first) and it will run.

### Developer Tools

1. Build the image for dev environments: `docker build . -f Dockerfile.dev -t plato:dev`
2. The following runs tests, compiles, mounts a local volume, and outputs all binaries to your local folder `target/debug`:

```sh
docker run --rm -t -v $(pwd):/plato plato:dev
```

If the emulator or importer fail to run, please follow the steps in [Local–Developer Tools](#developer-tools) to ensure you have the relevant libraries.

0 comments on commit f07921b

Please sign in to comment.