octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #66829] (image) uses GNU extensions for grep


From: Dmitri A. Sergatskov
Subject: [Octave-bug-tracker] [bug #66829] (image) uses GNU extensions for grep
Date: Fri, 21 Feb 2025 18:14:33 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?66829>

                 Summary: (image) uses GNU extensions for grep
                   Group: GNU Octave
               Submitter: dasergatskov
               Submitted: Fri 21 Feb 2025 11:14:29 PM UTC
                Category: Octave Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Mac OS
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 21 Feb 2025 11:14:29 PM UTC By: Dmitri A. Sergatskov <dasergatskov>
A line in the make file:

PKG_ADD     := $(shell grep -sPho '(?<=(//|\#\#) PKG_ADD: ).*' $(CC_SOURCES)
$(M_SOURCES))

cause an error on MacOS (and presumably on some other non-GNU OSes). Parameter
"-P" is a GNU extension and does not work with

% grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD


One way to fix it is to rely on $GREP var like that:

% hg diff
diff -r 4fedd61e2853 Makefile
--- a/Makefile  Fri Feb 21 12:08:49 2025 +0200
+++ b/Makefile  Fri Feb 21 18:05:35 2025 -0500
@@ -6,8 +6,10 @@
 ## notice and this notice are preserved.  This file is offered as-is,
 ## without any warranty.
 
-PACKAGE := $(shell grep "^Name: " DESCRIPTION | cut -f2 -d" ")
-VERSION := $(shell grep "^Version: " DESCRIPTION | cut -f2 -d" ")
+GREP ?= grep
+
+PACKAGE := $(shell $(GREP) "^Name: " DESCRIPTION | cut -f2 -d" ")
+VERSION := $(shell $(GREP) "^Version: " DESCRIPTION | cut -f2 -d" ")
 
 TARGET_DIR      := target
 RELEASE_DIR     := $(TARGET_DIR)/$(PACKAGE)-$(VERSION)
@@ -18,7 +20,7 @@
 M_SOURCES   := $(wildcard inst/*.m)
 CC_SOURCES  := $(wildcard src/*.cc)
 OCT_FILES   := $(patsubst %.cc,%.oct,$(CC_SOURCES))
-PKG_ADD     := $(shell grep -sPho '(?<=(//|\#\#) PKG_ADD: ).*' $(CC_SOURCES)
$(M_SOURCES))
+PKG_ADD     := $(shell $(GREP) -sPho '(?<=(//|\#\#) PKG_ADD: ).*'
$(CC_SOURCES) $(M_SOURCES))
 
 #OCTAVE ?= octave --no-window-system --silent
 # remove --no-window-system in order to use "qt" graphics toolkit
@@ -96,7 +98,7 @@
        $(OCTAVE) ${PATH_ARGS} \
          --eval '${PKG_ADD}' \
          --eval 'pkg load doctest;' \
-         --eval "targets = '$(shell (ls inst; ls src | grep .oct) | cut -f2
-d@ | cut -f1 -d.)';" \
+         --eval "targets = '$(shell (ls inst; ls src | $(GREP) .oct) | cut
-f2 -d@ | cut -f1 -d.)';" \
          --eval "targets = strsplit (targets, ' ');" \
          --eval "doctest (targets);"

(so people can do e.g. "GREP=ggrep make dist" to cal a GNU version of grep
("ggrep" on my system).

Or just re-write the offending line so it does not use "-P" parameter. 

Dmitri.
-- 
 









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66829>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]