-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Binaries | ||
example/example | ||
example/main | ||
example/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.22 | ||
|
||
RUN apt update && apt install -y unzip | ||
RUN curl -sSL -o /tmp/kobo-tc.zip https://github.com/koreader/koxtoolchain/releases/download/2021.12/kobo.zip && \ | ||
cd /tmp && \ | ||
unzip /tmp/kobo-tc.zip && \ | ||
tar -xzvf /tmp/kobo.tar.gz -C /opt/ && \ | ||
rm -rf /tmp/kobo* | ||
|
||
ENV PATH=/opt/x-tools/arm-kobo-linux-gnueabihf/bin:$PATH | ||
ENV CROSS_COMPILE=arm-kobo-linux-gnueabihf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.PHONY: default | ||
default: build.docker ; | ||
|
||
.PHONY: build | ||
build: export GOOS=linux | ||
build: export GOARCH=arm | ||
build: export CGO_ENABLED=1 | ||
build: export CC=${CROSS_COMPILE}-gcc | ||
build: export CXX=${CROSS_COMPILE}-g++ | ||
build: | ||
go build -o build/app main.go | ||
|
||
build.docker: | ||
docker build -t go-fbink-build . | ||
docker run -it --rm -v $(PWD)/..:/go/src/app --workdir /go/src/app/example go-fbink-build make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Build example | ||
|
||
[koxtoolchain is recommended](https://github.com/shermp/go-fbink-v2/issues/13#issuecomment-894638113) for ARM cross-compilation. | ||
|
||
- Run `make` to build this example application using docker | ||
- See [`main.go`](./main.go) for example usage of go-fbink-v2 | ||
- See [`Dockerfile`](./Dockerfile) for build environment configuration | ||
- See [`Makefile`](./Makefile) for build commands |