pcre
This package provides a CGo-free port of the PCRE2 regular expression library. The lib directory contains source code automatically translated from PCRE2's C source. This package wraps that code and provides an interface as close as possible to Go's stdlib regexp package
Supported GOOS/GOARCH:
- linux/amd64
- linux/386
- linux/arm64
- linux/arm
- linux/riscv64
- darwin/amd64
- darwin/arm64
More OS support is planned.
How to transpile pcre2
In order to transpile pcre2, a Go and C compiler (preferably GCC) will be needed.
- 
First, install ccgo 
- 
Then, download the pcre source code. It can be found here: https://github.com/PCRE2Project/pcre2. 
- 
Once downloaded, cdinto the source directory
- 
Run ./configure. If cross-compiling, provide the path to the cross-compiler in theCCvariable, and set--targetto the target architecture.
- 
When it completes, there should be a Makefilein the directory.
- 
Run ccgo -compiledb pcre.json make. Do not add-jarguments to the make command.
- 
Run the following command (replace items in triangle brackets): 
CC=/usr/bin/gcc ccgo -o pcre2_<os>_<arch>.go -pkgname lib -trace-translation-units -export-externs X -export-defines D -export-fields F -export-structs S -export-typedefs T pcre.json .libs/libpcre2-8.a
- 
If cross-compiling, set the CCGO_CCvariable to to path of the cross-compiler, and theCCGO_ARvariable to the path of the cross-compiler'sarbinary. Also, setTARGET_GOARCHto the GOARCH you're targeting andTARGET_GOOSto the OS you're targeting.
- 
Once the command completes, two go files will be created. One will start with pcre2, the other withcapi. Copy both of these to thelibdirectory in this repo.