blob: 1401ed596c1a5600bd5dee2257af5be04dff0558 (
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
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
187
|
# Maintainer: Your Name <your@email.com>
# Contributor: OpenChatCut Contributors
#
# OpenChatCut — Local-first conversational AI video editor
# https://github.com/0xsline/OpenChatCut
#
# This PKGBUILD uses system Electron (electron-builder is build-only) and
# system Chromium (for Remotion headless rendering) plus system FFmpeg.
# The Remotion serve bundle is prebuilt at package time for fast startup.
#
# ── Building locally ──────────────────────────────────────────────────────
# cd /tmp
# git clone https://github.com/0xsline/OpenChatCut.git openchatcut
# cd openchatcut
# makepkg -si
#
# ── AUR submission notes ──────────────────────────────────────────────────
# Replace 'Your Name' and email above with the AUR maintainer info.
# Run `namcap PKGBUILD` and `namcap openchatcut-*.pkg.tar.zst` for QA.
pkgname=openchatcut
pkgver=0.1.1
pkgrel=1
pkgdesc="Local-first conversational AI video editor with multi-track timeline, Agent Skills, MCP integration, and Remotion-powered rendering"
arch=('x86_64')
url="https://github.com/0xsline/OpenChatCut"
license=('AGPL3')
depends=(
'electron>=30'
'nodejs>=24'
'npm'
'chromium'
'ffmpeg'
'fontconfig'
)
makedepends=(
'git'
)
source=("$pkgname-$pkgver.tar.gz::https://github.com/0xsline/OpenChatCut/archive/refs/tags/v$pkgver.tar.gz"
'electron43-isPackaged.patch')
sha256sums=('dc44414523f118ee9c07a41854843893075981a0c84fa04d72ed21f2c3722711'
'SKIP')
# v0.1.1 annotated tag → commit ab07f81a21bb33700cb4c4a71ff0b2387fb9e625
# GitHub archive handles annotated tags correctly.
prepare() {
cd "$srcdir"
# GitHub archive tag extracts to OpenChatCut-<ver> (capitalized)
if [ -d "OpenChatCut-${pkgver}" ] && [ ! -d "${pkgname}-${pkgver}" ]; then
mv "OpenChatCut-${pkgver}" "${pkgname}-${pkgver}"
fi
cd "${pkgname}-${pkgver}"
# The lockfile ships with npmmirror.com mirrors. npm 12+ refuses to fetch
# lockfile URLs outside the configured registry. Rewrite to canonical npmjs.org.
sed -i 's|https://registry.npmmirror.com/|https://registry.npmjs.org/|g' package-lock.json
# .nvmrc is for dev; ensure it matches our nodejs dep range
echo '24' > .nvmrc
# Arch Electron compat: Arch's electron43 forces app.isPackaged=true,
# which breaks path resolution. Patch to always use import.meta.url.
patch -Np1 < "$srcdir/electron43-isPackaged.patch"
}
build() {
cd "$srcdir/${pkgname}-${pkgver}"
# ── npm install ─────────────────────────────────────────────────────────
# npm 12 blocks install scripts by default. We'll run the essential ones
# manually afterward.
npm install --registry https://registry.npmjs.org
# Manually run essential install scripts that npm 12 blocked
# esbuild — needed for building the Electron main process
node node_modules/esbuild/install.js 2>/dev/null || true
# @ffprobe-installer — make ffprobe executable
chmod 755 node_modules/@ffprobe-installer/linux-x64/ffprobe 2>/dev/null || true
# ── TypeScript check + Vite build (web app) ─────────────────────────────
npm run build
# ── Electron main process (esbuild) ─────────────────────────────────────
npm run desktop:build:main
# ── Remotion serve bundle (avoid on-demand webpack at runtime) ──────────
npx tsx desktop/prebuild-remotion.mts
# ── Remove devDependencies (electron, typescript, vite, etc.) ───────────
# Saves ~165 MB
npm prune --production
}
package() {
cd "$srcdir/${pkgname}-${pkgver}"
local _libdir="/usr/lib/${pkgname}"
install -dm755 "${pkgdir}${_libdir}"
install -dm755 "${pkgdir}/usr/bin"
install -dm755 "${pkgdir}/usr/share/applications"
install -dm755 "${pkgdir}/usr/share/pixmaps"
# ── App code ────────────────────────────────────────────────────────────
cp -r dist "${pkgdir}${_libdir}/dist"
cp -r desktop-dist "${pkgdir}${_libdir}/desktop-dist"
cp -r server "${pkgdir}${_libdir}/server"
cp -r shared "${pkgdir}${_libdir}/shared"
cp -r remotion "${pkgdir}${_libdir}/remotion"
cp -r assets "${pkgdir}${_libdir}/assets"
cp -r public "${pkgdir}${_libdir}/public"
cp -r src "${pkgdir}${_libdir}/src"
# ── npm dependencies (pruned: production only) ──────────────────────────
cp -r node_modules "${pkgdir}${_libdir}/node_modules"
# ── Config / metadata ───────────────────────────────────────────────────
cp package.json "${pkgdir}${_libdir}/"
cp package-lock.json "${pkgdir}${_libdir}/"
cp vite.config.ts "${pkgdir}${_libdir}/"
cp tsconfig.json "${pkgdir}${_libdir}/"
cp tsconfig.app.json "${pkgdir}${_libdir}/"
cp tsconfig.node.json "${pkgdir}${_libdir}/"
cp electron-builder.config.mjs "${pkgdir}${_libdir}/"
cp index.html "${pkgdir}${_libdir}/"
cp .env.example "${pkgdir}${_libdir}/"
# Fix permissions: node_modules/.bin contains launcher scripts
find "${pkgdir}${_libdir}/node_modules/.bin" -type f -exec chmod 755 {} + 2>/dev/null || true
# ── Wrapper script ──────────────────────────────────────────────────────
cat >"${pkgdir}/usr/bin/${pkgname}" <<'WRAPPER'
#!/bin/bash
# OpenChatCut — Arch launcher
# chdirs to XDG config dir, links system binaries, launches via system Electron.
set -euo pipefail
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/openchatcut"
LIB_DIR="/usr/lib/openchatcut"
mkdir -p "$CONFIG_DIR"
# First-run: copy .env.example → .env.local if no config exists
ENV_LOCAL="$CONFIG_DIR/.env.local"
if [ ! -f "$ENV_LOCAL" ]; then
if [ -f "$LIB_DIR/.env.example" ]; then
cp "$LIB_DIR/.env.example" "$ENV_LOCAL"
echo "OpenChatCut: created default config at $ENV_LOCAL"
echo " → Edit it to add your LLM / media-service API keys."
fi
fi
# Speed up Remotion rendering: use prebuilt serve bundle (avoids on-demand webpack)
export CC_REMOTION_BUNDLE="$LIB_DIR/desktop-dist/remotion-bundle"
# Let Remotion find system Chromium for headless rendering
export REMOTION_BROWSER_EXECUTABLE="/usr/bin/chromium"
# Use system FFmpeg/FFprobe (not the bundled static binaries)
export FFMPEG_PATH="/usr/bin/ffmpeg"
export FFPROBE_PATH="/usr/bin/ffprobe"
cd "$CONFIG_DIR"
exec /usr/bin/electron --user-data-dir="$CONFIG_DIR" "$LIB_DIR/desktop-dist/main.mjs" "$@"
WRAPPER
chmod 755 "${pkgdir}/usr/bin/${pkgname}"
# ── Desktop entry ──────────────────────────────────────────────────────
cat >"${pkgdir}/usr/share/applications/${pkgname}.desktop" <<DESKTOP
[Desktop Entry]
Name=OpenChatCut
Comment=Local-first conversational AI video editor
Exec=${pkgname}
Icon=${pkgname}
Type=Application
Categories=AudioVideo;Video;Editor;
Terminal=false
StartupWMClass=OpenChatCut
MimeType=application/x-openchatcut-project;
DESKTOP
# ── Icon ────────────────────────────────────────────────────────────────
install -Dm644 public/openchatcut-icon.png "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
}
|