G/A
Rain, so went in search of something to do.
The attached patch is proof(?) C89 can still work with the big stuff at
least; compiles all the needed bits of PCRE 10.22 and only finds one
(cast) error which I think other compilers will whinge/warn about also.
AFAIK PCRE is no longer a supplied source and the patch removes build
bits that make that assumption, and support for PCRE versions prior to
8.x...
Mostly a day waster exercise and FYI.
Norm
Index: NWGNUmakefile
===================================================================
--- NWGNUmakefile (revision 1781186)
+++ NWGNUmakefile (working copy)
@@ -73,9 +73,27 @@
# These flags will come after CFLAGS
#
XCFLAGS += \
- -DHAVE_CONFIG_H \
$(EOLIST)
+ifdef WITH_PCRE2
+# PCRE 10.xx
+ PCRELIB = $(OBJDIR)/pcre2-8.lib
+
+XCFLAGS += \
+ -DHAVE_CONFIG_H \
+ -DHAVE_PCRE2 \
+ -DPCRE2_CODE_UNIT_WIDTH=8 \
+ $(EOLIST)
+else
+# PCRE 8.xx
+ PCRELIB = $(OBJDIR)/pcre.lib
+
+XCFLAGS += \
+ -DHAVE_CONFIG_H \
+ $(EOLIST)
+
+endif
+
#
# These defines will come after DEFINES
#
@@ -355,10 +373,32 @@
# These are the OBJ files needed to create the LIB target above.
# Paths must all use the '/' character
#
-ifeq "$(wildcard $(PCRE)/pcre.c)" "$(PCRE)/pcre.c"
+ifdef WITH_PCRE2
FILES_lib_objs = \
- $(OBJDIR)/pcre.o \
+ $(OBJDIR)/chartables.o \
+ $(OBJDIR)/pcre2_auto_possess.o \
+ $(OBJDIR)/pcre2_compile.o \
+ $(OBJDIR)/pcre2_config.o \
+ $(OBJDIR)/pcre2_context.o \
+ $(OBJDIR)/pcre2_dfa_match.o \
+ $(OBJDIR)/pcre2_error.o \
+ $(OBJDIR)/pcre2_find_bracket.o \
+ $(OBJDIR)/pcre2_jit_compile.o \
+ $(OBJDIR)/pcre2_maketables.o \
+ $(OBJDIR)/pcre2_match.o \
+ $(OBJDIR)/pcre2_match_data.o \
+ $(OBJDIR)/pcre2_newline.o \
+ $(OBJDIR)/pcre2_ord2utf.o \
+ $(OBJDIR)/pcre2_pattern_info.o \
+ $(OBJDIR)/pcre2_string_utils.o \
+ $(OBJDIR)/pcre2_study.o \
+ $(OBJDIR)/pcre2_substitute.o \
+ $(OBJDIR)/pcre2_substring.o \
+ $(OBJDIR)/pcre2_tables.o \
+ $(OBJDIR)/pcre2_ucd.o \
+ $(OBJDIR)/pcre2_valid_utf.o \
+ $(OBJDIR)/pcre2_xclass.o \
$(EOLIST)
else
@@ -373,11 +413,6 @@
$(OBJDIR)/pcre_tables.o \
$(OBJDIR)/pcre_version.o \
$(EOLIST)
-ifeq "$(wildcard $(PCRE)/pcre_try_flipped.c)" "$(PCRE)/pcre_try_flipped.c"
-FILES_lib_objs += \
- $(OBJDIR)/pcre_try_flipped.o \
- $(EOLIST)
-endif
endif
@@ -460,10 +495,8 @@
prebuild :: FORCE
$(MAKE) -C $(SERVER) -f NWGNUmakefile
- $(MAKE) -C $(PCRE) -f NWGNUmakefile
$(call MKDIR,$(PREBUILD_INST))
$(call COPY,$(SERVER)/$(OBJDIR)/*.nlm, $(PREBUILD_INST)/)
- $(call COPY,$(PCRE)/$(OBJDIR)/*.nlm, $(PREBUILD_INST)/)
#
# Any specialized rules here
@@ -471,7 +504,7 @@
vpath %.c server:modules/arch/netware:modules/http:modules/aaa:modules/mappers
vpath %.c modules/generators:modules/metadata:modules/filters:modules/loggers
-vpath %.c modules/core:os/netware:server/mpm/netware:$(PCRE)
+vpath %.c modules/core:os/netware:server/mpm/netware:$(PCRESRC)
$(OBJDIR)/chartables.o: os/netware/chartables.c
Index: build/NWGNUenvironment.inc
===================================================================
--- build/NWGNUenvironment.inc (revision 1781186)
+++ build/NWGNUenvironment.inc (working copy)
@@ -56,11 +56,17 @@
endif
ifndef PCRESRC
-PCRESRC = $(AP_WORK)/srclib/pcre
+$(error PCRESRC does not point to a valid PCRE[2] source tree)
endif
-ifneq "$(wildcard $(PCRESRC)/pcre-config.in)" "$(PCRESRC)/pcre-config.in"
+ifdef WITH_PCRE2
+ifneq "$(wildcard $(PCRESRC)/pcre2.h.in)" "$(PCRESRC)/pcre2.h.in"
+$(error PCRESRC does not point to a valid PCRE2 source tree)
+endif
+else
+ifneq "$(wildcard $(PCRESRC)/pcre.h.in)" "$(PCRESRC)/pcre.h.in"
$(error PCRESRC does not point to a valid PCRE source tree)
endif
+endif
# This is a placeholder
# ifndef ZLIBSDK
@@ -377,7 +383,6 @@
APULDAP = $(APRUTIL)/ldap
XML = $(APRUTIL)/xml
APRTEST = $(APR)/test
-PCRE = $(PCRESRC)
PREBUILD_INST = $(SRC)/nwprebuild
@@ -389,7 +394,6 @@
APRUTLIB = $(APRUTIL)/$(OBJDIR)/aprutil.lib
APULDAPLIB = $(APULDAP)/$(OBJDIR)/apuldap.lib
STMODLIB = $(STDMOD)/$(OBJDIR)/stdmod.lib
-PCRELIB = $(SRC)/$(OBJDIR)/pcre.lib
NWOSLIB = $(NWOS)/$(OBJDIR)/netware.lib
SERVLIB = $(SERVER)/$(OBJDIR)/server.lib
HTTPDLIB = $(HTTPD)/$(OBJDIR)/httpd.lib
Index: build/NWGNUmakefile
===================================================================
--- build/NWGNUmakefile (revision 1781186)
+++ build/NWGNUmakefile (working copy)
@@ -19,9 +19,19 @@
FILES_prebuild_headers = \
$(SRC)/include/ap_config_layout.h \
$(NWOS)/test_char.h \
- $(PCRE)/config.h \
- $(PCRE)/pcre.h \
$(EOLIST)
+
+ifdef WITH_PCRE2
+FILES_prebuild_headers += \
+ $(PCRESRC)/config.h \
+ $(PCRESRC)/pcre2.h \
+ $(EOLIST)
+else
+FILES_prebuild_headers += \
+ $(PCRESRC)/config.h \
+ $(PCRESRC)/pcre.h \
+ $(EOLIST)
+endif
nlms :: libs $(NWOS)/httpd.imp $(DAV)/main/dav.imp $(STDMOD)/cache/mod_cache.imp $(STDMOD)/proxy/mod_proxy.imp
@@ -67,23 +77,24 @@
@echo Creating $@
$(call COPY,$<,$@)
-$(PCRE)/%.h: $(PCRE)/%.h.generic
+$(PCRESRC)/%.h: $(PCRESRC)/%.h.generic
@echo Creating $@
$(call COPY,$<,$@)
-$(PCRE)/%.h: $(PCRE)/%.hw
+$(PCRESRC)/%.h: $(PCRESRC)/%.hw
@echo Creating $@
$(call COPY,$<,$@)
ifneq "$(BUILDTOOL_AS_NLM)" "1"
-$(NWOS)/chartables.c: dftables.exe $(PCRE)/dftables.c
+$(NWOS)/chartables.c: dftables.exe $(PCRESRC)/dftables.c
@echo $(DL)GEN $@$(DL)
$< $@
-%.exe: $(PCRE)/%.c $(PCRE)/config.h $(PCRE)/pcre.h
+%.exe: $(PCRESRC)/%.c $(PCRESRC)/config.h $(PCRESRC)/pcre.h
+%.exe: $(PCRESRC)/%.c $(PCRESRC)/config.h $(PCRESRC)/pcre2.h
@echo $(DL)Creating Build Helper $@$(DL)
- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DHAVE_CONFIG_H $< -o $@
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 $< -o $@
$(NWOS)/test_char.h: gen_test_char.exe $(SERVER)/gen_test_char.c
@echo $(DL)GEN $@$(DL)