patch-Makefile 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. --- tcp_wrappers_7.6.orig/Makefile 1997-03-21 19:27:21.000000000 +0100
  2. +++ tcp_wrappers_7.6/Makefile 2009-06-05 18:46:05.000000000 +0200
  3. @@ -1,5 +1,8 @@
  4. # @(#) Makefile 1.23 97/03/21 19:27:20
  5. +# unset the HOSTNAME environment variable
  6. +HOSTNAME =
  7. +
  8. what:
  9. @echo
  10. @echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
  11. @@ -19,7 +22,7 @@ what:
  12. @echo " generic (most bsd-ish systems with sys5 compatibility)"
  13. @echo " 386bsd aix alpha apollo bsdos convex-ultranet dell-gcc dgux dgux543"
  14. @echo " dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
  15. - @echo " linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
  16. + @echo " linux gnu machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
  17. @echo " ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
  18. @echo " sunos40 sunos5 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
  19. @echo " uts215 uxp"
  20. @@ -43,8 +46,8 @@ what:
  21. # Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
  22. #REAL_DAEMON_DIR=/usr/etc
  23. #
  24. -# SysV.4 Solaris 2.x OSF AIX
  25. -#REAL_DAEMON_DIR=/usr/sbin
  26. +# SysV.4 Solaris 2.x OSF AIX Linux
  27. +REAL_DAEMON_DIR=/usr/sbin
  28. #
  29. # BSD 4.4
  30. #REAL_DAEMON_DIR=/usr/libexec
  31. @@ -143,8 +146,15 @@ freebsd:
  32. linux:
  33. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  34. - LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
  35. - NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
  36. + LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
  37. + NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
  38. + EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_WEAKSYMS -D_REENTRANT"
  39. +
  40. +gnu:
  41. + @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  42. + LIBS=$(MYLIB) RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
  43. + NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= all \
  44. + EXTRA_CFLAGS="-DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT"
  45. # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
  46. hpux hpux8 hpux9 hpux10:
  47. @@ -391,7 +401,7 @@ AR = ar
  48. # the ones provided with this source distribution. The environ.c module
  49. # implements setenv(), getenv(), and putenv().
  50. -AUX_OBJ= setenv.o
  51. +#AUX_OBJ= setenv.o
  52. #AUX_OBJ= environ.o
  53. #AUX_OBJ= environ.o strcasecmp.o
  54. @@ -454,7 +464,8 @@ AUX_OBJ= setenv.o
  55. # host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
  56. # around this. The workaround does no harm on other Solaris versions.
  57. -BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
  58. +BUGS =
  59. +#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
  60. #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
  61. #BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
  62. @@ -464,7 +475,7 @@ BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS
  63. # If your system supports NIS or YP-style netgroups, enable the following
  64. # macro definition. Netgroups are used only for host access control.
  65. #
  66. -#NETGROUP= -DNETGROUP
  67. +NETGROUP= -DNETGROUP
  68. ###############################################################
  69. # System dependencies: whether or not your system has vsyslog()
  70. @@ -491,7 +502,7 @@ VSYSLOG = -Dvsyslog=myvsyslog
  71. # Uncomment the next definition to turn on the language extensions
  72. # (examples: allow, deny, banners, twist and spawn).
  73. #
  74. -#STYLE = -DPROCESS_OPTIONS # Enable language extensions.
  75. +STYLE = -DPROCESS_OPTIONS # Enable language extensions.
  76. ################################################################
  77. # Optional: Changing the default disposition of logfile records
  78. @@ -514,7 +525,7 @@ VSYSLOG = -Dvsyslog=myvsyslog
  79. #
  80. # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
  81. -FACILITY= LOG_MAIL # LOG_MAIL is what most sendmail daemons use
  82. +FACILITY= LOG_DAEMON # LOG_MAIL is what most sendmail daemons use
  83. # The syslog priority at which successful connections are logged.
  84. @@ -610,7 +621,7 @@ TABLES = -DHOSTS_DENY=\"/etc/hosts.deny\
  85. # Paranoid mode implies hostname lookup. In order to disable hostname
  86. # lookups altogether, see the next section.
  87. -PARANOID= -DPARANOID
  88. +#PARANOID= -DPARANOID
  89. ########################################
  90. # Optional: turning off hostname lookups
  91. @@ -623,7 +634,7 @@ PARANOID= -DPARANOID
  92. # In order to perform selective hostname lookups, disable paranoid
  93. # mode (see previous section) and comment out the following definition.
  94. -HOSTNAME= -DALWAYS_HOSTNAME
  95. +#HOSTNAME= -DALWAYS_HOSTNAME
  96. #############################################
  97. # Optional: Turning on host ADDRESS checking
  98. @@ -649,28 +660,47 @@ HOSTNAME= -DALWAYS_HOSTNAME
  99. # source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
  100. # Solaris 2.x, and Linux. See your system documentation for details.
  101. #
  102. -# KILL_OPT= -DKILL_IP_OPTIONS
  103. +KILL_OPT= -DKILL_IP_OPTIONS
  104. ## End configuration options
  105. ############################
  106. # Protection against weird shells or weird make programs.
  107. +CC = gcc
  108. SHELL = /bin/sh
  109. -.c.o:; $(CC) $(CFLAGS) -c $*.c
  110. +.c.o:; $(CC) $(CFLAGS) -o $*.o -c $*.c
  111. -CFLAGS = -O -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
  112. +SOMAJOR = 0
  113. +SOMINOR = 7.6
  114. +
  115. +LIB = libwrap.a
  116. +SHLIB = shared/libwrap.so.$(SOMAJOR).$(SOMINOR)
  117. +SHLIBSOMAJ= shared/libwrap.so.$(SOMAJOR)
  118. +SHLIBSO = shared/libwrap.so
  119. +SHLIBFLAGS = -Lshared -lwrap
  120. +
  121. +shared/%.o: %.c
  122. + $(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
  123. +
  124. +OPT_CFLAGS = -O2 -g
  125. +CFLAGS = $(OPT_CFLAGS) -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
  126. $(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
  127. -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
  128. -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
  129. $(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT) \
  130. $(VSYSLOG) $(HOSTNAME)
  131. +SHLINKFLAGS = -shared -Xlinker -soname -Xlinker libwrap.so.$(SOMAJOR) -lc $(LIBS)
  132. +SHCFLAGS = -fPIC -shared -D_REENTRANT
  133. +
  134. LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
  135. hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
  136. $(FROM_OBJ) fix_options.o socket.o tli.o workarounds.o \
  137. update.o misc.o diag.o percent_m.o myvsyslog.o
  138. +SHLIB_OBJ= $(addprefix shared/, $(LIB_OBJ));
  139. +
  140. FROM_OBJ= fromhost.o
  141. KIT = README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
  142. @@ -684,46 +714,78 @@ KIT = README miscd.c tcpd.c fromhost.c h
  143. refuse.c tcpdchk.8 setenv.c inetcf.c inetcf.h scaffold.c \
  144. scaffold.h tcpdmatch.8 README.NIS
  145. -LIB = libwrap.a
  146. -
  147. -all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
  148. +all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(LIB)
  149. # Invalidate all object files when the compiler options (CFLAGS) have changed.
  150. config-check:
  151. @set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
  152. - @set +e; echo $(CFLAGS) >/tmp/cflags.$$$$ ; \
  153. - if cmp cflags /tmp/cflags.$$$$ ; \
  154. - then rm /tmp/cflags.$$$$ ; \
  155. - else mv /tmp/cflags.$$$$ cflags ; \
  156. + @set +e; echo $(CFLAGS) >cflags.new ; \
  157. + if cmp cflags cflags.new ; \
  158. + then rm cflags.new ; \
  159. + else mv cflags.new cflags ; \
  160. fi >/dev/null 2>/dev/null
  161. + @if [ ! -d shared ]; then mkdir shared; fi
  162. $(LIB): $(LIB_OBJ)
  163. rm -f $(LIB)
  164. $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
  165. -$(RANLIB) $(LIB)
  166. -tcpd: tcpd.o $(LIB)
  167. - $(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
  168. +$(SHLIB): $(SHLIB_OBJ)
  169. + rm -f $(SHLIB)
  170. + $(CC) -o $(SHLIB) $(SHLINKFLAGS) $(SHLIB_OBJ)
  171. + ln -s $(notdir $(SHLIB)) $(SHLIBSOMAJ)
  172. + ln -s $(notdir $(SHLIBSOMAJ)) $(SHLIBSO)
  173. -miscd: miscd.o $(LIB)
  174. - $(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
  175. +tcpd: tcpd.o $(SHLIB)
  176. + $(CC) $(CFLAGS) -o $@ tcpd.o $(SHLIBFLAGS)
  177. -safe_finger: safe_finger.o $(LIB)
  178. - $(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
  179. +miscd: miscd.o $(SHLIB)
  180. + $(CC) $(CFLAGS) -o $@ miscd.o $(SHLIBFLAGS)
  181. +
  182. +safe_finger: safe_finger.o $(SHLIB)
  183. + $(CC) $(CFLAGS) -o $@ safe_finger.o $(SHLIBFLAGS)
  184. TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
  185. -tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
  186. - $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
  187. +tcpdmatch: $(TCPDMATCH_OBJ) $(SHLIB)
  188. + $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(SHLIBFLAGS)
  189. -try-from: try-from.o fakelog.o $(LIB)
  190. - $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
  191. +try-from: try-from.o fakelog.o $(SHLIB)
  192. + $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(SHLIBFLAGS)
  193. TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
  194. -tcpdchk: $(TCPDCHK_OBJ) $(LIB)
  195. - $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
  196. +tcpdchk: $(TCPDCHK_OBJ) $(SHLIB)
  197. + $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(SHLIBFLAGS)
  198. +
  199. +install: install-lib install-bin install-dev
  200. +
  201. +install-lib:
  202. + install -o root -g root -m 0644 $(SHLIB) ${DESTDIR}/lib/
  203. + ln -s $(notdir $(SHLIB)) ${DESTDIR}/lib/$(notdir $(SHLIBSOMAJ))
  204. +
  205. +install-bin:
  206. + install -o root -g root -m 0755 tcpd ${DESTDIR}/usr/sbin/
  207. + install -o root -g root -m 0755 tcpdchk ${DESTDIR}/usr/sbin/
  208. + install -o root -g root -m 0755 tcpdmatch ${DESTDIR}/usr/sbin/
  209. + install -o root -g root -m 0755 try-from ${DESTDIR}/usr/sbin/
  210. + install -o root -g root -m 0755 safe_finger ${DESTDIR}/usr/sbin/
  211. + install -o root -g root -m 0644 tcpd.8 ${DESTDIR}/usr/share/man/man8/
  212. + install -o root -g root -m 0644 tcpdchk.8 ${DESTDIR}/usr/share/man/man8/
  213. + install -o root -g root -m 0644 tcpdmatch.8 ${DESTDIR}/usr/share/man/man8/
  214. + install -o root -g root -m 0644 hosts_access.5 ${DESTDIR}/usr/share/man/man5/
  215. + install -o root -g root -m 0644 hosts_options.5 ${DESTDIR}/usr/share/man/man5/
  216. +
  217. +install-dev:
  218. + ln -s /lib/$(notdir $(SHLIBSOMAJ)) ${DESTDIR}/usr/lib/$(notdir $(SHLIBSO))
  219. + install -o root -g root -m 0644 hosts_access.3 ${DESTDIR}/usr/share/man/man3/
  220. + install -o root -g root -m 0644 tcpd.h ${DESTDIR}/usr/include/
  221. + install -o root -g root -m 0644 $(LIB) ${DESTDIR}/usr/lib/
  222. + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/hosts_ctl.3
  223. + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_init.3
  224. + ln -s hosts_access.3 ${DESTDIR}/usr/share/man/man3/request_set.3
  225. shar: $(KIT)
  226. @shar $(KIT)
  227. @@ -739,7 +801,8 @@ archive:
  228. clean:
  229. rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
  230. - cflags
  231. + cflags libwrap*.so*
  232. + rm -rf shared
  233. tidy: clean
  234. chmod -R a+r .
  235. @@ -885,5 +948,6 @@ update.o: cflags
  236. update.o: mystdarg.h
  237. update.o: tcpd.h
  238. vfprintf.o: cflags
  239. +weak_symbols.o: tcpd.h
  240. workarounds.o: cflags
  241. workarounds.o: tcpd.h