diff --git a/.gitignore b/.gitignore index 6604817..49ee812 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.pc *.o *~ +*.lha __pycache__ .deps @@ -78,3 +79,4 @@ src/stamp-h1 /bazel-* # End + diff --git a/Makefile.os4 b/Makefile.os4 new file mode 100644 index 0000000..20f8de5 --- /dev/null +++ b/Makefile.os4 @@ -0,0 +1,271 @@ +# +# Project: pcre2 +# +# Created on: 10-01-2022 22:01:46 +# +# commands to use: +# make -f Makefile.os4 libpcre2.a +# make -f Makefile.os4 libpcre2-posix.a +# make -f Makefile.os4 pcre2test +# sh RunTest +# make -f Makefile.os4 clean +# + +################################################################### +## +##//// Objects +## +################################################################### + +libpcre2_OBJ := \ + src/pcre2_chartables.o src/pcre2_auto_possess.o src/pcre2_compile.o \ + src/pcre2_config.o src/pcre2_context.o src/pcre2_convert.o \ + src/pcre2_dfa_match.o src/pcre2_error.o src/pcre2_extuni.o \ + src/pcre2_find_bracket.o src/pcre2_jit_compile.o src/pcre2_maketables.o \ + src/pcre2_match.o src/pcre2_match_data.o src/pcre2_newline.o \ + src/pcre2_ord2utf.o src/pcre2_pattern_info.o src/pcre2_script_run.o \ + src/pcre2_serialize.o src/pcre2_string_utils.o src/pcre2_study.o \ + src/pcre2_substitute.o src/pcre2_substring.o src/pcre2_tables.o \ + src/pcre2_ucd.o src/pcre2_valid_utf.o src/pcre2_xclass.o \ + + + +pcre2posix_OBJ := \ + src/pcre2posix.o + + +pcre2test_OBJ := \ + src/pcre2test.o + + +pcre2grep_OBJ := \ + src/pcre2grep.o + +################################################################### +## +##//// Variables and Environment +## +################################################################### + +MCRT := -mcrt=newlib +ifeq ($(USE_CLIB2), yes) +MCRT := -mcrt=clib2 +endif + +CC := gcc:bin/gcc + +INCPATH := -I. -Isrc + +# for pcre2test +CFLAGS := $(MCRT) $(INCPATH) -O2 -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 + +################################################################### +## +##//// General rules +## +################################################################### + +.PHONY: all all-before all-after clean clean-custom realclean + +all: all-before libpcre2.a libpcre2-posix.a all-after + +all-before: +# You can add rules here to execute before the project is built + +all-after: +# You can add rules here to execute after the project is built + +tests: pcre2test pcre2grep + +clean: clean-custom + @echo "Cleaning compiler objects..." + @rm -f $(libpcre2_OBJ) $(pcre2posix_OBJ) $(pcre2test_OBJ) + +cleanall: clean + @echo "Cleaning compiler targets..." + @rm -f libpcre.a libpcre-posix.a pcre2test pcre2grep + +################################################################### +## +##//// Targets +## +################################################################### + +libpcre2.a: $(libpcre2_OBJ) + ar -rcs libpcre2.a $(libpcre2_OBJ) + ranlib libpcre2.a + +libpcre2-posix.a: $(pcre2posix_OBJ) + ar -rcs libpcre2-posix.a $(pcre2posix_OBJ) + ranlib libpcre2-posix.a + +pcre2test: libpcre2.a libpcre2-posix.a $(pcre2test_OBJ) + @echo "Linking pcre2test" + @gcc:bin/gcc $(MCRT) -o pcre2test $(pcre2test_OBJ) -L. -lauto -lpcre2 -lpcre2-posix + @echo "Removing stale debug target: pcre2test" + @rm -f pcre2test.debug + +pcre2grep: libpcre2.a $(pcre2grep_OBJ) + @echo "Linking pcre2grep" + @gcc:bin/gcc $(MCRT) -o pcre2grep $(pcre2grep_OBJ) -L . -lauto -lpcre2 + @echo "Removing stale debug target: pcre2grep" + @rm -f pcre2grep.debug + + +################################################################### +## +##//// Standard rules +## +################################################################### + +# A default rule to make all the objects listed below +# because we are hiding compiler commands from the output + +.c.o: + @echo "Compiling $<" + @$(CC) -c $< -o $*.o $(CFLAGS) + +src/pcre2_chartables.o: src/pcre2_chartables.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_auto_possess.o: src/pcre2_auto_possess.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_compile.o: src/pcre2_compile.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h src/pcre2_intmodedep.h \ + + +src/pcre2_config.o: src/pcre2_config.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_context.o: src/pcre2_context.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_convert.o: src/pcre2_convert.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_dfa_match.o: src/pcre2_dfa_match.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_error.o: src/pcre2_error.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_extuni.o: src/pcre2_extuni.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_find_bracket.o: src/pcre2_find_bracket.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_jit_compile.o: src/pcre2_jit_compile.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h src/pcre2_intmodedep.h \ + src/sljit/sljitLir.c src/sljit/sljitLir.h src/sljit/sljitConfig.h \ + src/sljit/sljitConfigInternal.h src/sljit/sljitUtils.c src/sljit/sljitProtExecAllocator.c \ + src/sljit/sljitWXExecAllocator.c src/sljit/sljitExecAllocator.c src/pcre2_jit_simd_inc.h \ + src/pcre2_jit_neon_inc.h src/pcre2_jit_match.c + +src/pcre2_maketables.o: src/pcre2_maketables.c + +src/pcre2_match.o: src/pcre2_match.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_match_data.o: src/pcre2_match_data.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_newline.o: src/pcre2_newline.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_ord2utf.o: src/pcre2_ord2utf.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_pattern_info.o: src/pcre2_pattern_info.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_script_run.o: src/pcre2_script_run.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_serialize.o: src/pcre2_serialize.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2test.o: src/pcre2test.c src/config.h src/pcre2.h \ + src/pcre2posix.h src/pcre2_internal.h src/pcre2_ucp.h \ + src/pcre2_intmodedep.h src/pcre2_tables.c src/pcre2_ucptables.c \ + src/pcre2_ucd.c src/pcre2_printint.c + +src/pcre2_string_utils.o: src/pcre2_string_utils.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_study.o: src/pcre2_study.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_substitute.o: src/pcre2_substitute.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_substring.o: src/pcre2_substring.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2posix.o: src/pcre2posix.c src/config.h src/pcre2.h \ + + +src/pcre2_tables.o: src/pcre2_tables.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h src/pcre2_intmodedep.h \ + + +src/pcre2_ucd.o: src/pcre2_ucd.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_valid_utf.o: src/pcre2_valid_utf.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + +src/pcre2_xclass.o: src/pcre2_xclass.c src/config.h src/pcre2_internal.h \ + src/pcre2.h src/pcre2_ucp.h + + +src/pcre2grep.o: src/pcre2grep.c src/config.h + +################################################################### +## +##//// Custom rules +## +################################################################### + +runtests: libpcre2.a libpcre2-posix.a tests + sh RunTest + sh RunGrepTest + +release: + @echo "Create release folders..." + @mkdir -p release/local/newlib/lib release/local/clib2/lib release/local/Documentation/pcre2 release/local/common/include + + @echo "Building newlib based libraries..." + @make -f Makefile.os4 all + @cp libpcre2.a release/local/newlib/lib/ + @cp libpcre2-posix.a release/local/newlib/lib/ + + @echo "Clean build and libraries files..." + @make -f Makefile.os4 cleanall + + @echo "Building clib2 based libraries..." + @make -f Makefile.os4 all USE_CLIB2=yes + @cp libpcre2.a release/local/clib2/lib/ + @cp libpcre2-posix.a release/local/clib2/lib/ + + @echo "Copy the necessary files..." + @cp src/pcre2.h release/local/common/include/ + @cp src/pcre2posix.h release/local/common/include/ + @cp COPYING release/local/Documentation/pcre2/ + @cp HACKING release/local/Documentation/pcre2/ + @cp LICENCE release/local/Documentation/pcre2/ + @cp README release/local/Documentation/pcre2/ + @cp README-OS4.md release/local/Documentation/pcre2/ + + @echo "Clean build and libraries files..." + @make -f Makefile.os4 cleanall + + @echo "Creating the lha release file..." + @rm -f pcre2.lha + @lha -aeqr3 a pcre2.lha release/ + + @rm -rf release + +################################################################### + diff --git a/README-OS4.md b/README-OS4.md new file mode 100644 index 0000000..96101ad --- /dev/null +++ b/README-OS4.md @@ -0,0 +1,39 @@ +PCRE2 (Perl-compatible regular expression library) +--------------------------------------------------------------------------- + +This is a port of PCRE2 10.40 by Philip Hazel for AmigaOS 4, as found at the +GitHub repository https://github.com/PCRE2Project/pcre2 + +More information about PCRE can be found at its official website +at https://www.pcre.org and at the documentation that comes with this +package. + +In the archive both newlib and clib2 libraries are included. It has been +tested with various applications, but in case you find issues please +contact me. + +To install it into your AmigaOS 4 SDK installation, just extract all the +files in the SDK: path. + +Compile +-------------------------- +The source and the changes I did can be found at my personale repository +https://git.walkero.gr/walkero/pcre2 + +You can compile it using the Makefile.os4 file, and produce the libraries +yourself. + +* with newlib run: + ```bash + make -f Makefile.os4 all + ``` +* with clib2 run: + ```bash + make -f Makefile.os4 all USE_CLIB2=yes + ``` + +Changelog +-------------------------- +v10.40r1 - 2022-07-31 +* First release + diff --git a/src/pcre2test.c b/src/pcre2test.c index 7f44de7..50ed308 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -8967,7 +8967,7 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0) else if (strcmp(arg, "-S") == 0 && argc > 2 && ((uli = strtoul(argv[op+1], &endptr, 10)), *endptr == 0)) { -#if defined(_WIN32) || defined(WIN32) || defined(__HAIKU__) || defined(NATIVE_ZOS) || defined(__VMS) +#if defined(_WIN32) || defined(WIN32) || defined(__HAIKU__) || defined(NATIVE_ZOS) || defined(__VMS) || defined(__amigaos4__) fprintf(stderr, "pcre2test: -S is not supported on this OS\n"); exit(1); #else @@ -9499,3 +9499,4 @@ return yield; } /* End of pcre2test.c */ +