diff options
Diffstat (limited to 'cmd/rescribe')
| -rw-r--r-- | cmd/rescribe/Containerfile | 41 | ||||
| -rw-r--r-- | cmd/rescribe/TODO | 2 | ||||
| -rw-r--r-- | cmd/rescribe/makefile | 35 |
3 files changed, 63 insertions, 15 deletions
diff --git a/cmd/rescribe/Containerfile b/cmd/rescribe/Containerfile new file mode 100644 index 0000000..1a10f19 --- /dev/null +++ b/cmd/rescribe/Containerfile @@ -0,0 +1,41 @@ +# This will create a container with all the tools needed to build and package +# Rescribe for all supported targets. It is written with development with +# toolbx in mind, but will also work well for CI infrastructure. +# To create a toolbox from this, use the following commands: +# $ podman build --squash -t localhost/rescribe-toolbox:44 +# $ toolbox create --image localhost/rescribe-toolbox:44 + +ARG FEDORA_VERSION=44 +FROM registry.fedoraproject.org/fedora-toolbox:${FEDORA_VERSION} +ARG OSXCROSS_VERSION=e6ab3fa7423f9235ce9ed6381d6d3af191b46b59 +ARG XCODE_VERSION=12.5.1 +ARG MACOSSDK_VERSION=11.3 + +RUN dnf -y install \ + golang golang-misc \ + make gcc \ + mesa-libGL-devel wayland-devel \ + libXcursor-devel libXrandr-devel libXi-devel libXinerama-devel libXxf86vm-devel libxkbcommon-devel + +# for flatpak +RUN dnf -y install flatpak-builder + +# for windows cross-compilation +RUN dnf -y install mingw64-gcc + +# for osx cross-compilation +RUN dnf -y install clang make openssl-devel xz-devel libxml2-devel git cmake patch xz bzip2 cpio bzip2-devel bash +RUN git clone --revision=${OSXCROSS_VERSION} https://github.com/tpoechtrager/osxcross +WORKDIR osxcross +ADD https://archive.org/download/xcode-${XCODE_VERSION}/Xcode_${XCODE_VERSION}.xip Xcode.xip +#COPY Xcode_${XCODE_VERSION}.xip Xcode.xip # alternative if you have already downloaded it +RUN ./tools/gen_sdk_package_pbzx.sh Xcode.xip +RUN mv MacOSX${MACOSSDK_VERSION}.sdk.tar.xz tarballs/ +# paths aren't set correctly in the script, so just add them manually +RUN sed -ie '13i set_path_vars' ./build.sh +RUN UNATTENDED=1 ./build.sh +RUN mv target /opt/osxcross +WORKDIR .. +RUN rm -rf osxcross + +RUN dnf clean all diff --git a/cmd/rescribe/TODO b/cmd/rescribe/TODO index 2a31b9a..838bd06 100644 --- a/cmd/rescribe/TODO +++ b/cmd/rescribe/TODO @@ -1,5 +1,7 @@ Add option to choose multiple languages (easy on tesseract level, slightly tricky on GUI level) +Remove filesystem permission from flatpak - unneeded for loading now thanks to portals, but would need to rework for saving before it's possible + Write to PDF as we go along, so memory requirements are reduced. Would require further modifying fpdf: https://github.com/jung-kurt/gofpdf/issues/110 Maybe pay apple $100 for a certificate to avoid their security warnings (can be easily included in 'fyne package') diff --git a/cmd/rescribe/makefile b/cmd/rescribe/makefile index ea500b9..2bacb4b 100644 --- a/cmd/rescribe/makefile +++ b/cmd/rescribe/makefile @@ -16,7 +16,14 @@ # that are too old or too new to build Rescribe correctly. # SDK 11.3, as extracted from XCode 12.5.1, seems to work # perfectly for us. -OSXCROSSBIN=$(HOME)/src/osxcross/target/bin +OSXCROSSDIR=/opt/osxcross +# go < 1.25 needed for the MacOS SDK version we use due to +# https://go-review.googlesource.com/c/go/+/654376 +# could probably use a newer SDK, but finding and building +# a working version is a pain +OSXGOVERSION=go1.24.13 + +GOPATH=$(HOME)/go EMBEDS=embed_darwin.go embed_darwin_amd64.go embed_darwin_arm64.go embed_linux.go embed_windows.go embed_other.go GODEPS=gui.go main.go $(EMBEDS) @@ -37,36 +44,34 @@ dist/linux/wayland/rescribe: $(GODEPS) build/darwin_amd64/rescribe: $(GODEPS) go generate mkdir -p build/darwin_amd64 - PATH="$(PATH):$(OSXCROSSBIN)" CC="o64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -tags embed -o $@ . + LD_LIBRARY_PATH="$(OSXCROSSDIR)/lib" PATH="$(PATH):$(OSXCROSSDIR)/bin" CC="o64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 GOTOOLCHAIN=$(OSXGOVERSION) go build -tags embed -o $@ . build/darwin_arm64/rescribe: $(GODEPS) go generate mkdir -p build/darwin_arm64 - PATH="$(PATH):$(OSXCROSSBIN)" CC="oa64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -tags embed -o $@ . + LD_LIBRARY_PATH="$(OSXCROSSDIR)/lib" PATH="$(PATH):$(OSXCROSSDIR)/bin" CC="oa64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 GOTOOLCHAIN=$(OSXGOVERSION) go build -tags embed -o $@ . build/darwin/rescribe: build/darwin_amd64/rescribe build/darwin_arm64/rescribe mkdir -p build/darwin - PATH="$(PATH):$(OSXCROSSBIN)" lipo -create build/darwin_amd64/rescribe build/darwin_arm64/rescribe -output $@ + LD_LIBRARY_PATH="$(OSXCROSSDIR)/lib" PATH="$(PATH):$(OSXCROSSDIR)/bin" lipo -create build/darwin_amd64/rescribe build/darwin_arm64/rescribe -output $@ build/darwin/Rescribe.app: build/darwin/rescribe - go install fyne.io/fyne/v2/cmd/fyne@v2.1.2 - fyne package --release --certificate Rescribe --id xyz.rescribe.rescribe --tags embed --name Rescribe --exe build/darwin/rescribe --os darwin --icon icon.png --appVersion $(VERSION) - codesign -s Rescribe Rescribe.app + go install fyne.io/tools/cmd/fyne@v1.7.0 + PATH="$(PATH):$(OSXCROSSDIR)/bin" $(GOPATH)/bin/fyne package --release --certificate Rescribe --id xyz.rescribe.rescribe --tags embed --name Rescribe --exe build/darwin/rescribe --os darwin --icon icon.png --app-version $(VERSION) + # TODO: switch to using rcodesign instead so don't need a MacOS box: + # https://gregoryszorc.com/docs/apple-codesign/stable/ + #codesign -s Rescribe Rescribe.app mv Rescribe.app $@ dist/darwin/rescribe.zip: build/darwin/Rescribe.app mkdir -p dist/darwin cd build/darwin; zip -r ../../dist/darwin/rescribe.zip Rescribe.app -build/windows/rescribe-bin.exe: $(GODEPS) - go generate - mkdir -p build/windows - CC="x86_64-w64-mingw32-gcc" CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -tags embed -o $@ . - -dist/windows/rescribe.exe: build/windows/rescribe-bin.exe +dist/windows/rescribe.exe: $(GODEPS) mkdir -p dist/windows - CC="x86_64-w64-mingw32-gcc" fyne package --tags embed --name Rescribe --exe build/windows/rescribe-bin.exe --os windows --icon icon.png --appVersion $(VERSION) - mv rescribe.exe $@ + go generate + go install fyne.io/tools/cmd/fyne@v1.7.0 + CC="x86_64-w64-mingw32-gcc" $(GOPATH)/bin/fyne package --tags embed --name Rescribe --exe $@ --os windows --icon icon.png --app-version $(VERSION) # used for flatpak building modules.tar.xz: ../../go.mod |
