From patchwork Tue Feb 21 13:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Faiz X-Patchwork-Id: 47192 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0F51716B1D; Tue, 21 Feb 2023 13:37:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5147616B11 for ; Tue, 21 Feb 2023 13:37:12 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUSpM-0005Lj-IB; Tue, 21 Feb 2023 08:37:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUSpJ-0005IC-Vt for guix-patches@gnu.org; Tue, 21 Feb 2023 08:37:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUSpJ-0000Vx-NO for guix-patches@gnu.org; Tue, 21 Feb 2023 08:37:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pUSpJ-00052b-Ja for guix-patches@gnu.org; Tue, 21 Feb 2023 08:37:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61675] [PATCH 1/2] gnu: linenoise: Patch in a 'make install' target. References: <5a9da59f-0f77-6fec-aa7f-8a1968e7af5f@disroot.org> In-Reply-To: <5a9da59f-0f77-6fec-aa7f-8a1968e7af5f@disroot.org> Resent-From: Adam Faiz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Feb 2023 13:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61675 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61675@debbugs.gnu.org Received: via spool by 61675-submit@debbugs.gnu.org id=B61675.167698658518933 (code B ref 61675); Tue, 21 Feb 2023 13:37:01 +0000 Received: (at 61675) by debbugs.gnu.org; 21 Feb 2023 13:36:25 +0000 Received: from localhost ([127.0.0.1]:55014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUSoi-0004vA-Ga for submit@debbugs.gnu.org; Tue, 21 Feb 2023 08:36:25 -0500 Received: from knopi.disroot.org ([178.21.23.139]:38848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pUSoe-0004uD-PS for 61675@debbugs.gnu.org; Tue, 21 Feb 2023 08:36:22 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 33D0944635 for <61675@debbugs.gnu.org>; Tue, 21 Feb 2023 14:36:19 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VUIERREt4wnA for <61675@debbugs.gnu.org>; Tue, 21 Feb 2023 14:36:17 +0100 (CET) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1676986577; bh=4/v9sfCL9XUZYHHjcaMCv+wiAViKjxl17bLsyy7YagE=; h=Date:To:From:Subject; b=XrHVOmQls6t3usCNyICdb1Ow+Yc523PeCQxcRm/AAamWkpxZUL8vtNXr0x93pRsX5 xyiB5jDgdgYw3Qpc+0tXHmrcvqYVFWuzpfs7YS2S+UZWTv0LkQ/x2fsED+Qj9dghMs tttmAw7XynvFkkDYZAKsbDwed7UrpnExdqfq6wdI2PGYEbKXnny2QYGt+ilSO0i/vX hKzBgUEM/l6clWSpwOw3Mu/eYA0qORPZ3FYBr/m4uliDElpsn8lfNsDL4SHo0/ReTc IygLyzFXVxOi6j3YDdAzwIBdN7MhhRq1a2ABGHencqXd8acgkm7w8xfSD142rCZdj6 jiyk2wqRi3oaw== Date: Tue, 21 Feb 2023 21:36:09 +0800 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Adam Faiz X-ACL-Warn: , Adam Faiz via Guix-patches X-Patchwork-Original-From: Adam Faiz via Guix-patches via From: Adam Faiz Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From 8739b1b5d6eb9de504d7799e22efd7996acfac83 Mon Sep 17 00:00:00 2001 Message-Id: <8739b1b5d6eb9de504d7799e22efd7996acfac83.1676986321.git.adam.faiz@disroot.org> From: AwesomeAdam54321 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 base-commit: 08edbd2535ae622d319a51e6f877d23d75dc24f3 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