summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNick White <git@njw.name>2024-04-09 00:56:06 +0100
committerNick White <git@njw.name>2024-04-09 08:32:55 +0100
commitf463237e3cda7cba5af2f062eb44a2798daf7b49 (patch)
tree36d0e441eeec8b5a3a376edddf0a1b46afe3a266 /cmd
parent1a4506e1bf619d0378832773f355b0014dcc1459 (diff)
Fix flatpak tessdata sourcing to ensure all files are available to it
Diffstat (limited to 'cmd')
-rw-r--r--cmd/rescribe/embed_other.go5
-rw-r--r--cmd/rescribe/embed_other2.go11
-rw-r--r--cmd/rescribe/embed_tessdata.go2
-rw-r--r--cmd/rescribe/xyz.rescribe.rescribe.yml10
4 files changed, 17 insertions, 11 deletions
diff --git a/cmd/rescribe/embed_other.go b/cmd/rescribe/embed_other.go
index ac9ce3a..190a051 100644
--- a/cmd/rescribe/embed_other.go
+++ b/cmd/rescribe/embed_other.go
@@ -6,8 +6,7 @@
package main
-// if not one of the above platforms, we won't embed anything, so
-// just create empty byte slices
+// if not one of the above platforms, we won't embed tesseract
+// or getgbook, so just create empty byte slices
var tesszip []byte
var gbookzip []byte
-var tessdatazip []byte
diff --git a/cmd/rescribe/embed_other2.go b/cmd/rescribe/embed_other2.go
new file mode 100644
index 0000000..5749008
--- /dev/null
+++ b/cmd/rescribe/embed_other2.go
@@ -0,0 +1,11 @@
+// Copyright 2021 Nick White.
+// Use of this source code is governed by the GPLv3
+// license that can be found in the LICENSE file.
+
+//go:build (!darwin && !linux && !windows) || (!embed && !flatpak)
+
+package main
+
+// if not one of the above platforms, we won't embed tessdata, so
+// just create an empty byte slice
+var tessdatazip []byte
diff --git a/cmd/rescribe/embed_tessdata.go b/cmd/rescribe/embed_tessdata.go
index ea9ce8f..dbd5f06 100644
--- a/cmd/rescribe/embed_tessdata.go
+++ b/cmd/rescribe/embed_tessdata.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by the GPLv3
// license that can be found in the LICENSE file.
-//go:build embed
+//go:build embed || flatpak
package main
diff --git a/cmd/rescribe/xyz.rescribe.rescribe.yml b/cmd/rescribe/xyz.rescribe.rescribe.yml
index 0e647b5..e579e99 100644
--- a/cmd/rescribe/xyz.rescribe.rescribe.yml
+++ b/cmd/rescribe/xyz.rescribe.rescribe.yml
@@ -18,17 +18,15 @@ modules:
buildsystem: simple
build-commands:
- cd cmd/rescribe && go build .
- - cd cmd/rescribe && go build -tags wayland -o rescribe-wayland .
+ - cd cmd/rescribe && go build -tags flatpak,wayland -o rescribe-wayland .
- install -Dm00755 cmd/rescribe/rescribe $FLATPAK_DEST/bin/rescribe-bin
- install -Dm00755 cmd/rescribe/rescribe-wayland $FLATPAK_DEST/bin/rescribe-bin-wayland
- install -Dm00644 cmd/rescribe/icon.256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/xyz.rescribe.rescribe.png
- install -Dm00644 cmd/rescribe/icon.svg $FLATPAK_DEST/share/icons/hicolor/scalable/apps/xyz.rescribe.rescribe.svg
- install -Dm00644 cmd/rescribe/xyz.rescribe.rescribe.desktop $FLATPAK_DEST/share/applications/xyz.rescribe.rescribe.desktop
- install -Dm00644 cmd/rescribe/xyz.rescribe.rescribe.appdata.xml $FLATPAK_DEST/share/appdata/xyz.rescribe.rescribe.appdata.xml
- - printf '#!/bin/sh\nexport TMPDIR=$XDG_RUNTIME_DIR\nbin=rescribe-bin\ntest -n "$WAYLAND_DISPLAY" && bin=rescribe-bin-wayland\n"$bin" -gbookcmd "/app/bin/getgbook" -tesscmd "/app/bin/tesseract" -t "/app/share/tessdata/rescribev9_fast.traineddata"\n' > $FLATPAK_DEST/bin/rescribe
+ - printf '#!/bin/sh\nexport TMPDIR=$XDG_RUNTIME_DIR\nbin=rescribe-bin\ntest -n "$WAYLAND_DISPLAY" && bin=rescribe-bin-wayland\n"$bin" -gbookcmd "/app/bin/getgbook" -tesscmd "/app/bin/tesseract"\n' > $FLATPAK_DEST/bin/rescribe
- chmod 755 $FLATPAK_DEST/bin/rescribe
- - mkdir -p $FLATPAK_DEST/share/tessdata
- - cp -r tessdata/* $FLATPAK_DEST/share/tessdata/
sources:
- type: git
url: https://github.com/rescribe/bookpipeline
@@ -38,11 +36,9 @@ modules:
url: https://rescribe.xyz/rescribe/modules-20240206-d2399a.tar.xz
sha256: 682820d4cb6129c564cf8df494dc12d35ab059ed99dba34c0b3d6260f7fc30fb
strip-components: 0
- - type: archive
+ - type: file
url: https://rescribe.xyz/rescribe/embeds/tessdata.20220322.zip
sha256: 725fd570a3c3dc0eba9463248ce47a8646db8bafb198d428d6bb8f0be18540ee
- strip-components: 0
- dest: tessdata
- name: leptonica
sources:
- type: git