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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# Maintainer: taotieren <admin@taotieren.com>
pkgname=resd-mini
pkgver=3.1.3
pkgrel=1
pkgdesc="This is the mini version of a high-value, high-performance and diverse resource downloader called res-downloader."
arch=($CARCH)
url="https://github.com/putyy/resd-mini"
license=('Apache-2.0')
provides=(${pkgname})
conflicts=(${pkgname})
# replaces=(${pkgname})
depends=(
glibc
hicolor-icon-theme
)
makedepends=(
pnpm
git
go
)
optdepends=(
'motrix: A full-featured download manager (release version)'
'gopeed-bin: High speed downloader that supports all platforms.(Prebuilt version)'
'res-downloader: This is a high-value and high-performance and diverse resource downloader called res-downloader'
)
backup=()
options=(!debug !strip !lto)
install=${pkgname}.install
source=(
"${pkgname}::git+${url}.git#tag=${pkgver}"
${pkgname}.install)
sha256sums=('b64fd88871ef9b61f7f6adab9a37063b57f367faebc8f314c060f7add364e562'
'46feddf76850fb1a3991f8f82e5ee738b28070e34339e02dbc1f52c83dea5a73')
prepare() {
git -C "${srcdir}/${pkgname}" clean -dfx
cd "${srcdir}/${pkgname}/web"
sed -i '/"@vue\/devtools-kit"/d' package.json
cat > vite.config.ts << 'EOF'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { fileURLToPath, URL } from 'node:url';
const isNode = typeof process !== 'undefined' && process.versions?.node;
if (isNode && typeof window === 'undefined') {
const mockStorage = {
getItem: () => null,
setItem: () => {},
removeItem: () => {},
clear: () => {},
key: () => null,
length: 0
};
(global as any).localStorage = mockStorage;
(global as any).sessionStorage = mockStorage;
}
export default defineConfig({
plugins: [vue({
template: {
compilerOptions: {
isCustomElement: (tag: string) => tag.startsWith('media-')
}
}
})],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: { port: 3000 },
build: {
rollupOptions: {
output: {
manualChunks: {
vue: ['vue'],
vendor: ['vue-router', 'pinia']
}
}
}
}
});
EOF
cat > tsconfig.json << 'EOF'
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
EOF
cat > tsconfig.node.json << 'EOF'
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"types": ["node"]
},
"include": ["vite.config.ts"]
}
EOF
rm -rf node_modules pnpm-lock.yaml
}
build() {
cd "${srcdir}/${pkgname}/"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct
pushd web
export CARGO_HOME="${srcdir}/.cargo"
{
echo -e '\n'
#echo 'build_from_source=true'
echo 'link-workspace-packages=true'
echo 'fetch-retry-maxtimeout=10000'
echo "cache-dir="${srcdir}"/.pnpm_cache"
echo "store-dir="${srcdir}"/.pnpm_store"
echo "shamefully-hoist=true"
echo "virtual-store-dir-max-length=80"
} >>.npmrc
export VITE_DEVTOOLS=false
export NODE_ENV=production
# NODE_ENV=development pnpm install --force
# NODE_ENV=production pnpm run build
pnpm install --force
pnpm run build-only
popd
# wails build
go build -o ${pkgname}
}
package() {
cd "${srcdir}/${pkgname}/"
install -Dvm755 ${pkgname} -t ${pkgdir}/usr/bin
install -Dvm644 web/src/assets/image/logo.png ${pkgdir}/usr/share/icons/hicolor/512x512/apps/${pkgname}.png
# install -Dvm644 build/linux/Arch/${pkgname}.desktop ${pkgdir}/usr/share/applications/${pkgname}.desktop
install -Dvm644 /dev/stdin ${pkgdir}/usr/share/applications/${pkgname}.desktop <<EOF
[Desktop Entry]
Type=Application
Name=${pkgname}
Comment=${pkgdesc}
Exec=${pkgname}
Icon=${pkgname}.png
Terminal=false
Categories=Utility
EOF
}
|