wireshark/tools/lemon
Adrian Ratiu 61e66c37ab cmake: lemon: allow overriding lemon CC setting
When cross-compiling wireshark the lemon tool should be built
using the host machine compiler to be run on the host. Before
cmake this was done via autotools CC_FOR_BUILD but cmake only
supports one compiler toolchain per build and requires some
workarounds like running cmake twice using separately defined
toolchains.

This gets ugly and complicated fast when considering multiple
toolchains, especially for a simple tool like lemon, so just
allow builds to override the C compiler and wipe the cflags.

This way systems like Gentoo/ChromeOS/Yocto with a properly
setup cross-compile environment can just point to the native
BUILD_CC or similar while minimizing complexity.
2021-08-31 19:19:05 +00:00
..
patches Lemon: import fresh lemon from upstream 2020-12-04 08:32:58 +00:00
CMakeLists.txt cmake: lemon: allow overriding lemon CC setting 2021-08-31 19:19:05 +00:00
README Lemon: import fresh lemon from upstream 2020-12-04 08:32:58 +00:00
apply-patches.sh lemon: sync with upstream (2018-09-08) 2018-10-21 07:00:05 +00:00
cppmagic.h
lemon.c Enable -Wredundant-decls. 2021-02-14 14:43:42 -08:00
lemonflex-head.inc
lemonflex-tail.inc
lempar.c Lemon: import fresh lemon from upstream 2020-12-04 08:32:58 +00:00

README

The Lemon Parser Generator's home page is:  https://www.hwaci.com/sw/lemon/
Lemon seems now to be maintained at:        https://sqlite.org/lemon.html

Documentation is available at:  https://sqlite.org/src/doc/trunk/doc/lemon.html
Git mirror of the upstream Fossil repository: https://github.com/mackyle/sqlite

The lempar.c and lemon.c are taken from sqlite and are modified as little as
possible to make it easier to synchronize changes. Last updated at:

    commit 273ee151217b04c640c1af148e36c518678c89fa
    Author: mistachkin <mistachkin@noemail.net>
    Date:   Mon Sep 21 20:18:44 2020 +0000

        Fix harmless compiler warning seen with MSVC.

To check for changes (adjust "previous commit" accordingly):

    git clone --depth=1000 https://github.com/sqlite/sqlite
    cd sqlite/tools
    git log -p 273ee15121.. lemon.c lempar.c

To create a Wireshark version (steps 1-3) and validate the result (steps 4-5):
1. Copy the two files.
2. Run ./apply-patches.sh to apply local patches.
3. Update the commit in this README (to ensure the base is known).
4. Check for CSA warnings:  clang-check -analyze lemon.c --
5. Build and run lemon:     ninja epan/dfilter/grammar.c

The patches to lemon to silence compiler warnings and static analysis reports
(for edge cases that cannot occur) are not proposed upstream because that
process is difficult. From <https://www.sqlite.org/copyright.html>:

    SQLite is open-source, meaning that you can make as many copies of it as you
    want and do whatever you want with those copies, without limitation. But
    SQLite is not open-contribution. In order to keep SQLite in the public
    domain and ensure that the code does not become contaminated with
    proprietary or licensed content, the project does not accept patches from
    unknown persons.

A note about the Lemon patches, we have no intention to fork Lemon and maintain
it. These patches are written to address static analyzer warnings without
actually modifying the functionality. If upstream is willing to accept patches,
then that would be great and the intention is to make it as easy as possible.
The lemon and lempar patches are dedicated to the public domain, as set forward
in Creative Commons Zero v1.0 Universal (IANAL, but I hope this is sufficient).