tree-sitter/tree-sitter.spec
Björn Bidar c23cd3b70c - update to 0.23.0:
* test: modernize scanner files
  * fix: always reset to the first language when iterating over language
  * feat(zig): update outdated path syntax
  * feat(bindings): add query constants to python
  * style(bindings): fix indent & line endings
  * feat(dsl)!: support other JS runtimes
  * feat(bindings): add node, python, swift tests 
  * introduce tree-sitter-language crate for grammar crates to depend on
  * refactor: remove ansi_term dependency
  * refactor: remove difference dependency
  * feat: add fuzz subcommand
  * fix(wasm): update test
  * feat(lib): add ts_query_end_byte_for_pattern
  * fix(rust): fix new clippy warnings
  * feat(lib): support no_std
  * Reset language when resetting wasm store
  * docs: clean up binding & parser lists
  * clone wasm store engine
  * fix(cli): dedup preceding_auxiliary_symbols
- use of ldconfig_scriptlets, and removal of the duplicate setting of buildflags

OBS-URL: https://build.opensuse.org/package/show/editors/tree-sitter?expand=0&rev=29
2024-09-16 08:18:59 +00:00

132 lines
4.2 KiB
RPMSpec

#
# spec file for package tree-sitter
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define somajor 0_23
Name: tree-sitter
Version: 0.23.0
Release: 0
Summary: An incremental parsing system for programming tools
License: GPL-2.0-only AND MIT
URL: https://tree-sitter.github.io/
Source0: https://github.com/tree-sitter/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor.tar.zst
Source11: baselibs.conf
Source20: tree-sitter-target.py
Source21: macros.in
Source22: macros.lua
Source23: functions.lua
Source24: compile-macros.sh
Source25: treesitter_grammar.attr
Source26: treesitter_grammar.req
BuildRequires: cargo-packaging
BuildRequires: rust > 1.74.1
Requires: lib%{name}%{somajor} = %{version}
Requires: nodejs
%{?suse_build_hwcaps_libs}
%description
Tree-sitter is a parser generator tool and an incremental parsing
library. It can build a concrete syntax tree for a source file
and efficiently update the syntax tree as the source file is
edited. Tree-sitter aims to be:
* General enough to parse any programming language
* Fast enough to parse on every keystroke in a text editor
* Robust enough to provide useful results even in the presence
of syntax errors
* Dependency-free so that the runtime library (which is written
in pure C) can be embedded in any application
%package -n lib%{name}%{somajor}
Summary: Asychronous I/O support library
Obsoletes: lib%{name}0 < %{version}
%description -n lib%{name}%{somajor}
Tree-sitter is a parser generator tool and an incremental parsing
library. It can build a concrete syntax tree for a source file
and efficiently update the syntax tree as the source file is
edited. This is the package with the dynamically linked C library.
%package devel
Summary: Development files for %{name}
Requires: lib%{name}%{somajor} = %{version}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%autosetup -p1 -a1
#remove gitignore file from docs
rm %{_builddir}/%{name}-%{version}/docs/.gitignore
cp %{SOURCE21} .
cp %{SOURCE22} .
cp %{SOURCE23} .
# fix VERSION in Makefile
sed -i -e '/^VERSION/s/:= .*$/:= %{version}/' Makefile
%build
%{cargo_build}
%make_build PREFIX=%{_prefix} LIBDIR=%{_libdir} INCLUDEDIR=%{_includedir}
sh %{SOURCE24}
%install
%make_install DESTDIR=%{buildroot} PREFIX=%{_prefix} LIBDIR=%{_libdir} INCLUDEDIR=%{_includedir}
install -p -m 0755 -D %{_builddir}/%{name}-%{version}/target/release/%{name} \
%{buildroot}%{_bindir}/%{name}
install -Dm644 macros.treesitter %{buildroot}%{_rpmmacrodir}/macros.treesitter
install -Dm755 %{SOURCE20} %{buildroot}%{_rpmconfigdir}/$(basename %{SOURCE20})
install -Dm644 %{SOURCE25} %{buildroot}%{_fileattrsdir}/$(basename %{SOURCE25})
install -Dm755 %{SOURCE26} %{buildroot}%{_rpmconfigdir}/$(basename %{SOURCE26})
#remove .a/.la files
find %{buildroot} -type f \( -name "*.la" -o -name "*.a" \) -delete -print
# stupid workaround for "integrating" the grammars into neovim
install -d %{buildroot}%{_libdir}/tree_sitter
%ldconfig_scriptlets -n lib%{name}%{somajor}
%files
%license LICENSE
%doc README.md CONTRIBUTING.md
%{_bindir}/%{name}
%{_rpmconfigdir}/%{name}-target.py
%{_rpmmacrodir}/macros.treesitter
%{_rpmconfigdir}/treesitter_grammar.req
%{_fileattrsdir}/treesitter_grammar.attr
%files -n lib%{name}%{somajor}
%license LICENSE
%{_libdir}/lib%{name}.so.*
%dir %{_libdir}/tree_sitter
%files devel
%doc docs/
%{_includedir}/tree_sitter
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%changelog