Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions projects/kiro.dev/cli/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,24 @@ dependencies:
linux:
alsa-project.org/alsa-lib: "*" # v2.6.0 requires libasound.so.2

# v3 dropped the .app/dmg and the -chat/-term helpers: one kiro-cli binary,
# shipped as a tarball on every platform
build:
- sed -i "s/%%version%%/{{version}}/g" props/shim.{{hw.platform}}
- install -Dm755 props/shim.{{hw.platform}} {{prefix}}/bin/kiro-cli
- install -Dm755 props/shim.{{hw.platform}} {{prefix}}/bin/kiro-cli-chat
- install -Dm755 props/shim.{{hw.platform}} {{prefix}}/bin/kiro-cli-term
- sed -i "s/%%version%%/{{version}}/g" props/shim
- install -Dm755 props/shim {{prefix}}/bin/kiro-cli

provides:
- bin/kiro-cli
- bin/kiro-cli-chat
- bin/kiro-cli-term

test:
dependencies:
gnu.org/coreutils: "*"
env:
linux:
BINS: "{{prefix}}/libexec/bin"
darwin:
BINS: "{{prefix}}/libexec/Contents/MacOS"
script:
# first time will download and execute the actual binary
- rm -rf {{prefix}}/libexec
- test ! -f "$BINS/kiro-cli"
- test ! -f "$BINS/kiro-cli-chat"
- test ! -f "$BINS/kiro-cli-term"
- test ! -f {{prefix}}/libexec/bin/kiro-cli
- kiro-cli --version | grep -w "{{version}}"
# second time will just execute the actual binary
- test -f "$BINS/kiro-cli"
- test -f {{prefix}}/libexec/bin/kiro-cli
- timeout 0.5 kiro-cli --version | grep -w "{{version}}"
# check the other binaries too
- kiro-cli-chat --version | grep -w "{{version}}"
- test -f "$BINS/kiro-cli-chat"
- kiro-cli-term --version | grep -w "{{version}}"
- test -f "$BINS/kiro-cli-term"
# this will fail if kiro-cli cannot find kiro-cli-chat
- kiro-cli chat --help >/dev/null
- kiro-cli chat --help | grep -F 'kiro-cli chat [OPTIONS]'
36 changes: 20 additions & 16 deletions projects/kiro.dev/cli/shim.linux → projects/kiro.dev/cli/shim
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
set -eu

shim_path="$(realpath "$0")"
shim_name="$(basename "${shim_path}")"
binary_dir="$(dirname "${shim_path}")/../libexec/bin"
binary_path="${binary_dir}/${shim_name}"
binary_path="${binary_dir}/kiro-cli"

if [ ! -x "${binary_path}" ]; then
# will be replaced during build
Expand All @@ -14,23 +13,28 @@ if [ ! -x "${binary_path}" ]; then
work_dir="$(mktemp -d -p /tmp "pkgx-kiro-cli-${version}-XXXXXXXXXX")"
trap 'rm -rf "${work_dir}"' EXIT

arch="$(uname -m)"
archive_variant=""

glibc_version="$(getconf GNU_LIBC_VERSION)"
glibc_version="${glibc_version#"glibc "}"
if [ -n "${glibc_version}" ]; then
glibc_major="${glibc_version%%.*}"
glibc_minor="${glibc_version#*.}"
glibc_minor="${glibc_minor%%.*}"

# Use musl-based binaries for glic older than 2.34
if [ "${glibc_major}" -lt 2 ] || { [ "${glibc_major}" -eq 2 ] && [ "${glibc_minor}" -lt 34 ]; }; then
archive_variant="-musl"
if [ "$(uname -s)" = Darwin ]; then
target="universal-darwin"
else
archive_variant=""

glibc_version="$(getconf GNU_LIBC_VERSION)"
glibc_version="${glibc_version#"glibc "}"
if [ -n "${glibc_version}" ]; then
glibc_major="${glibc_version%%.*}"
glibc_minor="${glibc_version#*.}"
glibc_minor="${glibc_minor%%.*}"

# Use musl-based binaries for glic older than 2.34
if [ "${glibc_major}" -lt 2 ] || { [ "${glibc_major}" -eq 2 ] && [ "${glibc_minor}" -lt 34 ]; }; then
archive_variant="-musl"
fi
fi

target="$(uname -m)-linux${archive_variant}"
fi

archive_url="https://desktop-release.q.us-east-1.amazonaws.com/${version}/kirocli-${arch}-linux${archive_variant}.tar.gz"
archive_url="https://desktop-release.q.us-east-1.amazonaws.com/${version}/kirocli-${target}.tar.gz"
archive_path="${work_dir}/kiro-cli.tar.gz"

echo "Downloading ${archive_url}..." >&2
Expand Down
39 changes: 0 additions & 39 deletions projects/kiro.dev/cli/shim.darwin

This file was deleted.

Loading