[PATCH 0/2] gnu: Add latino.

  • Open
  • quality assurance status badge
Details
One participant
  • Adam Faiz
Owner
unassigned
Submitted by
Adam Faiz
Severity
normal
A
A
Adam Faiz wrote on 21 Feb 2023 14:20
(address . guix-patches@gnu.org)
5a9da59f-0f77-6fec-aa7f-8a1968e7af5f@disroot.org
From 61ad312f6f4663b1208eba1cd175df0e0bc15837 Mon Sep 17 00:00:00 2001
Message-Id: <cover.1676971062.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 21 Feb 2023 17:17:42 +0800
Subject: [PATCH 0/2] gnu: Add latino.

The first patch fixes linenoise to provide shared libraries.
The second patch adds the Latino programming language.

AwesomeAdam54321 (2):
gnu: linenoise: Patch in a 'make install' target.
gnu: Add latino.

gnu/local.mk | 4 +
gnu/packages/latino.scm | 66 +++++++++++++
.../linenoise-add-install-target.patch | 51 ++++++++++
.../patches/linenoise-add-symbol-map.patch | 25 +++++
...noise-mark-internal-functions-static.patch | 95 +++++++++++++++++++
.../patches/linenoise-use-symbol-map.patch | 14 +++
gnu/packages/shells.scm | 32 +++----
7 files changed, 270 insertions(+), 17 deletions(-)
create mode 100644 gnu/packages/latino.scm
create mode 100644 gnu/packages/patches/linenoise-add-install-target.patch
create mode 100644 gnu/packages/patches/linenoise-add-symbol-map.patch
create mode 100644
gnu/packages/patches/linenoise-mark-internal-functions-static.patch
create mode 100644 gnu/packages/patches/linenoise-use-symbol-map.patch


base-commit: 08edbd2535ae622d319a51e6f877d23d75dc24f3
--
2.39.1
A
A
Adam Faiz wrote on 21 Feb 2023 14:36
[PATCH 1/2] gnu: linenoise: Patch in a 'make install' target.
(address . 61675@debbugs.gnu.org)
b0d33734-c5e2-8e50-739e-9d6c3a5fcf43@disroot.org
From 8739b1b5d6eb9de504d7799e22efd7996acfac83 Mon Sep 17 00:00:00 2001
Message-Id:
<8739b1b5d6eb9de504d7799e22efd7996acfac83.1676986321.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 21 Feb 2023 17:02:14 +0800
Subject: [PATCH 1/2] gnu: linenoise: Patch in a 'make install' target.

* gnu/packages/shells.scm (linenoise): Patch in a 'make install' target.
[source]: Remove '-checkout' suffix. Add patches for a 'make install'
target.
[arguments]: Use gexps. Proceed with build procedure in GNUmakefile.libs.
* gnu/packages/patches/linenoise-add-install-target.patch: New file.
* gnu/packages/patches/linenoise-add-symbol-map.patch: New file.
* gnu/packages/patches/linenoise-mark-internal-functions-static.patch: New
file.
* gnu/packages/patches/linenoise-use-symbol-map.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
gnu/local.mk | 4 +
.../linenoise-add-install-target.patch | 51 ++++++++++
.../patches/linenoise-add-symbol-map.patch | 25 +++++
...noise-mark-internal-functions-static.patch | 95 +++++++++++++++++++
.../patches/linenoise-use-symbol-map.patch | 14 +++
gnu/packages/shells.scm | 32 +++----
6 files changed, 204 insertions(+), 17 deletions(-)
create mode 100644 gnu/packages/patches/linenoise-add-install-target.patch
create mode 100644 gnu/packages/patches/linenoise-add-symbol-map.patch
create mode 100644
gnu/packages/patches/linenoise-mark-internal-functions-static.patch
create mode 100644 gnu/packages/patches/linenoise-use-symbol-map.patch

