blob: b843c2e4efc16d9d8f77a07d7e909635dd21af27 (
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
|
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname=text-vision-git
_pkgname=TextVision
_builded_name=tauri-svelte-app
pkgver=1.0.1.r0.g69c14b0
_nodeversion=20
pkgrel=1
pkgdesc="A project that uses OCR to extract text from images."
arch=('any')
url="https://github.com/Ap73MKa/TextVision"
license=('MIT')
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}=${pkgver%.r*}")
depends=(
'gtk3'
'webkit2gtk-4.1'
)
makedepends=(
'gendesk'
'bun'
'nvm'
'git'
'curl'
'gcc'
'rust'
)
source=(
"${pkgname%-git}.git::git+${url}"
)
sha256sums=('SKIP')
pkgver() {
cd "${srcdir}/${pkgname%-git}.git"
set -o pipefail
git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
_ensure_local_nvm() {
local NVM_DIR="${srcdir}/.nvm"
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
nvm install "${_nodeversion}"
nvm use "${_nodeversion}"
}
prepare() {
_ensure_local_nvm
gendesk -q -f -n --pkgname="${pkgname%-git}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${pkgname%-git}" --exec="${pkgname%-git}"
cd "${srcdir}/${pkgname%-git}.git"
HOME="${srcdir}/.electron-gyp"
export CARGO_HOME="${srcdir}/.cargo"
if [ -f bunfig.toml ]; then
rm -rf bunfig.toml
fi
if [ -f bun.lockb ];then
rm -rf bun.lockb
fi
if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then
{
echo '[install]'
echo 'registry = "https://registry.npmmirror.com"'
} >> bunfig.toml
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
fi
sed -i "s/tauri build/tauri build -b deb/g" apps/desktop/package.json
NODE_ENV=development bun install
}
build() {
cd "${srcdir}/${pkgname%-git}.git"
NODE_ENV=production bun run build-desk
}
package() {
install -Dm755 "${srcdir}/${pkgname%-git}.git/apps/desktop/src-tauri/target/release/bundle/deb/${_builded_name}_"*/data/usr/bin/"${_builded_name}" \
"${pkgdir}/usr/bin/${pkgname%-git}"
icon_sizes=(32x32 128x128 256x256@2)
for _icons in "${icon_sizes[@]}";do
install -Dm644 "${srcdir}/${pkgname%-git}.git/apps/desktop/src-tauri/target/release/bundle/deb/${_builded_name}_"*/data/usr/share/icons/hicolor/"${_icons}"/apps/"${_builded_name}.png" \
"${pkgdir}/usr/share/icons/hicolor/${_icons//@2/}/apps/${pkgname%-git}.png"
done
install -Dm644 "${srcdir}/${pkgname%-git}.desktop" -t "${pkgdir}/usr/share/applications"
install -Dm644 "${srcdir}/${pkgname%-git}.git/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
|