About
PCRE is a regular expressions library that implements regular expressions using the same syntax as Perl 5.Installation and Quickstart
1. Download package
Web: http://www.pcre.org/Filename: pcre-8.32.tar.bz2
2. Build PCRE
cd /prj/pcre-8.32sh
export CFLAGS='-fdata-sections -ffunction-sections -O3'
sh configure --enable-pcre16 --enable-pcre32 --enable-jit --enable-utf --enable-unicode-properties
# See README for a complete description of the configure options
make
3. Install pcre static libs
cd /prj/pcre-8.32/.libsmkdir "%USERPROFILE%/lib/pcre/"
cp -v *.a "%USERPROFILE%/lib/pcre/"
4. Install pcre dynamic libs and utilities
cd /prj/pcre-8.32/ .libsmkdir "%USERPROFILE%/bin/pcre/"
cp -v *.dll "%USERPROFILE%/bin/pcre/"
cp -v ../pcre-config pcregrep.exe pcretest.exe "%USERPROFILE%/bin/pcre/"
# Create a file "%USERPROFILE%/bin/pcre/pcre-config.bat" with these contents:
@echo off
sh -c 'pcre-config %*'
5. Install pcre headers
cd /prj/pcre-8.32mkdir "%USERPROFILE%/include/pcre/"
cp -v pcre*.h "%USERPROFILE%/include/pcre/"
6. Install man pages
mkdir "C:\cygwin\home\%USERNAME%\man\pcre\"mkdir "C:\cygwin\home\%USERNAME%\man\pcre\man1\"
mkdir "C:\cygwin\home\%USERNAME%\man\pcre\man3\"
cd /prj/pcre-8.32/doc
cp -v *.1 "C:\cygwin\home\%USERNAME%\man\pcre\man1\"
cp -v *.3 "C:\cygwin\home\%USERNAME%\man\pcre\man3\"
7. Adjust environment to include above direcotires
Add static lib directory to LIBRARY_PATHAdd dynamic lib directory to PATH
Remove "C:\Octave\Octave3.6.2_gcc4.6.2\bin" from the PATH if it is present
Add header directory to CPATH
Add /home/USERNAME/man/pcre to MANPATH
8. Compile the test program
cd "C:\%USERPROFILE%\Desktop"cp -v /prj/pcre-8.32/pcredemo.c "C:/%USERPROFILE%/Desktop"
gcc -Wall -DPCRE_STATIC -o pcredemo pcredemo.c -lpcre -static -s
# pcredemo.exe 524288 bytes
9. Try to compile the test program with the "gc-sections" linker option
env-ldneogcc %CFLAGS% -DPCRE_STATIC -o pcredemo pcredemo.c -lpcre -static -Wl,--gc-sections -s
# pcredemo.exe: 510976 bytes
Keine Kommentare:
Kommentar veröffentlichen