100-shared-lib.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Index: libpcap-0.9.4/Makefile.in
  2. ===================================================================
  3. --- libpcap-0.9.4.orig/Makefile.in 2007-06-04 13:22:03.547316008 +0200
  4. +++ libpcap-0.9.4/Makefile.in 2007-06-04 13:22:03.614305824 +0200
  5. @@ -37,6 +37,15 @@
  6. srcdir = @srcdir@
  7. VPATH = @srcdir@
  8. +# some defines for shared library compilation
  9. +MAJ=0.9
  10. +MIN=4
  11. +VERSION=$(MAJ).$(MIN)
  12. +LIBNAME=pcap
  13. +LIBRARY=lib$(LIBNAME).a
  14. +SOLIBRARY=lib$(LIBNAME).so
  15. +SHAREDLIB=$(SOLIBRARY).$(VERSION)
  16. +
  17. #
  18. # You shouldn't need to edit anything below.
  19. #
  20. @@ -50,6 +59,7 @@
  21. # Standard CFLAGS
  22. CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
  23. +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
  24. INSTALL = @INSTALL@
  25. INSTALL_PROGRAM = @INSTALL_PROGRAM@
  26. @@ -70,7 +80,12 @@
  27. .c.o:
  28. @rm -f $@
  29. $(CC) $(CFLAGS) -c $(srcdir)/$*.c
  30. + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
  31. +%_pic.o: %.c
  32. + @rm -f $@
  33. + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
  34. +
  35. PSRC = pcap-@[email protected]
  36. FSRC = fad-@[email protected]
  37. SSRC = @SSRC@
  38. @@ -84,6 +99,7 @@
  39. # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
  40. # hack the extra indirection
  41. OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
  42. +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
  43. HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
  44. ethertype.h gencode.h gnuc.h
  45. GENHDR = \
  46. @@ -95,15 +111,23 @@
  47. TAGFILES = \
  48. $(SRC) $(HDR) $(TAGHDR)
  49. -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
  50. +CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so*
  51. -all: libpcap.a
  52. +all: libpcap.a $(SHAREDLIB)
  53. libpcap.a: $(OBJ)
  54. @rm -f $@
  55. ar rc $@ $(OBJ) $(LIBS)
  56. $(RANLIB) $@
  57. +$(SHAREDLIB): $(OBJ_PIC)
  58. + -@rm -f $@
  59. + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
  60. + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
  61. + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
  62. + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
  63. +
  64. +
  65. shared: libpcap.$(DYEXT)
  66. #
  67. @@ -129,6 +153,10 @@
  68. scanner.o: scanner.c tokdefs.h
  69. $(CC) $(CFLAGS) -c scanner.c
  70. +scanner_pic.o: scanner.c tokdefs.h
  71. + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
  72. +
  73. +
  74. pcap.o: version.h
  75. tokdefs.h: grammar.c
  76. @@ -142,9 +170,16 @@
  77. @rm -f $@
  78. $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
  79. +grammar_pic.o: grammar.c
  80. + @rm -f $@
  81. + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
  82. +
  83. version.o: version.c
  84. $(CC) $(CFLAGS) -c version.c
  85. +version_pic.o: version.c
  86. + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
  87. +
  88. snprintf.o: $(srcdir)/missing/snprintf.c
  89. $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
  90. @@ -170,10 +205,17 @@
  91. bpf_filter.o: bpf_filter.c
  92. $(CC) $(CFLAGS) -c bpf_filter.c
  93. +bpf_filter_pic.o: bpf_filter.c
  94. + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
  95. +
  96. +
  97. install: libpcap.a
  98. [ -d $(DESTDIR)$(libdir) ] || \
  99. (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
  100. $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
  101. + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
  102. + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
  103. + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
  104. $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
  105. [ -d $(DESTDIR)$(includedir) ] || \
  106. (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))