pantry/projects/deno.land/package.yml
2024-04-03 15:32:39 -04:00

87 lines
3 KiB
YAML

distributable:
url: https://github.com/denoland/deno/archive/refs/tags/v{{ version }}.tar.gz
strip-components: 1
versions:
github: denoland/deno
provides:
- bin/deno
interprets:
# extensions: [ts, js] # nodejs.org for now
extensions: ts
args: [deno, run]
runtime:
env:
DENO_NO_UPDATE_CHECK: 'true'
DENORT_BIN: '{{prefix}}/bin/denort'
build:
script:
# deno does not need llvm to build on darwin+x86-64, and if it is present,
# deno will be linked to its libunwind, which then causes deno to need llvm
# in runtime.
- |
if test "{{hw.platform}}+{{ hw.arch }}" != "darwin+x86-64"; then
set -o allexport
source <(pkgx +llvm.org^17)
set +o allexport
fi
- |
rust_version=$(yq -er .toolchain.channel rust-toolchain.toml)
if semverator lt "$rust_version" 1.67.0; then
# older versions of rustc --print=split-debuginfo fails with:
# error: unknown print request `split-debuginfo`
# maybe due to newer cargo?
rust_version=1.67.0
fi
set -o allexport
source <(pkgx "+rust-lang.org~${rust_version}" +rust-lang.org/cargo^0)
set +o allexport
unset rust_version
# https://github.com/denoland/deno/issues/15596 -- reported fixed in 1.25.3
- run: |
find ext/ffi/tinycc -maxdepth 0 -empty -exec \
git clone https://github.com/TinyCC/tinycc.git {} \;
if test "{{hw.platform}}+{{ hw.arch }}" = "darwin+x86-64"; then
# our LLVM cannot build with deployment target set to 10.6
sed -i.bak s/MACOSX_DEPLOYMENT_TARGET/\#/ ext/ffi/tinycc/Makefile
fi
if: '>=1.25.0<1.25.4'
# change default bindir to ~/.local/bin per our conventions
- sed -i'' -e 's/home_path.push(".deno")/home_path.push(".local")/' cli/tools/installer.rs
- grep home_path cli/tools/installer.rs
- cargo install --locked --path cli --root "{{ prefix }}"
dependencies:
git-scm.org: 2 # to build tinycc
curl.se: '*' # required to download v8 (python is another option)
cmake.org: ^3 # deno.land>=1.36.1 requires cmake
protobuf.dev: '*' # deno.land>=1.36.4 requires protoc
github.com/mikefarah/yq: ^4
crates.io/semverator: ^0
test:
dependencies:
gnu.org/coreutils: '*' # for stat and numfmt
script:
- deno --version | grep {{version}}
- mv $FIXTURE test.ts
- deno install -f test.ts
- test "$($HOME/.local/bin/test)" = "Hello, world!"
- deno compile test.ts
- test "$(./test)" = "Hello, world!"
# human readable size of ./test should be equal to the size of denort to ensure our denort is being used
- run: test "$(stat -c %s ./test | numfmt --to=iec-i)" = "$(stat -c %s "{{prefix}}/bin/denort" | numfmt --to=iec-i)"
if: '>=1.40.5'
# tests download of dependencies
- deno eval 'import { VERSION } from "https://deno.land/std@0.221.0/version.ts"; console.log(VERSION);' | tee /dev/stderr | grep -q ^0.221.0$
fixture: |
console.log("Hello, world!");