2013-11-08 08:31:21 -05:00
|
|
|
#!/bin/bash
|
2025-03-22 06:00:44 -04:00
|
|
|
# Copyright (C) CZ.NIC, z.s.p.o. and contributors
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
# For more information, see <https://www.knot-dns.cz/>
|
2013-11-08 08:31:21 -05:00
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
### ZSCANNER ###
|
|
|
|
|
|
2014-04-24 06:08:15 -04:00
|
|
|
IN="./scanner.rl"
|
2015-01-15 12:50:51 -05:00
|
|
|
OUT_T0="./scanner.c.t0"
|
|
|
|
|
OUT_G2="./scanner.c.g2"
|
2014-04-24 06:08:15 -04:00
|
|
|
|
2025-04-09 04:14:17 -04:00
|
|
|
pushd $(dirname "$0")
|
|
|
|
|
|
2018-03-12 06:16:20 -04:00
|
|
|
pushd ../src/libzscanner/
|
2013-11-08 08:31:21 -05:00
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
# Generate slower/small zone parser.
|
|
|
|
|
ragel -T0 -s -o $OUT_T0 $IN
|
|
|
|
|
|
|
|
|
|
# Remove redundant comments and unused constants (clang warnings).
|
|
|
|
|
sed -i '/#line/d' $OUT_T0
|
2015-12-11 10:59:21 -05:00
|
|
|
sed -i '/static\ const\ int\ zone_scanner_/d' $OUT_T0
|
2015-01-15 12:50:51 -05:00
|
|
|
|
2015-02-19 10:03:21 -05:00
|
|
|
# Remove trailing white spaces.
|
|
|
|
|
sed -i 's/\s*$//g' $OUT_T0
|
|
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
# Generate fast/huge zone parser.
|
|
|
|
|
ragel -G2 -s -o $OUT_G2 $IN
|
|
|
|
|
|
|
|
|
|
# Remove redundant comments and unused constants (clang warnings).
|
|
|
|
|
sed -i '/#line/d' $OUT_G2
|
2015-12-11 10:59:21 -05:00
|
|
|
sed -i '/static\ const\ int\ zone_scanner_/d' $OUT_G2
|
2015-01-15 12:50:51 -05:00
|
|
|
|
2015-02-19 10:03:21 -05:00
|
|
|
# Remove trailing white spaces.
|
|
|
|
|
sed -i 's/\s*$//g' $OUT_G2
|
|
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
popd
|
|
|
|
|
|
|
|
|
|
### YPARSER ###
|
|
|
|
|
|
|
|
|
|
IN_Y="./ypbody.rl"
|
|
|
|
|
OUT_Y="./ypbody.c"
|
2013-11-08 08:31:21 -05:00
|
|
|
|
2015-02-19 05:14:20 -05:00
|
|
|
pushd ../src/libknot/yparser/
|
2014-05-05 09:02:10 -04:00
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
# Generate yparser.
|
|
|
|
|
ragel -T0 -s -o $OUT_Y $IN_Y
|
2013-11-08 08:31:21 -05:00
|
|
|
|
2015-01-15 12:50:51 -05:00
|
|
|
# Remove redundant comments and unused constants (clang warnings).
|
|
|
|
|
sed -i '/#line/d' $OUT_Y
|
|
|
|
|
sed -i '/static\ const\ int\ yparser_/d' $OUT_Y
|
2014-05-05 09:11:47 -04:00
|
|
|
|
2015-02-19 10:03:21 -05:00
|
|
|
# Remove trailing white spaces.
|
|
|
|
|
sed -i 's/\s*$//g' $OUT_Y
|
|
|
|
|
|
2013-11-08 08:31:21 -05:00
|
|
|
popd
|
2025-04-09 04:14:17 -04:00
|
|
|
|
|
|
|
|
popd
|