Samstag, 5. Januar 2013

T-Rex (tinyrex)

About

T-Rex is a tiny regular expression library.

T-Rex  Installation and Quickstart

1. Download package

Web: http://tiny-rex.sourceforge.net/
File: trex_1_3.tar.gz

2. Build

# gcc -ffunction-sections -fdata-sections -Os -Wall -c trex.c
gcc -Os -Wall -c trex.c
# Note: building without the -f options produces an overall smaller executable in step 8
ar r libtrex.a trex.o

3. Install library file

mkdir "%USERPROFILE%/lib/trex/"
cp -v libtrex.a "%USERPROFILE%/lib/trex/"

4. Install header files

mkdir "%USERPROFILE%/include/trex/"
cp -v *.h "%USERPROFILE%/include/trex/"

5. Install documentation

mkdir "%USERPROFILE%/doc/trex/"
cp -v readme.txt "%USERPROFILE%/doc/trex/"

6. Update environment

Add library path to LIBRARY_PATH
Add include path to CPATH

7. Compile test program

cp -v test.c "%USERPROFILE%/Desktop/testrex.c"
cd "%USERPROFILE\Desktop\"
gcc -Wall -o testrex testrex.c -ltrex -s
# testrex.exe 15360 Bytes

8. Compile test program with gc-sections

env-ldneo
gcc %CFLAGS% -o testrex testrex.c -ltrex -Wl,--gc-sections -s
# testrex.exe 13824 Bytes

References

http://tiny-rex.sourceforge.net/

Keine Kommentare:

Kommentar veröffentlichen