AtlatestRepositorycore-channel
core-channel / tree / src / core / packagesparsing.sgl
1
;;; Incremental parsing.2
;;;3
;;; tree-sitter is what the `*-ts-mode` major modes in Emacs 29+ are built on.4
;;;5
;;; NOTE FOR ANYONE ADDING A PACKAGE: this is the first definition in the6
;;; channel that does not fit the configure/make/install shape the phase model7
;;; assumes. tree-sitter ships **no configure script** -- it is a plain8
;;; Makefile driven by `PREFIX`/`DESTDIR` -- so the `configure` phase is simply9
;;; omitted and `PREFIX=${out}` is passed to both remaining phases. `${out}`10
;;; expands to this package's own store prefix, and a command-line assignment11
;;; overrides the Makefile's `PREFIX ?= /usr/local`.12
;;;13
;;; This works, but only because tree-sitter's Makefile happens to accept the14
;;; two variables the model already passes. A package needing an `autoreconf`15
;;; or a CMake configure step still has no expression here: `run` phases and16
;;; `env:` are sealed by package-v2 but refused at publish until Stage 2.17
(define-library (core packages parsing)18
(import (sigil core)19
(core build-environments)20
(sigil env package)21
(sigil build external))22
(export tree-sitter)23
(begin24
(define tree-sitter25
(package26
name: "tree-sitter"27
version: "0.24.7"28
source: (external-source29
location: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.24.7.tar.gz"30
sha256: "7cbc13c974d6abe978cafc9da12d1e79e07e365c42af75e43ec1b5cdc03ed447")31
buildenv: core-buildenv32
phases: (list33
;; PREFIX is needed at build time too: `tree-sitter.pc` is34
;; generated by the `all` target with the prefix baked in.35
(external-phase kind: 'make args: (list "PREFIX=${out}"))36
(external-phase kind: 'install args: (list "PREFIX=${out}")))))))