public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [ITP] tree-sitter
@ 2023-01-02 21:34 Ken Brown
  2023-01-07 13:25 ` Jon Turney
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Brown @ 2023-01-02 21:34 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

cygport file and patch attached.

This package is present in all the major Linux distros.  I've tested the build 
on SCALLYWAG (https://github.com/cygwin/scallywag/actions/runs/3824702717), and 
I've tested that the library works as expected with the development version of 
emacs-29.

Ken

[-- Attachment #2: tree-sitter.cygport --]
[-- Type: text/plain, Size: 1252 bytes --]

NAME="tree-sitter"
VERSION=0.20.7
RELEASE=1
LICENSE="MIT"

HOMEPAGE="https://tree-sitter.github.io"
SRC_URI="https://github.com/tree-sitter/${NAME}/archive/v${VERSION}/${NAME}-${VERSION}.tar.gz"
PATCH_URI="Makefile.patch"
CATEGORY="Libs Devel"
SUMMARY="An incremental parsing system for programming tools"
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"

PKG_NAMES="libtree-sitter0 libtree-sitter-devel"

libtree_sitter0_SUMMARY="${SUMMARY} (runtime)"
libtree_sitter0_CONTENTS="usr/bin/cygtree-sitter-0.dll"

libtree_sitter_devel_SUMMARY="${SUMMARY} (development)"
libtree_sitter_devel_CONTENTS="
	usr/include
	usr/lib
	usr/share/doc"

src_compile() {
	lndirs
	cd ${B}
	cygmake
}

src_install() {
	cd ${B}
	cyginstall PREFIX=/usr
}

SCALLYWAG=nodeploy

[-- Attachment #3: Makefile.patch --]
[-- Type: text/plain, Size: 2519 bytes --]

--- origsrc/tree-sitter-0.20.7/Makefile	2022-09-02 18:00:47.000000000 -0400
+++ src/tree-sitter-0.20.7/Makefile	2023-01-02 14:07:08.545346600 -0500
@@ -3,6 +3,7 @@ VERSION := 0.6.3
 # install directory layout
 PREFIX ?= /usr/local
 INCLUDEDIR ?= $(PREFIX)/include
+BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= $(PREFIX)/lib
 PCLIBDIR ?= $(LIBDIR)/pkgconfig
 
@@ -26,37 +27,19 @@ SONAME_MAJOR := 0
 SONAME_MINOR := 0
 
 # OS-specific bits
-ifeq ($(shell uname),Darwin)
-	SOEXT = dylib
-	SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib
-	SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib
-	LINKSHARED += -dynamiclib -Wl,-install_name,$(LIBDIR)/libtree-sitter.$(SONAME_MAJOR).dylib
-else
-	SOEXT = so
-	SOEXTVER_MAJOR = so.$(SONAME_MAJOR)
-	SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR)
-	LINKSHARED += -shared -Wl,-soname,libtree-sitter.so.$(SONAME_MAJOR)
-endif
-ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
-	PCLIBDIR := $(PREFIX)/libdata/pkgconfig
-endif
-
-all: libtree-sitter.a libtree-sitter.$(SOEXTVER)
+	SOEXT = dll
+	LINKSHARED += -shared -Wl,--out-implib,libtree-sitter.dll.a
 
-libtree-sitter.a: $(OBJ)
-	$(AR) rcs $@ $^
+all: cygtree-sitter-$(SONAME_MAJOR).$(SOEXT)
 
-libtree-sitter.$(SOEXTVER): $(OBJ)
+cygtree-sitter-$(SONAME_MAJOR).$(SOEXT): $(OBJ)
 	$(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@
-	ln -sf $@ libtree-sitter.$(SOEXT)
-	ln -sf $@ libtree-sitter.$(SOEXTVER_MAJOR)
 
 install: all
+	install -d '$(DESTDIR)$(BINDIR)'
+	install -m755 cygtree-sitter-$(SONAME_MAJOR).$(SOEXT) '$(DESTDIR)$(BINDIR)'/cygtree-sitter-$(SONAME_MAJOR).$(SOEXT)
 	install -d '$(DESTDIR)$(LIBDIR)'
-	install -m755 libtree-sitter.a '$(DESTDIR)$(LIBDIR)'/libtree-sitter.a
-	install -m755 libtree-sitter.$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter.$(SOEXTVER)
-	ln -sf libtree-sitter.$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter.$(SOEXTVER_MAJOR)
-	ln -sf libtree-sitter.$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter.$(SOEXT)
+	install -m755 libtree-sitter.dll.a '$(DESTDIR)$(LIBDIR)'/libtree-sitter.dll.a
 	install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter
 	install -m644 lib/include/tree_sitter/*.h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/
 	install -d '$(DESTDIR)$(PCLIBDIR)'
@@ -66,6 +49,6 @@ install: all
 	    tree-sitter.pc.in > '$(DESTDIR)$(PCLIBDIR)'/tree-sitter.pc
 
 clean:
-	rm -f lib/src/*.o libtree-sitter.a libtree-sitter.$(SOEXT) libtree-sitter.$(SOEXTVER_MAJOR) libtree-sitter.$(SOEXTVER)
+	rm -f lib/src/*.o cygtree-sitter-$(SONAME_MAJOR).$(SOEXT) libtree-sitter.dll.a
 
 .PHONY: all install clean

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ITP] tree-sitter
  2023-01-02 21:34 [ITP] tree-sitter Ken Brown
@ 2023-01-07 13:25 ` Jon Turney
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Turney @ 2023-01-07 13:25 UTC (permalink / raw)
  To: Ken Brown, cygwin-apps

On 02/01/2023 21:34, Ken Brown via Cygwin-apps wrote:
> cygport file and patch attached.
> 
> This package is present in all the major Linux distros.  I've tested the 
> build on SCALLYWAG 
> (https://github.com/cygwin/scallywag/actions/runs/3824702717), and I've 
> tested that the library works as expected with the development version 
> of emacs-29.

Looks good. Thanks.

I added tree-sitter to your packages.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-07 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 21:34 [ITP] tree-sitter Ken Brown
2023-01-07 13:25 ` Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).