Blob Blame History Raw
From 7e5fc9c94f4d622d9ad659bc564f6163be71e1e8 Mon Sep 17 00:00:00 2001
Message-ID: <7e5fc9c94f4d622d9ad659bc564f6163be71e1e8.1705595961.git.mjg@fedoraproject.org>
From: Michael J Gruber <mjg@fedoraproject.org>
Date: Thu, 18 Jan 2024 17:36:33 +0100
Subject: [PATCH] build BibTool against system regex

---
 AutoConf/makefile.in | 11 +++++------
 rewrite.c            |  5 +++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/AutoConf/makefile.in b/AutoConf/makefile.in
index 0a9bbe3..331825a 100644
--- a/AutoConf/makefile.in
+++ b/AutoConf/makefile.in
@@ -234,9 +234,9 @@ NON_ANSI_DEFS = @DEFS@
 REGEX_DIR  = regex-0.12
 # 
 
-REGEX_DEF  = -DREGEX -I$(REGEX_DIR) -I..
+REGEX_DEF  = -DREGEX
 
-REGEX      = regex$(OBJ)
+REGEX      =
 
 # -------------------------------------------------------
 #  Kpathsea Library support.
@@ -363,7 +363,6 @@ HFILES	      = config.h			\
 		${HPATH}parse.h			\
 		${HPATH}print.h			\
 		${HPATH}pxfile.h		\
-		${HPATH}regex.h			\
 		${HPATH}record.h		\
 		${HPATH}resource.h		\
 		${HPATH}rewrite.h		\
@@ -500,8 +499,8 @@ $(OFILES): $(MAKEFILE)
 # __________________________________________________________________
 #  Targets from the GNU Regular Expression Library.
 
-regex$(OBJ): $(REGEX_DIR)$(DIR_SEP)regex.c $(MAKEFILE)
-	$(CC) $(C_FLAGS) -I$(REGEX_DIR) -I.. $(NON_ANSI_DEFS) $(REGEX_DIR)$(DIR_SEP)regex.c $(DONT_LINK) -o $@
+#regex$(OBJ): $(REGEX_DIR)$(DIR_SEP)regex.c $(MAKEFILE)
+#	$(CC) $(C_FLAGS) -I$(REGEX_DIR) -I.. $(NON_ANSI_DEFS) $(REGEX_DIR)$(DIR_SEP)regex.c $(DONT_LINK) -o $@
 
 
 bibtcl:
@@ -535,7 +534,7 @@ Test:
 	(cd test; $(MAKE))
 
 libbibtool.a: $(OLIBFILES)
-	$(AR) $@ $(OLIBFILES) regex.o
+	$(AR) $@ $(OLIBFILES)
 	$(RANLIB) $@
 
 depend:
diff --git a/rewrite.c b/rewrite.c
index d34ccd1..e907d5c 100644
--- a/rewrite.c
+++ b/rewrite.c
@@ -37,7 +37,8 @@
 #include <bibtool/symbols.h>
 
 #ifdef REGEX
-#include <bibtool/regex.h>
+#define __USE_GNU
+#include <regex.h>
 #endif
 
  typedef struct rULE
@@ -248,7 +249,7 @@ static Rule new_rule(field, value, pattern, frame, flags, casep)/*           */
        *SymbolValue(pattern) &&			   /*                        */
        (flags&RULE_REGEXP) )			   /*                        */
   { char *msg;					   /*                        */
-    if ( (RulePattern(rule).buffer = (String)malloc(16)) == NULL )/*         */
+    if ( (RulePattern(rule).buffer = (struct re_dfa_t *)malloc(16)) == NULL )/*         */
     { OUT_OF_MEMORY("pattern"); }		   /*			     */
     RulePattern(rule).allocated = 16;		   /*			     */
     RulePattern(rule).syntax    = RE_SYNTAX_EMACS; /*			     */
-- 
2.43.0.462.gcdfa2ea447