install revision e18a033b
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) Nginx, Inc.
4
5
6if [ $USE_PERL != NO ]; then
7
8    cat << END                                                >> $NGX_MAKEFILE
9
10install_perl_modules:
11	cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) install
12END
13
14    NGX_INSTALL_PERL_MODULES=install_perl_modules
15
16fi
17
18
19case ".$NGX_SBIN_PATH" in
20    ./*)
21    ;;
22
23    *)
24        NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH
25    ;;
26esac
27
28
29case ".$NGX_MODULES_PATH" in
30    ./*)
31    ;;
32
33    *)
34        NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH
35    ;;
36esac
37
38NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.`
39
40
41case ".$NGX_CONF_PATH" in
42    ./*)
43    ;;
44
45    *)
46        NGX_CONF_PATH=$NGX_PREFIX/$NGX_CONF_PATH
47    ;;
48esac
49
50
51NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
52
53
54case ".$NGX_PID_PATH" in
55    ./*)
56    ;;
57
58    *)
59        NGX_PID_PATH=$NGX_PREFIX/$NGX_PID_PATH
60    ;;
61esac
62
63
64case ".$NGX_ERROR_LOG_PATH" in
65    ./* | .)
66    ;;
67
68    *)
69        NGX_ERROR_LOG_PATH=$NGX_PREFIX/$NGX_ERROR_LOG_PATH
70    ;;
71esac
72
73
74case ".$NGX_HTTP_LOG_PATH" in
75    ./*)
76    ;;
77
78    *)
79        NGX_HTTP_LOG_PATH=$NGX_PREFIX/$NGX_HTTP_LOG_PATH
80    ;;
81esac
82
83
84if test -f man/nginx.8 ; then
85    NGX_MAN=man/nginx.8
86else
87    NGX_MAN=docs/man/nginx.8
88fi
89
90if test -d html ; then
91    NGX_HTML=html
92else
93    NGX_HTML=docs/html
94fi
95
96cat << END                                                    >> $NGX_MAKEFILE
97
98manpage:	$NGX_OBJS/nginx.8
99
100$NGX_OBJS/nginx.8:	$NGX_MAN $NGX_AUTO_CONFIG_H
101	sed -e "s|%%PREFIX%%|$NGX_PREFIX|" \\
102		-e "s|%%PID_PATH%%|$NGX_PID_PATH|" \\
103		-e "s|%%CONF_PATH%%|$NGX_CONF_PATH|" \\
104		-e "s|%%ERROR_LOG_PATH%%|${NGX_ERROR_LOG_PATH:-stderr}|" \\
105		< $NGX_MAN > \$@
106
107install:	build $NGX_INSTALL_PERL_MODULES
108	test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX'
109
110	test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \\
111		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`'
112	test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \\
113		|| mv '\$(DESTDIR)$NGX_SBIN_PATH' \\
114			'\$(DESTDIR)$NGX_SBIN_PATH.old'
115	cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH'
116
117	test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\
118		|| mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
119
120	cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
121	cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
122	cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
123
124	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \\
125		|| cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX'
126	cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default'
127
128	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \\
129		|| cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
130	cp conf/fastcgi_params \\
131		'\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default'
132
133	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \\
134		|| cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
135	cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default'
136
137	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \\
138		|| cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
139	cp conf/uwsgi_params \\
140		'\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default'
141
142	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \\
143		|| cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
144	cp conf/scgi_params \\
145		'\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default'
146
147	test -f '\$(DESTDIR)$NGX_CONF_PATH' \\
148		|| cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
149	cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
150
151	test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
152		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
153
154	test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' \\
155		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`'
156
157	test -d '\$(DESTDIR)$NGX_PREFIX/html' \\
158		|| cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
159END
160
161
162if test -n "$NGX_ERROR_LOG_PATH"; then
163    cat << END                                                >> $NGX_MAKEFILE
164
165	test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' \\
166		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`'
167END
168
169fi
170
171
172if test -n "$DYNAMIC_MODULES"; then
173    cat << END                                                >> $NGX_MAKEFILE
174
175	test -d '\$(DESTDIR)$NGX_MODULES_PATH' \\
176		|| mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH'
177END
178
179fi
180
181
182for ngx_module in $DYNAMIC_MODULES
183do
184    ngx_module=$ngx_module$ngx_modext
185
186    cat << END                                                >> $NGX_MAKEFILE
187
188	test ! -f '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
189		|| mv '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\
190			'\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module.old'
191	cp $NGX_OBJS/$ngx_module '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module'
192END
193
194done
195
196
197# create Makefile
198
199cat << END >> Makefile
200
201build:
202	\$(MAKE) -f $NGX_MAKEFILE
203
204install:
205	\$(MAKE) -f $NGX_MAKEFILE install
206
207modules:
208	\$(MAKE) -f $NGX_MAKEFILE modules
209
210upgrade:
211	$NGX_SBIN_PATH -t
212
213	kill -USR2 \`cat $NGX_PID_PATH\`
214	sleep 1
215	test -f $NGX_PID_PATH.oldbin
216
217	kill -QUIT \`cat $NGX_PID_PATH.oldbin\`
218END
219