install 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. # Copyright (C) Igor Sysoev
  2. # Copyright (C) Nginx, Inc.
  3. if [ $USE_PERL != NO ]; then
  4. cat << END >> $NGX_MAKEFILE
  5. install_perl_modules:
  6. cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) install
  7. END
  8. NGX_INSTALL_PERL_MODULES=install_perl_modules
  9. fi
  10. case ".$NGX_SBIN_PATH" in
  11. ./*)
  12. ;;
  13. *)
  14. NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH
  15. ;;
  16. esac
  17. case ".$NGX_MODULES_PATH" in
  18. ./*)
  19. ;;
  20. *)
  21. NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH
  22. ;;
  23. esac
  24. NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.`
  25. case ".$NGX_CONF_PATH" in
  26. ./*)
  27. ;;
  28. *)
  29. NGX_CONF_PATH=$NGX_PREFIX/$NGX_CONF_PATH
  30. ;;
  31. esac
  32. NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
  33. case ".$NGX_PID_PATH" in
  34. ./*)
  35. ;;
  36. *)
  37. NGX_PID_PATH=$NGX_PREFIX/$NGX_PID_PATH
  38. ;;
  39. esac
  40. case ".$NGX_ERROR_LOG_PATH" in
  41. ./* | .)
  42. ;;
  43. *)
  44. NGX_ERROR_LOG_PATH=$NGX_PREFIX/$NGX_ERROR_LOG_PATH
  45. ;;
  46. esac
  47. case ".$NGX_HTTP_LOG_PATH" in
  48. ./*)
  49. ;;
  50. *)
  51. NGX_HTTP_LOG_PATH=$NGX_PREFIX/$NGX_HTTP_LOG_PATH
  52. ;;
  53. esac
  54. if test -f man/nginx.8 ; then
  55. NGX_MAN=man/nginx.8
  56. else
  57. NGX_MAN=docs/man/nginx.8
  58. fi
  59. if test -d html ; then
  60. NGX_HTML=html
  61. else
  62. NGX_HTML=docs/html
  63. fi
  64. cat << END >> $NGX_MAKEFILE
  65. manpage: $NGX_OBJS/nginx.8
  66. $NGX_OBJS/nginx.8: $NGX_MAN $NGX_AUTO_CONFIG_H
  67. sed -e "s|%%PREFIX%%|$NGX_PREFIX|" \\
  68. -e "s|%%PID_PATH%%|$NGX_PID_PATH|" \\
  69. -e "s|%%CONF_PATH%%|$NGX_CONF_PATH|" \\
  70. -e "s|%%ERROR_LOG_PATH%%|${NGX_ERROR_LOG_PATH:-stderr}|" \\
  71. < $NGX_MAN > \$@
  72. install: build $NGX_INSTALL_PERL_MODULES
  73. test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX'
  74. test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \\
  75. || mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`'
  76. test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \\
  77. || mv '\$(DESTDIR)$NGX_SBIN_PATH' \\
  78. '\$(DESTDIR)$NGX_SBIN_PATH.old'
  79. cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH'
  80. test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\
  81. || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
  82. cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
  83. cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
  84. cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
  85. test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \\
  86. || cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX'
  87. cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default'
  88. test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \\
  89. || cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
  90. cp conf/fastcgi_params \\
  91. '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default'
  92. test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \\
  93. || cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
  94. cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default'
  95. test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \\
  96. || cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
  97. cp conf/uwsgi_params \\
  98. '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default'
  99. test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \\
  100. || cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
  101. cp conf/scgi_params \\
  102. '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default'
  103. test -f '\$(DESTDIR)$NGX_CONF_PATH' \\
  104. || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
  105. cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
  106. test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
  107. || mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
  108. test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' \\
  109. || mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`'
  110. test -d '\$(DESTDIR)$NGX_PREFIX/html' \\
  111. || cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
  112. END
  113. if test -n "$NGX_ERROR_LOG_PATH"; then
  114. cat << END >> $NGX_MAKEFILE
  115. test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' \\
  116. || mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`'
  117. END
  118. fi
  119. if test -n "$DYNAMIC_MODULES"; then
  120. cat << END >> $NGX_MAKEFILE
  121. test -d '\$(DESTDIR)$NGX_MODULES_PATH' \\
  122. || mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH'
  123. END
  124. fi
  125. for ngx_module in $DYNAMIC_MODULES
  126. do
  127. ngx_module=$ngx_module$ngx_modext
  128. cat << END >> $NGX_MAKEFILE
  129. test ! -f '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
  130. || mv '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
  131. '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module.old'
  132. cp $NGX_OBJS/$ngx_module '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module'
  133. END
  134. done
  135. # create Makefile
  136. cat << END >> Makefile
  137. build:
  138. \$(MAKE) -f $NGX_MAKEFILE
  139. install:
  140. \$(MAKE) -f $NGX_MAKEFILE install
  141. modules:
  142. \$(MAKE) -f $NGX_MAKEFILE modules
  143. upgrade:
  144. $NGX_SBIN_PATH -t
  145. kill -USR2 \`cat $NGX_PID_PATH\`
  146. sleep 1
  147. test -f $NGX_PID_PATH.oldbin
  148. kill -QUIT \`cat $NGX_PID_PATH.oldbin\`
  149. .PHONY: build install modules upgrade
  150. END