From nobody Fri Jul 21 19:00:00 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R6zQ86Rtrz4nnVC; Fri, 21 Jul 2023 19:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R6zQ84bzCz4DCr; Fri, 21 Jul 2023 19:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689966000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CiU5Drqa/mvuiyWZKbaFoTy3YlrfmrIpFdd2OybA1EQ=; b=MzUdaFA+DuYHEZ9+933hxBwSb74veupXWKLXOJEgvm45LSDv+UUdtB+C1XfogqOrcZP+PO 4+SaJ+p5oIEMEGRO6Wpb5xm92T6/o/YaTxfJkMabhQw0rO3MABgfexVF3AwoRRn2S8TVaZ jIlnvwrzI186Tyshkg2HZs73HzsPybSrcYG1Biy3Tcm5pbj5nxpgE/1gi75b8pBnAlx8dr ukX3vcJYRpPujMe/lvkJ7kKikmKoNdWcgIALJg0R2dhE2S0sdxUcmWXvFdrdgd8dmQZWao EmBEcLry3eSN9xYkCwJuvClgZ1+gkSfookD3fQrEknJ5eNuupZkFEATuEYZXWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689966000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CiU5Drqa/mvuiyWZKbaFoTy3YlrfmrIpFdd2OybA1EQ=; b=i7/4HNesZRRw2wtamMlCuhxbgGo+GDUw9z7/n3oKdJB5jXGuG7r7jMYf3TceiLQwYt7Ncl s5WJViX89FXSoqQjEOQFS6GZ3PXlo2oDDI89fUtTsEPn6cVWRk9p4UEv33FDSUxKTnhUXj hKrU3ZqZ0Rxl0z2PZYdG6Qc72zhiyHxhW8bdXXX4vgrPkmxg/THTIQmk46snEdORMa2mbj mPXhzaEvHPeWzw+x0Wzl0Mvof1K2z1rKD1+qWNsDGN7LdbBVL/mdy5KqJ1uYPQlcNZuk1K lSjY3Mk4OX7iJ1XzDZWuWliYBhhAAhaAXo0NM7G2xklSI/9heJARjrx47SHJgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689966000; a=rsa-sha256; cv=none; b=GyiRBEm6hejXrKVINrVJ6nzLKQFbTA/Z5UBQPBazmfRus1fXZ9eB0nN7UFcoaq4Lz3HadZ H93uO8BjQvIZ8emlOnE6BE3fFvtm24f8h/OmmOY8IkXhi6jM9piBtgGu7IAPXcs/pgMUce 04esBCQ4ihHi/6J/uOram99R22eJZOp8kVc45xbKvtvdSXAxcaopRNDQBElTPpD1JmhpXe 2j6Vjlrvoms8kWoxD/i+qSmZofic00bt7/K+lq+b5S8+jHNtPjHE0QsO4GuJifliWBj3mq Ltg6NY+6qqCulsPXDxDYxJa6YEjF9oyV4tWXzdP9wd5O0lgWpONd7qIK0PAnsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R6zQ8356GzP7v; Fri, 21 Jul 2023 19:00:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36LJ009X041803; Fri, 21 Jul 2023 19:00:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36LJ00I8041782; Fri, 21 Jul 2023 19:00:00 GMT (envelope-from git) Date: Fri, 21 Jul 2023 19:00:00 GMT Message-Id: <202307211900.36LJ00I8041782@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 62072792a60d - main - math/libdivsufsort: New port: Lightweight suffix-sorting library List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62072792a60d0c11a8d4fa07d9b93c13976c56b7 Auto-Submitted: auto-generated The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=62072792a60d0c11a8d4fa07d9b93c13976c56b7 commit 62072792a60d0c11a8d4fa07d9b93c13976c56b7 Author: Yuri Victorovich AuthorDate: 2023-07-21 18:59:23 +0000 Commit: Yuri Victorovich CommitDate: 2023-07-21 18:59:57 +0000 math/libdivsufsort: New port: Lightweight suffix-sorting library --- math/Makefile | 1 + math/libdivsufsort/Makefile | 32 ++++++++++++++++++++++++++++++++ math/libdivsufsort/distinfo | 3 +++ math/libdivsufsort/files/test.c | 34 ++++++++++++++++++++++++++++++++++ math/libdivsufsort/pkg-descr | 7 +++++++ 5 files changed, 77 insertions(+) diff --git a/math/Makefile b/math/Makefile index 0d8c393b4db6..7fea1dcd2f10 100644 --- a/math/Makefile +++ b/math/Makefile @@ -444,6 +444,7 @@ SUBDIR += libccd SUBDIR += libcerf SUBDIR += libdivide + SUBDIR += libdivsufsort SUBDIR += libfixmath SUBDIR += libflame SUBDIR += libformfactor diff --git a/math/libdivsufsort/Makefile b/math/libdivsufsort/Makefile new file mode 100644 index 000000000000..220c8accbb85 --- /dev/null +++ b/math/libdivsufsort/Makefile @@ -0,0 +1,32 @@ +PORTNAME= libdivsufsort +DISTVERSIONPREFIX= v +DISTVERSION= 2.0.1-14 +DISTVERSIONSUFFIX= -g5f60d6f +CATEGORIES= math + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Lightweight suffix-sorting library +WWW= https://github.com/y-256/libdivsufsort + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= cmake pathfix +USE_LDCONFIG= yes + +USE_GITHUB= yes +GH_ACCOUNT= y-256 + +PLIST_FILES= include/divsufsort.h \ + lib/libdivsufsort.so \ + lib/libdivsufsort.so.3 \ + lib/libdivsufsort.so.3.0.1 \ + libdata/pkgconfig/libdivsufsort.pc + +do-test: + @cd ${TEST_WRKSRC} && \ + ${SETENV} ${TEST_ENV} ${CC} ${FILESDIR}/test.c -I${STAGEDIR}${PREFIX}/include -L${STAGEDIR}${PREFIX}/lib -ldivsufsort && \ + ${ECHO} "==> running the test program:" && \ + LD_PRELOAD=${STAGEDIR}${PREFIX}/lib/libdivsufsort.so ${TEST_WRKSRC}/a.out + +.include diff --git a/math/libdivsufsort/distinfo b/math/libdivsufsort/distinfo new file mode 100644 index 000000000000..63ebe645c508 --- /dev/null +++ b/math/libdivsufsort/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1689965360 +SHA256 (y-256-libdivsufsort-v2.0.1-14-g5f60d6f_GH0.tar.gz) = 9de40c9a343a3776c4a9ebc2dac93d0f1cd8ce021cd095b5d9ecc381c2207eab +SIZE (y-256-libdivsufsort-v2.0.1-14-g5f60d6f_GH0.tar.gz) = 25900 diff --git a/math/libdivsufsort/files/test.c b/math/libdivsufsort/files/test.c new file mode 100644 index 000000000000..f001733d9254 --- /dev/null +++ b/math/libdivsufsort/files/test.c @@ -0,0 +1,34 @@ +// simple example from README + +#include +#include +#include + +#include + +int main() { + // intput data + char *Text = "abracadabra"; + int n = strlen(Text); + int i, j; + + // allocate + int *SA = (int *)malloc(n * sizeof(int)); + + // sort + divsufsort((unsigned char *)Text, SA, n); + + // output + for(i = 0; i < n; ++i) { + printf("SA[%2d] = %2d: ", i, SA[i]); + for(j = SA[i]; j < n; ++j) { + printf("%c", Text[j]); + } + printf("$\n"); + } + + // deallocate + free(SA); + + return 0; +} diff --git a/math/libdivsufsort/pkg-descr b/math/libdivsufsort/pkg-descr new file mode 100644 index 000000000000..0024aaeafae3 --- /dev/null +++ b/math/libdivsufsort/pkg-descr @@ -0,0 +1,7 @@ +libdivsufsort is a software library that implements a lightweight suffix array +construction algorithm. + +This library provides a simple and an efficient C API to construct a suffix +array and a Burrows-Wheeler transformed string from a given string over a +constant-size alphabet. The algorithm runs in O(n log n) worst-case time using +only 5n+O(1) bytes of memory space, where n is the length of the string.