Created
October 23, 2025 15:37
-
-
Save ItachiSan/56eb360711a28b05539164192e96a933 to your computer and use it in GitHub Desktop.
Fixed Jan AUR package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Maintainer: SelfRef <arch@selfref.dev> | |
| # Contributor: Giovanni 'ItachiSan' Santini <giovannisantini93@yahoo.it> | |
| _pkgbase=jan | |
| pkgname=${_pkgbase} | |
| pkgver=0.7.2 | |
| pkgrel=1 | |
| pkgdesc="An open source alternative to ChatGPT that runs 100% offline on your computer" | |
| url="https://jan.ai/" | |
| arch=('x86_64') | |
| license=('Apache-2.0') | |
| source=("$_pkgbase::git+https://github.com/menloresearch/jan.git#tag=v$pkgver") | |
| sha256sums=('93621d425d287a181de0398a8c30295a94912c5c31893835ac84c51cd3adbdd3') | |
| provides=("$_pkgbase") | |
| conflicts=("$_pkgbase") | |
| options=(!lto) | |
| depends=( | |
| 'gtk3' | |
| 'webkit2gtk-4.1' | |
| ) | |
| optdepends=( | |
| 'libappindicator-gtk3: for tray icon support' | |
| 'uv: for MCP servers based on Python' | |
| 'npm: for MCP servers based on Node.js' | |
| ) | |
| makedepends=( | |
| 'git' | |
| 'cargo' | |
| 'jq' | |
| 'libappindicator-gtk3' | |
| 'nvm' | |
| 'yarn' | |
| ) | |
| _ensure_local_nvm() { | |
| which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload | |
| export NVM_DIR="${srcdir}/.nvm" | |
| source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] | |
| } | |
| _patch_version_files() { | |
| # Make sure we have access to ctoml | |
| export PATH="$PATH:$srcdir/bin" | |
| # Versions get updated in the CI build: | |
| # .github/workflows/jan-tauri-build.yaml -points to-> template-tauri-build-linux-x64.yml -look at-> Update app version base public_provider | |
| # The following is a very optimized version. | |
| json_version_files=( | |
| ./src-tauri/tauri.conf.json | |
| ./web-app/package.json | |
| ./src-tauri/plugins/tauri-plugin-hardware/package.json | |
| ./src-tauri/plugins/tauri-plugin-llamacpp/package.json | |
| ) | |
| for json_version_file in ${json_version_files[@]} | |
| do | |
| echo "-> Patching $json_version_file" >&2 | |
| jq --arg version $pkgver '.version = $version' $json_version_file > $srcdir/patched_file.json | |
| mv $srcdir/patched_file.json $json_version_file | |
| #jq '.version' $json_version_file >&2 | |
| done | |
| toml_version_files=( | |
| ./src-tauri/plugins/tauri-plugin-hardware/Cargo.toml | |
| ./src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml | |
| ./src-tauri/Cargo.toml | |
| ) | |
| for toml_version_file in ${toml_version_files[@]} | |
| do | |
| echo "-> Patching $toml_version_file" | |
| ctoml $toml_version_file package.version $pkgver | |
| #ctoml $toml_version_file package.version >&2 | |
| done | |
| ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools" | |
| } | |
| prepare() { | |
| cd "$_pkgbase" | |
| _ensure_local_nvm | |
| nvm install 20 | |
| export RUSTUP_TOOLCHAIN=stable | |
| cargo install --root "$srcdir" ctoml | |
| [ -f package.json ] && sed -i '/"build:tauri:linux"/ s/\.\/[^ ]*\.sh//g; /"build:tauri:linux"/ s/&& "/--bundles deb"/g' package.json | |
| _patch_version_files | |
| } | |
| build() { | |
| cd "$_pkgbase" | |
| _ensure_local_nvm | |
| export YARN_CACHE_FOLDER="$srcdir"/yarn-cache | |
| export RUSTUP_TOOLCHAIN=stable | |
| rm -rf src-tauri/target/release/bundle/deb | |
| make build | |
| } | |
| package() { | |
| cd "$_pkgbase" | |
| install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_pkgbase/LICENSE" | |
| cd src-tauri/target/release/bundle/deb/Jan_*/data/usr | |
| install -Dm755 bin/Jan -t "$pkgdir"/usr/bin | |
| install -dm755 "$pkgdir"/usr/share | |
| cp -r share/* "$pkgdir"/usr/share | |
| install -dm755 "$pkgdir"/usr/lib | |
| cp -r lib/* "$pkgdir"/usr/lib | |
| rm -r "$pkgdir"/usr/lib/Jan/resources/lib/ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/PKGBUILD b/PKGBUILD | |
| index adb73aa..fb80551 100644 | |
| --- a/PKGBUILD | |
| +++ b/PKGBUILD | |
| @@ -1,15 +1,16 @@ | |
| # Maintainer: SelfRef <arch@selfref.dev> | |
| +# Contributor: Giovanni 'ItachiSan' Santini <giovannisantini93@yahoo.it> | |
| _pkgbase=jan | |
| pkgname=${_pkgbase} | |
| -pkgver=0.6.10 | |
| +pkgver=0.7.2 | |
| pkgrel=1 | |
| pkgdesc="An open source alternative to ChatGPT that runs 100% offline on your computer" | |
| url="https://jan.ai/" | |
| arch=('x86_64') | |
| -license=('AGPL-3.0') | |
| +license=('Apache-2.0') | |
| source=("$_pkgbase::git+https://github.com/menloresearch/jan.git#tag=v$pkgver") | |
| -sha256sums=('c4811e40b4b0a8558eafbb5656a37409697c7f93481ea7e7a0b0a06c6a928587') | |
| +sha256sums=('93621d425d287a181de0398a8c30295a94912c5c31893835ac84c51cd3adbdd3') | |
| provides=("$_pkgbase") | |
| conflicts=("$_pkgbase") | |
| options=(!lto) | |
| @@ -19,13 +20,16 @@ depends=( | |
| ) | |
| optdepends=( | |
| 'libappindicator-gtk3: for tray icon support' | |
| + 'uv: for MCP servers based on Python' | |
| + 'npm: for MCP servers based on Node.js' | |
| ) | |
| makedepends=( | |
| 'git' | |
| - 'nvm' | |
| - 'yarn' | |
| 'cargo' | |
| + 'jq' | |
| 'libappindicator-gtk3' | |
| + 'nvm' | |
| + 'yarn' | |
| ) | |
| _ensure_local_nvm() { | |
| @@ -34,11 +38,53 @@ _ensure_local_nvm() { | |
| source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] | |
| } | |
| +_patch_version_files() { | |
| + # Make sure we have access to ctoml | |
| + export PATH="$PATH:$srcdir/bin" | |
| + | |
| + # Versions get updated in the CI build: | |
| + # .github/workflows/jan-tauri-build.yaml -points to-> template-tauri-build-linux-x64.yml -look at-> Update app version base public_provider | |
| + # The following is a very optimized version. | |
| + json_version_files=( | |
| + ./src-tauri/tauri.conf.json | |
| + ./web-app/package.json | |
| + ./src-tauri/plugins/tauri-plugin-hardware/package.json | |
| + ./src-tauri/plugins/tauri-plugin-llamacpp/package.json | |
| + ) | |
| + for json_version_file in ${json_version_files[@]} | |
| + do | |
| + echo "-> Patching $json_version_file" >&2 | |
| + jq --arg version $pkgver '.version = $version' $json_version_file > $srcdir/patched_file.json | |
| + mv $srcdir/patched_file.json $json_version_file | |
| + #jq '.version' $json_version_file >&2 | |
| + done | |
| + | |
| + | |
| + toml_version_files=( | |
| + ./src-tauri/plugins/tauri-plugin-hardware/Cargo.toml | |
| + ./src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml | |
| + ./src-tauri/Cargo.toml | |
| + ) | |
| + for toml_version_file in ${toml_version_files[@]} | |
| + do | |
| + echo "-> Patching $toml_version_file" | |
| + ctoml $toml_version_file package.version $pkgver | |
| + #ctoml $toml_version_file package.version >&2 | |
| + done | |
| + | |
| + ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools" | |
| +} | |
| + | |
| prepare() { | |
| cd "$_pkgbase" | |
| _ensure_local_nvm | |
| nvm install 20 | |
| + | |
| + export RUSTUP_TOOLCHAIN=stable | |
| + cargo install --root "$srcdir" ctoml | |
| + | |
| [ -f package.json ] && sed -i '/"build:tauri:linux"/ s/\.\/[^ ]*\.sh//g; /"build:tauri:linux"/ s/&& "/--bundles deb"/g' package.json | |
| + _patch_version_files | |
| } | |
| build() { | |
| @@ -56,7 +102,11 @@ package() { | |
| install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_pkgbase/LICENSE" | |
| cd src-tauri/target/release/bundle/deb/Jan_*/data/usr | |
| - install -Dm755 bin/* -t "$pkgdir"/usr/bin | |
| + | |
| + install -Dm755 bin/Jan -t "$pkgdir"/usr/bin | |
| install -dm755 "$pkgdir"/usr/share | |
| cp -r share/* "$pkgdir"/usr/share | |
| + install -dm755 "$pkgdir"/usr/lib | |
| + cp -r lib/* "$pkgdir"/usr/lib | |
| + rm -r "$pkgdir"/usr/lib/Jan/resources/lib/ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment