BUILD
--------------------------------------------------------------------------------
-Simplest possible build:
+Contents:
+ 1. simple build
+ 2. bootstrap
+ 3. out-of-source build
+ 4. testing
+ 5. rebuild documentation
+ 6. build for windows with mingw
+ 7. build from git
+
+1. Simplest possible build:
$ ./configure [--prefix=<prefix>]
$ make
$ make install
This will build re2c and install it (binary and man page) to <prefix> (defaults
to /usr/local).
-Bootstrap and rebuild:
+2. Bootstrap and rebuild:
$ ./configure [--prefix=<prefix>]
$ make bootstrap
$ make install
3. build lexer from source using re2c binary in build directory
4. rebuild re2c
-Out-of-source build:
+3. Out-of-source build:
$ mkdir <build-directory>
$ cd <build-directory>
$ <path-to-configure>/configure [--prefix=<prefix>]
$ make
$ make install
-Testing:
+4. Testing:
$ make check
This will redirect test script output to file. If you want to see progress:
$ make tests
Testing under valgrind (takes a long time):
$ make vtests
-Rebuild documentation (requires asciidoc and a2x):
+5. Rebuild documentation (requires asciidoc and a2x):
$ ./configure --enable-docs [--prefix=<prefix>]
$ make docs
$ make install
-If you want to build from git, you'll first need to generate autotools files:
+6. Build for windows using mingw:
+ $ ../configure --host i686-w64-mingw32 [--prefix=<prefix>]
+ $ make
+This will result into an executable re2c.exe, which can be tested with wine:
+ $ make wtests
+
+7. If you want to build from git, you'll first need to generate autotools files:
$ ./autogen.sh
--------------------------------------------------------------------------------
# nothing helped
CPUS="1"
fi
- echo "using ${CPUS} CPUs" >&2
}
valgrind=""
+wine=""
+re2c="@builddir@/re2c"
threads=`detect_cpu_count; echo $CPUS`
tests=()
for arg in $*
do
case $arg in
"--valgrind" ) valgrind=`which valgrind` ;;
+ "--wine" )
+ wine=`which wine`
+ re2c="${re2c}.exe"
+ ;;
"-j"* )
number=${arg#-j}
number_pattern='^[0-9]+$'
* ) tests+=("$arg") ;;
esac
done
+echo "Running in ${threads} thread(s)"
testdir="@srcdir@/test"
if [ ${#tests[@]} -eq 0 ]
packs[$i]=${tests[@]:j:tests_per_thread}
done
-re2c='@builddir@/re2c'
if test ! -x "${re2c}"
then
echo "Cannot find re2c executable (${re2c})."
"--malloc-fill=0xa1"
"--free-fill=0xa1"
)
- valgrind="${valgrind} ${valgrind_options[@]} "
+ valgrind="${valgrind} ${valgrind_options[@]}"
echo $valgrind
fi
-re2c="${valgrind}${re2c}"
run_pack() {
local log="$1"
local typname=$testdir/`basename ${x%.re}.h.temp`
local typdiff=$testdir/`basename ${x%.re}.h.diff`
- $re2c $switches $x 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $outname
+ local cmd="${valgrind} ${wine} ${re2c} $switches $x"
+ if test -n "${wine}"
+ then
+ local filter_newlines='-e s/\r//g'
+ fi
+ $cmd 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' ${filter_newlines} > $outname
if test -n "$genname"
then
cat $genname | sed -e 's,'"$testdir"'/,,g' -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' > $outname