# Copyright 2024 Foster Hangdaan # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. pkgname=deno-lts pkgver=2.1.5 pkgrel=1 _rusty_v8_ver=130.0.7 pkgdesc="A modern runtime for JavaScript and TypeScript. (LTS release)" arch=('x86_64') url="https://deno.land" license=('MIT') options=('!lto') conflicts=('deno') depends=('gcc-libs') makedepends=('git' 'python' 'rust' 'nodejs' 'gn' 'ninja' 'clang' 'lld' 'cmake' 'protobuf') source=("deno::git+https://code.fosterhangdaan.com/foster/denoland-deno.git#tag=v${pkgver}" "rusty_v8::git+https://code.fosterhangdaan.com/foster/denoland-rusty-v8.git#tag=v${_rusty_v8_ver}" "compiler-rt-adjust-paths.patch") sha512sums=('2660dac69566dc4253c1b19b34733142b6769e8c40178a46732b9296517a39550dc678029fa0508eb47d2fb51dc136c288b99bc8a5b6aa6d248fef38a6f0a292' '1cd55adc8470a5e4523b87c7d2c88a17a309e79a6c980ba02f14e72ae3b6197408a67fe0d5834ee2f082a3792d17a86d1f142b93ec878db802528e65d76e7275' '0c2ece5e4dfe3cb98acf29feb420b728ffc60472a0613bfcfbb4930d9186c54cece0840ba7ec9327b6ea5ed4f052189795086ee7c6b6fb77ec781504c4ebae7a') prepare() { cd rusty_v8 git config -f .gitmodules submodule.v8.shallow true git submodule update --init --recursive # https://github.com/denoland/rusty_v8/issues/1587 patch -Np1 -i ../compiler-rt-adjust-paths.patch cd ../deno echo -e "\n[patch.crates-io]\nv8 = { path = '../rusty_v8' }" >> Cargo.toml } build() { cd deno # this uses malloc_usable_size, which is incompatible with fortification level 3 export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" local _clang_version=$(clang --version | grep -m1 version | sed 's/.* \([0-9]\+\).*/\1/') local _extra_gn_args=( 'custom_toolchain="//build/toolchain/linux/unbundle:default"' 'host_toolchain="//build/toolchain/linux/unbundle:default"' "clang_version=\"$_clang_version\"" ) export CC=clang CXX=clang++ AR=ar NM=nm export V8_FROM_SOURCE=1 export CLANG_BASE_PATH=/usr export GN=/usr/bin/gn NINJA=/usr/bin/ninja export EXTRA_GN_ARGS="${_extra_gn_args[@]}" cargo build --release } check() { cd deno ./target/release/deno run tests/testdata/run/002_hello.ts } package() { cd deno install -Dm755 target/release/deno "$pkgdir"/usr/bin/deno install -dm755 "$pkgdir"/usr/share/bash-completion/completions ./target/release/deno completions bash > "$pkgdir"/usr/share/bash-completion/completions/deno install -dm755 "$pkgdir"/usr/share/zsh/site-functions ./target/release/deno completions zsh > "$pkgdir"/usr/share/zsh/site-functions/_deno install -dm755 "$pkgdir"/usr/share/fish/vendor_completions.d ./target/release/deno completions fish > "$pkgdir"/usr/share/fish/vendor_completions.d/deno.fish install -Dm644 LICENSE.md -t "$pkgdir"/usr/share/licenses/deno/ }