summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 878bdc279842f16fb323e66584844c9b09492bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=python-easyofd
pkgname=(
  python-easyofd
  easyofd
)
_name=${pkgname#python-}
pkgver=20260427
pkgrel=1
pkgdesc="Easy operate OFD"
arch=($CARCH)
license=('MIT')
url="https://github.com/renoyuan/${_name}"
makedepends=(
  # python-easyofd
  python
  python-reportlab
  python-xmltodict
  python-loguru
  python-fonttools
  python-pymupdf
  python-pyasn1
  python-pillow

  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
  python-pyqt6
  imagemagick
  # AUR
  nuitka
)
# checkdepends=()
source=("${pkgbase}::git+${url}.git#tag=${pkgver}")
sha512sums=('902fc26df19926a704f8d67ca14f13aed87297cb2c1a85ca429ba79f323d22f1a128d577acfc52e9f635f2cc4766039bc30e2a446bc9f1f6c01c133abd2f29e2')

prepare() {
  git -C "${srcdir}/${pkgbase}" clean -dfx
}

build() {
  cd "${srcdir}/${pkgbase}"
  python -m build --wheel --no-isolation

  cd "${srcdir}/${pkgbase}/gui"
  magick ico/reno.ico ico/reno.png
  nuitka \
    --standalone \
    --onefile \
    --lto=yes \
    --jobs=$(nproc) \
    --follow-imports \
    --enable-plugin=pyqt6 \
    --include-module=PIL \
    --include-package-data=PIL \
    --include-package-data=Pillow \
    --output-dir=dist \
    --output-filename=easyofd \
    --remove-output \
    --assume-yes-for-downloads \
    --show-progress \
    --show-memory \
    --show-modules \
    --plugin-enable=anti-bloat \
    --python-flag=no_site \
    --python-flag=no_warnings \
    --include-package-data=easyofd \
    --include-data-files=ico/*=ico/ \
    --linux-icon=ico/reno.png \
    main.py
}

# check() {
#   cd "${srcdir}/${pkgbase}"
# }

package_python-easyofd() {
  arch=(any)
  depends=(
    python
    python-reportlab
    python-xmltodict
    python-loguru
    python-fonttools
    python-pymupdf
    python-pyasn1
    python-pillow
  )
  optdepends=(
    "tesseract-data-chi_sim: OCR data (chi_sim)"
  )

  cd "${srcdir}/${pkgbase}"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

package_easyofd() {
  pkgdesc+=" - GUI"
  arch=($CARCH)
  depends=(
    glibc
    hicolor-icon-theme
  )

  options=('!strip' '!debug' '!lto')
  cd "${srcdir}/${pkgbase}"
  install -vDm755 gui/dist/easyofd -t "$pkgdir"/usr/bin/
  install -vDm644 /dev/stdin "${pkgdir}/usr/share/applications/${pkgname}.desktop" <<EOF
[Desktop Entry]
Name=${pkgname}
Comment=${pkgdesc}
GenericName=${pkgdesc}
Exec=${pkgname}
StartupNotify=false
Terminal=false
Type=Application
Categories=Utility;
Icon=${pkgname}.png
EOF
  install -vDm644 "gui/ico/reno.png" "${pkgdir}/usr/share/icons/hicolor/256x256/apps/${pkgname}.png"

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}