Toggle diff (289 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5fcbdd4586..b64d6fc966 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1384,6 +1384,10 @@ dist_patch_DATA = \
%D%/packages/patches/lightdm-arguments-ordering.patch \
%D%/packages/patches/lightdm-vncserver-check.patch \
%D%/packages/patches/lightdm-vnc-color-depth.patch \
+ %D%/packages/patches/linenoise-add-install-target.patch \
+ %D%/packages/patches/linenoise-add-symbol-map.patch \
+ %D%/packages/patches/linenoise-mark-internal-functions-static.patch \
+ %D%/packages/patches/linenoise-use-symbol-map.patch \
%D%/packages/patches/localed-xorg-keyboard.patch \
%D%/packages/patches/kcontacts-incorrect-country-name.patch \
%D%/packages/patches/kde-cli-tools-delay-mime-db.patch \
diff --git a/gnu/packages/patches/linenoise-add-install-target.patch
b/gnu/packages/patches/linenoise-add-install-target.patch
new file mode 100644
index 0000000000..7371126574
--- /dev/null
+++ b/gnu/packages/patches/linenoise-add-install-target.patch
@@ -0,0 +1,51 @@
+This patch is taken from https://github.com/antirez/linenoise/pull/174
+
+Subject: [PATCH] linenoise: Add a makefile for creating and installing
libraries and headers.
+--- a/GNUmakefile.libs 1970-01-01 07:30:00.000000000 +0730
++++ b/GNUmakefile.libs 2023-02-21 13:29:52.275610851 +0800
+@@ -0,0 +1,45 @@
++PREFIX ?= /usr/local
++INCLUDEDIR ?= $(PREFIX)/include
++LIBDIR ?= $(PREFIX)/lib
++
++SOURCES = linenoise.c
++HEADERS = $(SOURCES:%.c=%.h)
++OBJECTS = $(SOURCES:%.c=%.o)
++
++LIBVERSION = 0.0.0
++
++SHLIBNAME = liblinenoise.so.$(LIBVERSION)
++SONAME = liblinenoise.so.$(word 1, $(subst ., ,$(LIBVERSION)))
++STLIBNAME = liblinenoise.a
++
++LD = $(CC)
++
++DEFAULT_CPPFLAGS =
++DEFAULT_CFLAGS = -Wall -W -O2 -g -fPIC
++DEFAULT_LDFLAGS = -shared -Wl,-soname,$(SONAME)
++
++all: $(SHLIBNAME) $(STLIBNAME)
++
++$(SHLIBNAME): $(OBJECTS)
++ $(LD) $(DEFAULT_LDFLAGS) $(LDFLAGS) $^ -o $@
++
++$(STLIBNAME): $(OBJECTS)
++ $(AR) $(ARFLAGS) $@ $^
++
++$(OBJECTS) : %.o : %.c
++ $(CC) $(DEFAULT_CPPFLAGS) $(CPPFLAGS) $(DEFAULT_CFLAGS) $(CFLAGS) \
++ -c $< -o $@
++
++install: $(SHLIBNAME)
++ install -d $(DESTDIR)$(INCLUDEDIR)
++ install -m 0644 $(HEADERS) $(DESTDIR)$(INCLUDEDIR)
++ install -d $(DESTDIR)$(LIBDIR)
++ install -m 0644 $(STLIBNAME) $(DESTDIR)$(LIBDIR)
++ install -m 0755 $(SHLIBNAME) $(DESTDIR)$(LIBDIR)
++ ln -sf $(SHLIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
++ ln -sf $(SHLIBNAME) $(DESTDIR)$(LIBDIR)/liblinenoise.so
++
++clean:
++ rm -f $(SHLIBNAME) $(STLIBNAME) $(OBJECTS)
++
++.PHONY: all clean install
diff --git a/gnu/packages/patches/linenoise-add-symbol-map.patch
b/gnu/packages/patches/linenoise-add-symbol-map.patch
new file mode 100644
index 0000000000..ec241e60b1
--- /dev/null
+++ b/gnu/packages/patches/linenoise-add-symbol-map.patch
@@ -0,0 +1,25 @@
+This patch is taken from https://github.com/antirez/linenoise/pull/174
+
+Subject: [PATCH] linenoise: Add a symbol-map for versioning symbols in
the shared library.
+--- a/symbol.map 1970-01-01 07:30:00.000000000 +0730
++++ b/symbol.map 2023-02-21 13:31:08.620340334 +0800
+@@ -0,0 +1,19 @@
++LINENOISE_0.0 {
++global:
++ linenoiseSetCompletionCallback;
++ linenoiseSetHintsCallback;
++ linenoiseSetFreeHintsCallback;
++ linenoiseAddCompletion;
++ linenoise;
++ linenoiseFree;
++ linenoiseHistoryAdd;
++ linenoiseHistorySetMaxLen;
++ linenoiseHistorySave;
++ linenoiseHistoryLoad;
++ linenoiseClearScreen;
++ linenoiseSetMultiLine;
++ linenoisePrintKeyCodes;
++
++local:
++ *;
++};
diff --git
a/gnu/packages/patches/linenoise-mark-internal-functions-static.patch
b/gnu/packages/patches/linenoise-mark-internal-functions-static.patch
new file mode 100644
index 0000000000..e08bb05f19
--- /dev/null
+++ b/gnu/packages/patches/linenoise-mark-internal-functions-static.patch
@@ -0,0 +1,95 @@
+This patch is adapted from https://github.com/antirez/linenoise/pull/174
+
+Subject: [PATCH] linenoise: Mark functions that are not part of the API
as static.
+--- a/linenoise.c 1970-01-01 07:30:01.000000000 +0730
++++ b/linenoise.c 2023-02-21 13:28:59.739080092 +0800
+@@ -473,7 +473,7 @@
+
+ /* Helper of refreshSingleLine() and refreshMultiLine() to show hints
+ * to the right of the prompt. */
+-void refreshShowHints(struct abuf *ab, struct linenoiseState *l, int
plen) {
++static void refreshShowHints(struct abuf *ab, struct linenoiseState
*l, int plen) {
+ char seq[64];
+ if (hintsCallback && plen+l->len < l->cols) {
+ int color = -1, bold = 0;
+@@ -635,7 +637,7 @@
+ /* Insert the character 'c' at cursor current position.
+ *
+ * On error writing to the terminal -1 is returned, otherwise 0. */
+-int linenoiseEditInsert(struct linenoiseState *l, char c) {
++static int linenoiseEditInsert(struct linenoiseState *l, char c) {
+ if (l->len < l->buflen) {
+ if (l->len == l->pos) {
+ l->buf[l->pos] = c;
+@@ -662,7 +664,7 @@
+ }
+
+ /* Move cursor on the left. */
+-void linenoiseEditMoveLeft(struct linenoiseState *l) {
++static void linenoiseEditMoveLeft(struct linenoiseState *l) {
+ if (l->pos > 0) {
+ l->pos--;
+ refreshLine(l);
+@@ -670,7 +672,7 @@
+ }
+
+ /* Move cursor on the right. */
+-void linenoiseEditMoveRight(struct linenoiseState *l) {
++static void linenoiseEditMoveRight(struct linenoiseState *l) {
+ if (l->pos != l->len) {
+ l->pos++;
+ refreshLine(l);
+@@ -678,7 +680,7 @@
+ }
+
+ /* Move cursor to the start of the line. */
+-void linenoiseEditMoveHome(struct linenoiseState *l) {
++static void linenoiseEditMoveHome(struct linenoiseState *l) {
+ if (l->pos != 0) {
+ l->pos = 0;
+ refreshLine(l);
+@@ -686,7 +688,7 @@
+ }
+
+ /* Move cursor to the end of the line. */
+-void linenoiseEditMoveEnd(struct linenoiseState *l) {
++static void linenoiseEditMoveEnd(struct linenoiseState *l) {
+ if (l->pos != l->len) {
+ l->pos = l->len;
+ refreshLine(l);
+@@ -697,7 +699,7 @@
+ * entry as specified by 'dir'. */
+ #define LINENOISE_HISTORY_NEXT 0
+ #define LINENOISE_HISTORY_PREV 1
+-void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
++static void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
+ if (history_len > 1) {
+ /* Update the current history entry before to
+ * overwrite it with the next one. */
+@@ -721,7 +723,7 @@
+
+ /* Delete the character at the right of the cursor without altering
the cursor
+ * position. Basically this is what happens with the "Delete" keyboard
key. */
+-void linenoiseEditDelete(struct linenoiseState *l) {
++static void linenoiseEditDelete(struct linenoiseState *l) {
+ if (l->len > 0 && l->pos < l->len) {
+ memmove(l->buf+l->pos,l->buf+l->pos+1,l->len-l->pos-1);
+ l->len--;
+@@ -731,7 +733,7 @@
+ }
+
+ /* Backspace implementation. */
+-void linenoiseEditBackspace(struct linenoiseState *l) {
++static void linenoiseEditBackspace(struct linenoiseState *l) {
+ if (l->pos > 0 && l->len > 0) {
+ memmove(l->buf+l->pos-1,l->buf+l->pos,l->len-l->pos);
+ l->pos--;
+@@ -743,7 +745,7 @@
+
+ /* Delete the previosu word, maintaining the cursor at the start of the
+ * current word. */
+-void linenoiseEditDeletePrevWord(struct linenoiseState *l) {
++static void linenoiseEditDeletePrevWord(struct linenoiseState *l) {
+ size_t old_pos = l->pos;
+ size_t diff;
+
diff --git a/gnu/packages/patches/linenoise-use-symbol-map.patch
b/gnu/packages/patches/linenoise-use-symbol-map.patch
new file mode 100644
index 0000000000..c58378adf1
--- /dev/null
+++ b/gnu/packages/patches/linenoise-use-symbol-map.patch
@@ -0,0 +1,14 @@
+This patch is taken from https://github.com/antirez/linenoise/pull/174
+
+Subject: [PATCH] linenoise: Add a symbol-map for versioning symbols in
the shared library.
+--- a/GNUmakefile.libs 2023-02-21 13:29:52.275610851 +0800
++++ b/GNUmakefile.libs 2023-02-21 13:30:55.336216832 +0800
+@@ -16,7 +16,7 @@
+
+ DEFAULT_CPPFLAGS =
+ DEFAULT_CFLAGS = -Wall -W -O2 -g -fPIC
+-DEFAULT_LDFLAGS = -shared -Wl,-soname,$(SONAME)
++DEFAULT_LDFLAGS = -shared -Wl,-soname,$(SONAME)
-Wl,--version-script=symbol.map
+
+ all: $(SHLIBNAME) $(STLIBNAME)
+
diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 0c8cbf3f4c..8561db835f 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -658,27 +658,25 @@ (define-public linenoise
(uri (git-reference
(url "https://github.com/antirez/linenoise")
(commit commit)))
- (file-name (string-append name "-" version "-checkout"))
+ (file-name (git-file-name name version))
(sha256
(base32
- "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
+ "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))
+ (patches (search-patches
+ "linenoise-mark-internal-functions-static.patch"
+ "linenoise-add-install-target.patch"
+ "linenoise-add-symbol-map.patch"
+ "linenoise-use-symbol-map.patch"))))
(build-system gnu-build-system)
(arguments
- `(#:tests? #f ; no tests are included
- #:make-flags
- (list ,(string-append "CC=" (cc-for-target)))
- #:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- ;; At the moment there is no 'make install' in upstream.
- (let* ((out (assoc-ref outputs "out")))
- (install-file "linenoise.h"
- (string-append out "/include/linenoise"))
- (install-file "linenoise.c"
- (string-append out "/include/linenoise"))
- #t))))))
+ (list #:tests? #f ; no tests are included
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ (string-append "PREFIX=" #$output)
+ "--makefile=GNUmakefile.libs")
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure))))
(home-page "https://github.com/antirez/linenoise")
(synopsis "Minimal zero-config readline replacement")
(description

base-commit: 08edbd2535ae622d319a51e6f877d23d75dc24f3
--
2.39.1
A
A
Adam Faiz wrote on 21 Feb 2023 14:46
[PATCH 2/2] gnu: Add latino.
(address . 61675@debbugs.gnu.org)
1ad50ca0-c218-d602-3026-5c2441105b5f@disroot.org
From cb275653fdd7bb8562708e7865a0be8d903998d6 Mon Sep 17 00:00:00 2001
Message-Id:
<cb275653fdd7bb8562708e7865a0be8d903998d6.1676986321.git.adam.faiz@disroot.org>
In-Reply-To:
<8739b1b5d6eb9de504d7799e22efd7996acfac83.1676986321.git.adam.faiz@disroot.org>
References:
<8739b1b5d6eb9de504d7799e22efd7996acfac83.1676986321.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Tue, 21 Feb 2023 17:06:04 +0800
Subject: [PATCH 2/2] gnu: Add latino.

* gnu/packages/latino.scm: New file.
---
gnu/packages/latino.scm | 66 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 gnu/packages/latino.scm

Toggle diff (74 lines)
diff --git a/gnu/packages/latino.scm b/gnu/packages/latino.scm
new file mode 100644
index 0000000000..ae12702b8a
--- /dev/null
+++ b/gnu/packages/latino.scm
@@ -0,0 +1,66 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Adam Faiz <adam.faiz@disroot.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages latino)
+ #:use-module (guix build-system cmake)
+ #:use-module (guix git-download)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages readline)
+ #:use-module (gnu packages shells))
+
+(define-public latino
+ (let ((commit "c9ba798aeebd733c0986eced78021394b2d87d4c")
+ (revision "0"))
+ (package
+ (name "latino")
+ (version (git-version "1.4.3" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/lenguaje-latino/latino-core")
+ (commit commit)))
+ (file-name
+ (git-file-name name version))
+ (sha256
+ (base32 "1pmplp32i5c546mcij9cks3lgqysz1bixy8ll4v9bb8c3f5pmaa1"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ; Unbundle linenoise
+ (for-each delete-file-recursively
+ '("src/lib" "src/linenoise"))
+ (substitute* "src/CMakeLists.txt"
+ ((".*linenoise.*") "")
+ (("latuilib.c") "latuilib.c)")
+ (("link_libraries.m.")
+ (string-append "link_libraries(m)\n"
+ " link_libraries(linenoise)")))))))
+ (build-system cmake-build-system)
+ (inputs
+ (list linenoise readline))
+ (synopsis "Programming language with Spanish syntax")
+ (description
+ "Latino is a programming language with Spanish syntax,
+inspired by Lua and Python.")
+ (home-page "https://www.lenguajelatino.org")
+ (license license:gpl3+))))
--
2.39.1
?