From 01690256010fc2555ab93f78b74f40d188d9e36c Mon Sep 17 00:00:00 2001 From: madonuko Date: Sun, 9 Feb 2025 18:26:45 +0800 Subject: [PATCH 1/2] add: bun-bin Closes #3159. --- anda/devs/bun/anda.hcl | 5 +++ anda/devs/bun/bun-bin.spec | 62 ++++++++++++++++++++++++++++++++++++++ anda/devs/bun/update.rhai | 1 + 3 files changed, 68 insertions(+) create mode 100644 anda/devs/bun/anda.hcl create mode 100644 anda/devs/bun/bun-bin.spec create mode 100644 anda/devs/bun/update.rhai diff --git a/anda/devs/bun/anda.hcl b/anda/devs/bun/anda.hcl new file mode 100644 index 0000000000..5f9d7a6df5 --- /dev/null +++ b/anda/devs/bun/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "bun-bin.spec" + } +} diff --git a/anda/devs/bun/bun-bin.spec b/anda/devs/bun/bun-bin.spec new file mode 100644 index 0000000000..aa0fadfe89 --- /dev/null +++ b/anda/devs/bun/bun-bin.spec @@ -0,0 +1,62 @@ +%ifarch x86_64 +%global a x64 +%elifarch aarch64 +%global a aarch64 +%endif + +Name: bun-bin +Version: 1.2.2 +Release: 1%?dist +Summary: Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one +License: MIT +URL: https://bun.sh +Source0: https://github.com/oven-sh/bun/releases/download/bun-v%version/bun-linux-%a.zip +BuildRequires: unzip + +%prep +unzip %SOURCE0 +%global buildsubdir bun-linux-%a +cd %buildsubdir +cat< LICENSE +MIT License + +Copyright (c) Jarred Sumner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +EOF + +%install +declare -a shells=("zsh" "bash" "fish") +for s in "${shells[@]}"; do + SHELL=$s ./bun completions > bun.$s +done + +install -Dpm755 bun -t %buildroot%_bindir +install -Dm644 bun.zsh %buildroot%zsh_completions_dir/_bun +install -Dm644 bun.bash -t %buildroot%bash_completions_dir +install -Dm644 bun.fish -t %buildroot%fish_completions_dir +ln -s bun %buildroot%_bindir/bunx + +%files +%license LICENSE +%_bindir/bun +%_bindir/bunx +%bash_completions_dir/bun.bash +%fish_completions_dir/bun.fish +%zsh_completions_dir/_bun diff --git a/anda/devs/bun/update.rhai b/anda/devs/bun/update.rhai new file mode 100644 index 0000000000..d710d93078 --- /dev/null +++ b/anda/devs/bun/update.rhai @@ -0,0 +1 @@ +rpm.version(gh_rawfile("oven-sh/bun", "main", "LATEST")); From a55a388772ed7a5548736cc7595197b8236ddcfb Mon Sep 17 00:00:00 2001 From: madonuko Date: Mon, 26 May 2025 19:56:36 +0800 Subject: [PATCH 2/2] feat(bun): support for x86_64_v3 --- anda/devs/bun/bun-bin.spec | 52 +++++++++++++++++++++++++++++++++----- anda/devs/bun/pre.rhai | 4 +++ 2 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 anda/devs/bun/pre.rhai diff --git a/anda/devs/bun/bun-bin.spec b/anda/devs/bun/bun-bin.spec index aa0fadfe89..749147beec 100644 --- a/anda/devs/bun/bun-bin.spec +++ b/anda/devs/bun/bun-bin.spec @@ -1,22 +1,54 @@ -%ifarch x86_64 +%define debug_package %nil +%ifarch x86_64_v3 %global a x64 +%elifarch x86_64 +%global a x64-baseline %elifarch aarch64 %global a aarch64 %endif Name: bun-bin -Version: 1.2.2 -Release: 1%?dist +Version: 1.2.14 +Release: 3%?dist Summary: Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one License: MIT URL: https://bun.sh Source0: https://github.com/oven-sh/bun/releases/download/bun-v%version/bun-linux-%a.zip -BuildRequires: unzip + +%description +%summary. + + +%package bash-completion +Summary: Bash completion for %{name} +Requires: %{name} = %{version}-%{release} +Requires: bash-completion +Supplements: (%{name} and bash-completion) + +%description bash-completion +Bash command line completion support for %{name}. + +%package fish-completion +Summary: Fish completion for %{name} +Requires: %{name} = %{version}-%{release} +Requires: fish +Supplements: (%{name} and fish) + +%description fish-completion +Fish command line completion support for %{name}. + +%package zsh-completion +Summary: Zsh completion for %{name} +Requires: %{name} = %{version}-%{release} +Requires: zsh +Supplements: (%{name} and zsh) + +%description zsh-completion +Zsh command line completion support for %{name}. + %prep -unzip %SOURCE0 -%global buildsubdir bun-linux-%a -cd %buildsubdir +%autosetup -n bun-linux-%a cat< LICENSE MIT License @@ -57,6 +89,12 @@ ln -s bun %buildroot%_bindir/bunx %license LICENSE %_bindir/bun %_bindir/bunx + +%files bash-completion %bash_completions_dir/bun.bash + +%files fish-completion %fish_completions_dir/bun.fish + +%files zsh-completion %zsh_completions_dir/_bun diff --git a/anda/devs/bun/pre.rhai b/anda/devs/bun/pre.rhai new file mode 100644 index 0000000000..89a63b48a5 --- /dev/null +++ b/anda/devs/bun/pre.rhai @@ -0,0 +1,4 @@ +if sh("ps | grep anda | wc -l", #{ "stdout": "piped" }).ctx.stdout[0] == "1" { + print("pre: building for x86_64_v3 first"); + sh("../anda/target/debug/anda build devs/bun -rrpmbuild --rpm-target x86_64_v3", #{}); +}