Skip to content

Commit

Permalink
Rewrite make-{dissectors,taps} in Python
Browse files Browse the repository at this point in the history
Having these build tools in machine code poses problems when cross-compiling.
The most significant being that we need to find the host and build GLiB
dependencies at compile-time.

There is no noticeable speed difference between the Python and C implementation.

Ping-Bug: 14622
Change-Id: Id13f823c7f4abf51edfa291e703028873748989f
Reviewed-on: https://code.wireshark.org/review/28130
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
(cherry picked from commit 722d6b06f606bc045ecef6fe5c8f2c700a3dad65)
 [Peter: adjusted autotools to use the new make-regs.py script]
Reviewed-on: https://code.wireshark.org/review/28204
  • Loading branch information
randstr authored and Lekensteyn committed Jun 11, 2018
1 parent 605c095 commit 63f90a3
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 433 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -48,8 +48,6 @@ plugins/codecs/*/plugin.c
plugins/epan/mate/mate_parser.c
version.h
tools/lemon/lemon
tools/make-dissectors
tools/make-taps
tshark-tap-register.c
wiretap/ascend.c
wiretap/ascend.h
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -1325,7 +1325,7 @@ add_subdirectory( doc )
add_subdirectory( docbook EXCLUDE_FROM_ALL )
add_subdirectory( epan )
add_subdirectory( randpkt_core )
add_subdirectory( tools )
add_subdirectory( tools/lemon )
add_subdirectory( ui )
add_subdirectory( wiretap )
add_subdirectory( writecap )
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/UseMakeTaps.cmake
Expand Up @@ -5,9 +5,9 @@ MACRO(REGISTER_TAP_FILES _outputfile)
OUTPUT
${_outputfile}
COMMAND
make-taps ${_outputfile} ${_sources}
${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py taps ${_outputfile} ${_sources}
DEPENDS
make-taps
${CMAKE_SOURCE_DIR}/tools/make-regs.py
${_sources}
COMMENT
"Making ${_outputfile}"
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/CMakeLists.txt
Expand Up @@ -1892,8 +1892,8 @@ file(GENERATE
)
add_custom_command(
OUTPUT dissectors.c
COMMAND make-dissectors dissectors.c @dissectors.in.txt
DEPENDS make-dissectors ${ALL_DISSECTOR_SRC}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py dissectors dissectors.c @dissectors.in.txt
DEPENDS ${CMAKE_SOURCE_DIR}/tools/make-regs.py ${ALL_DISSECTOR_SRC}
"${CMAKE_CURRENT_BINARY_DIR}/dissectors.in.txt"
COMMENT "Making dissectors.c"
)
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/Makefile.am
Expand Up @@ -1957,10 +1957,10 @@ x11-dissector: $(top_srcdir)/tools/process-x11-fields.pl $(srcdir)/x11-fields $(
# We pass the arguments to make-dissectors in a file to avoid limitations
# with the number of arguments handled by main().
#
dissectors.c: $(top_builddir)/tools/make-dissectors $(ALL_DISSECTORS_SRC)
dissectors.c: $(top_srcdir)/tools/make-regs.py $(ALL_DISSECTORS_SRC)
@echo Making dissectors.c
@echo $^ | tr ' ' '\n' | $(GREP) '\.c$$' > dissectors.in.txt && \
$(top_builddir)/tools/make-dissectors $@ @dissectors.in.txt
$(PYTHON) $(top_srcdir)/tools/make-regs.py dissectors $@ @dissectors.in.txt

MOSTLYCLEANFILES = \
dissectors.in.txt
Expand Down
32 changes: 0 additions & 32 deletions tools/CMakeLists.txt

This file was deleted.

16 changes: 0 additions & 16 deletions tools/Makefile.am
Expand Up @@ -23,22 +23,6 @@ include $(top_srcdir)/Makefile.am.inc

SUBDIRS = lemon

CC = $(CC_FOR_BUILD)
CPPFLAGS = $(CPPFLAGS_FOR_BUILD)
CFLAGS = $(CFLAGS_FOR_BUILD)
LDFLAGS = $(LDFLAGS_FOR_BUILD)
LIBS =

noinst_PROGRAMS = make-taps make-dissectors

make_dissectors_CFLAGS = $(GLIB_CFLAGS)

make_dissectors_LDADD = $(GLIB_LIBS)

make_taps_CFLAGS = $(GLIB_CFLAGS)

make_taps_LDADD = $(GLIB_LIBS)

EXTRA_DIST = \
asn2deb \
asn2wrs.py \
Expand Down
215 changes: 0 additions & 215 deletions tools/make-dissectors.c

This file was deleted.

0 comments on commit 63f90a3

Please sign in to comment.