ngrep-1.45-build-fixes.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. This patch fixes a number of problems with have with build:
  2. * more clean cut off pcre library; we'll never use bundled pcre library, so
  3. some autoconf added REGEX_LIBS to pass correct system libs and header change.
  4. * We use AC_CONFIG_SUBDIRS to pass make autoconf reconfigure gnuregex library
  5. - this way ./configure will be called correctly and correct comipler will be
  6. selected automatically.
  7. * With the previous change some modifications were required to make gnuregex
  8. buildable: a) we should not overide CFLAGS in Makefile.in (as they together
  9. with -DHAVE_CONFIG_H will be passed to gnuregex and it'll fail to build,
  10. since no config.h exist) b) obvious way to remove warning "_GNU_SOURCE"
  11. redefined
  12. * also we don't pass $(MAKEFLAGS) since it caused us problems in the past (bug
  13. #178684)
  14. === modified file 'Makefile.in'
  15. --- Makefile.in 2008-11-17 09:02:30 +0000
  16. +++ Makefile.in 2008-11-17 10:42:09 +0000
  17. @@ -7,7 +7,8 @@
  18. CC=@CC@
  19. -CFLAGS=@CFLAGS@ -D@OS@ @DEFS@ @EXTRA_DEFINES@
  20. +# Never redefine CFLAGS, as it pollutes env and gnuregex build failes
  21. +EXTRA_CFLAGS=@CFLAGS@ -D@OS@ @DEFS@ @EXTRA_DEFINES@
  22. INCLUDES=-I@srcdir@ @PCAP_INCLUDE@ @EXTRA_INCLUDES@
  23. LDFLAGS=@LDFLAGS@ @PCAP_LINK@
  24. @@ -34,25 +35,25 @@
  25. REGEX_DIR=@REGEX_DIR@
  26. REGEX_OBJS=@REGEX_OBJS@
  27. -
  28. +REGEX_LIBS=@REGEX_LIBS@
  29. all: $(TARGET)
  30. $(TARGET): $(REGEX_OBJS) $(OBJS)
  31. - $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS)
  32. + $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(REGEX_LIBS) $(LIBS)
  33. debug: $(REGEX_OBJS) $(OBJS)
  34. - $(CC) $(CFLAGS) $(LDFLAGS) -g -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS)
  35. + $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -g -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(REGEX_LIBS) $(LIBS)
  36. static: $(REGEX_OBJS) $(OBJS)
  37. - $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET).static -static $(OBJS) $(REGEX_OBJS) $(LIBS)
  38. + $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $(TARGET).static -static $(OBJS) $(REGEX_OBJS) $(REGEX_LIBS) $(LIBS)
  39. install: $(TARGET)
  40. $(INSTALL) -c -m 0755 $(TARGET) $(DESTDIR)/$(BINDIR_INSTALL)/$(TARGET)
  41. $(INSTALL) -c -m 0644 $(MANPAGE) $(DESTDIR)/$(MANDIR_INSTALL)/$(MANPAGE)
  42. .c.o:
  43. - $(CC) $(CFLAGS) $(INCLUDES) -g -c $<
  44. + $(CC) $(EXTRA_CFLAGS) $(INCLUDES) -g -c $<
  45. clean:
  46. make -C $(REGEX_DIR) clean
  47. @@ -63,7 +64,7 @@
  48. rm -f config.status config.cache config.log config.h Makefile
  49. $(REGEX_OBJS): $(REGEX_OBJS:.o=.c) $(REGEX_DIR)/*.h
  50. - $(MAKE) $(MAKEFLAGS) -C $(REGEX_DIR) $(notdir $(REGEX_OBJS))
  51. + $(MAKE) -C $(REGEX_DIR) $(notdir $(REGEX_OBJS))
  52. $(OBJS): Makefile ngrep.c ngrep.h
  53. === modified file 'configure.in'
  54. --- configure.in 2008-11-17 09:02:30 +0000
  55. +++ configure.in 2008-11-17 10:11:29 +0000
  56. @@ -124,14 +124,16 @@
  57. use_pcre="no"
  58. ])
  59. +REGEX_DIR=""
  60. +REGEX_OBJS=""
  61. +REGEX_LIBS=""
  62. if test $use_pcre = yes; then
  63. echo
  64. - echo 'Configuring Perl-Compatible Regular Expression (PCRE) library ...'
  65. + echo 'Using System Perl-Compatible Regular Expression (PCRE) library ...'
  66. echo
  67. - REGEX_DIR='pcre-5.0'
  68. - REGEX_OBJS="$REGEX_DIR/pcre.o $REGEX_DIR/study.o"
  69. + REGEX_LIBS="`pcre-config --libs`"
  70. USE_PCRE="1"
  71. else
  72. @@ -144,12 +146,19 @@
  73. REGEX_OBJS="$REGEX_DIR/regex.o"
  74. USE_PCRE="0"
  75. + AC_CONFIG_SUBDIRS([regex-0.12])
  76. +
  77. + echo
  78. + echo 'GNU Regular Expression library is configured...'
  79. + echo
  80. +
  81. fi
  82. -( cd $REGEX_DIR && ./configure )
  83. AC_SUBST(REGEX_DIR)
  84. AC_SUBST(REGEX_OBJS)
  85. +AC_SUBST(REGEX_LIBS)
  86. +
  87. echo
  88. === modified file 'ngrep.c'
  89. --- ngrep.c 2008-11-17 09:02:30 +0000
  90. +++ ngrep.c 2008-11-17 09:55:32 +0000
  91. @@ -92,7 +92,7 @@
  92. #endif
  93. #if USE_PCRE
  94. -#include "pcre-5.0/pcre.h"
  95. +#include <pcre.h>
  96. #else
  97. #include "regex-0.12/regex.h"
  98. #endif
  99. === modified file 'regex-0.12/Makefile.in'
  100. --- regex-0.12/Makefile.in 2008-11-17 09:02:30 +0000
  101. +++ regex-0.12/Makefile.in 2008-11-17 10:20:52 +0000
  102. @@ -18,23 +18,6 @@
  103. version = 0.12
  104. -# You can define CPPFLAGS on the command line. Aside from system-specific
  105. -# flags, you can define:
  106. -# -DREGEX_MALLOC to use malloc/realloc/free instead of alloca.
  107. -# -DDEBUG to enable the compiled pattern disassembler and execution
  108. -# tracing; code runs substantially slower.
  109. -# -DEXTRACT_MACROS to use the macros EXTRACT_* (as opposed to
  110. -# the corresponding C procedures). If not -DDEBUG, the macros
  111. -# are used.
  112. -CPPFLAGS =
  113. -
  114. -# Likewise, you can override CFLAGS to optimize, use -Wall, etc.
  115. -CFLAGS = -g
  116. -
  117. -# Ditto for LDFLAGS and LOADLIBES.
  118. -LDFLAGS =
  119. -LOADLIBES =
  120. -
  121. srcdir = @srcdir@
  122. VPATH = @srcdir@
  123. @@ -43,7 +26,7 @@
  124. SHELL = /bin/sh
  125. -subdirs = doc test
  126. +subdirs =
  127. default all:: regex.o
  128. .PHONY: default all
  129. === modified file 'regex-0.12/configure.in'
  130. --- regex-0.12/configure.in 2008-11-17 09:02:30 +0000
  131. +++ regex-0.12/configure.in 2008-11-17 10:19:18 +0000
  132. @@ -34,4 +34,4 @@
  133. esac
  134. -AC_OUTPUT(Makefile doc/Makefile test/Makefile)
  135. +AC_OUTPUT(Makefile)
  136. === modified file 'regex-0.12/regex.c'
  137. --- regex-0.12/regex.c 2008-11-17 09:02:30 +0000
  138. +++ regex-0.12/regex.c 2008-11-17 10:15:58 +0000
  139. @@ -34,7 +34,9 @@
  140. #pragma alloca
  141. #endif
  142. +#ifndef _GNU_SOURCE
  143. #define _GNU_SOURCE
  144. +#endif
  145. /* We need this for `regex.h', and perhaps for the Emacs include files. */
  146. #include <sys/types.h>