winlin

fix bug #64: install_dir=DESTDIR+PREFIX

@@ -202,7 +202,7 @@ cat << END > ${SRS_MAKEFILE} @@ -202,7 +202,7 @@ cat << END > ${SRS_MAKEFILE}
202 202
203 # install prefix. 203 # install prefix.
204 SRS_PREFIX=${SRS_PREFIX} 204 SRS_PREFIX=${SRS_PREFIX}
205 -DESTDIR=\$(SRS_PREFIX) 205 +__REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX)
206 206
207 END 207 END
208 208
@@ -260,22 +260,22 @@ uninstall: @@ -260,22 +260,22 @@ uninstall:
260 @rm -rf \$(SRS_PREFIX) 260 @rm -rf \$(SRS_PREFIX)
261 261
262 install-api: install 262 install-api: install
263 - @echo "mkdir \$(DESTDIR)"  
264 - @mkdir -p \$(DESTDIR) 263 + @echo "mkdir \$(__REAL_INSTALL)"
  264 + @mkdir -p \$(__REAL_INSTALL)
265 @echo "copy binary files" 265 @echo "copy binary files"
266 - @mkdir -p \$(DESTDIR)/research/api-server  
267 - @cp research/api-server/server.py \$(DESTDIR)/research/api-server  
268 - @mkdir -p \$(DESTDIR)/objs/ffmpeg/bin  
269 - @cp objs/ffmpeg/bin/ffmpeg \$(DESTDIR)/objs/ffmpeg/bin 266 + @mkdir -p \$(__REAL_INSTALL)/research/api-server
  267 + @cp research/api-server/server.py \$(__REAL_INSTALL)/research/api-server
  268 + @mkdir -p \$(__REAL_INSTALL)/objs/ffmpeg/bin
  269 + @cp objs/ffmpeg/bin/ffmpeg \$(__REAL_INSTALL)/objs/ffmpeg/bin
270 @echo "copy html files" 270 @echo "copy html files"
271 - @mkdir -p \$(DESTDIR)/research/api-server/static-dir/players  
272 - @cp research/api-server/static-dir/crossdomain.xml \$(DESTDIR)/research/api-server/static-dir  
273 - @cp research/api-server/static-dir/index.html \$(DESTDIR)/research/api-server/static-dir  
274 - @cp -r research/api-server/static-dir/players/* \$(DESTDIR)/research/api-server/static-dir/players 271 + @mkdir -p \$(__REAL_INSTALL)/research/api-server/static-dir/players
  272 + @cp research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/research/api-server/static-dir
  273 + @cp research/api-server/static-dir/index.html \$(__REAL_INSTALL)/research/api-server/static-dir
  274 + @cp -r research/api-server/static-dir/players/* \$(__REAL_INSTALL)/research/api-server/static-dir/players
275 @echo "copy init.d script files" 275 @echo "copy init.d script files"
276 - @mkdir -p \$(DESTDIR)/etc/init.d  
277 - @cp etc/init.d/srs-api \$(DESTDIR)/etc/init.d  
278 - @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(DESTDIR)/etc/init.d/srs-api 276 + @mkdir -p \$(__REAL_INSTALL)/etc/init.d
  277 + @cp etc/init.d/srs-api \$(__REAL_INSTALL)/etc/init.d
  278 + @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs-api
279 @echo "" 279 @echo ""
280 @echo "api installed, to link and start api:" 280 @echo "api installed, to link and start api:"
281 @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs-api /etc/init.d/srs-api" 281 @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs-api /etc/init.d/srs-api"
@@ -284,20 +284,21 @@ install-api: install @@ -284,20 +284,21 @@ install-api: install
284 @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" 284 @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService"
285 285
286 install: 286 install:
287 - @echo "mkdir \$(DESTDIR)"  
288 - @mkdir -p \$(DESTDIR) 287 + @echo "mkdir \$(__REAL_INSTALL)"
  288 + @mkdir -p \$(__REAL_INSTALL)
289 @echo "make the http root dir" 289 @echo "make the http root dir"
290 - @mkdir -p \$(DESTDIR)/objs/nginx/html 290 + @mkdir -p \$(__REAL_INSTALL)/objs/nginx/html
  291 + @cp research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html
291 @echo "copy binary files" 292 @echo "copy binary files"
292 - @mkdir -p \$(DESTDIR)/objs  
293 - @cp objs/srs \$(DESTDIR)/objs 293 + @mkdir -p \$(__REAL_INSTALL)/objs
  294 + @cp objs/srs \$(__REAL_INSTALL)/objs
294 @echo "copy srs conf files" 295 @echo "copy srs conf files"
295 - @mkdir -p \$(DESTDIR)/conf  
296 - @cp conf/*.conf \$(DESTDIR)/conf 296 + @mkdir -p \$(__REAL_INSTALL)/conf
  297 + @cp conf/*.conf \$(__REAL_INSTALL)/conf
297 @echo "copy init.d script files" 298 @echo "copy init.d script files"
298 - @mkdir -p \$(DESTDIR)/etc/init.d  
299 - @cp etc/init.d/srs \$(DESTDIR)/etc/init.d  
300 - @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(DESTDIR)/etc/init.d/srs 299 + @mkdir -p \$(__REAL_INSTALL)/etc/init.d
  300 + @cp etc/init.d/srs \$(__REAL_INSTALL)/etc/init.d
  301 + @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs
301 @echo "" 302 @echo ""
302 @echo "srs installed, to link and start srs:" 303 @echo "srs installed, to link and start srs:"
303 @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs" 304 @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs"
@@ -53,7 +53,7 @@ ok_msg "old srs backuped" @@ -53,7 +53,7 @@ ok_msg "old srs backuped"
53 # prepare files. 53 # prepare files.
54 ok_msg "prepare files" 54 ok_msg "prepare files"
55 ( 55 (
56 - sed -i "s|^ROOT=.*|ROOT=\"${INSTALL}\"|g" $work_dir/etc/init.d/srs 56 + sed -i "s|^ROOT=.*|ROOT=\"${INSTALL}\"|g" $work_dir/${INSTALL}/etc/init.d/srs
57 ) >> $log 2>&1 57 ) >> $log 2>&1
58 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "prepare files failed"; exit $ret; fi 58 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "prepare files failed"; exit $ret; fi
59 ok_msg "prepare files success" 59 ok_msg "prepare files success"
@@ -62,9 +62,9 @@ ok_msg "prepare files success" @@ -62,9 +62,9 @@ ok_msg "prepare files success"
62 ok_msg "copy core components" 62 ok_msg "copy core components"
63 ( 63 (
64 mkdir -p $install_root 64 mkdir -p $install_root
65 - cp -r $work_dir/conf $install_root &&  
66 - cp -r $work_dir/etc $install_root &&  
67 - cp -r $work_dir/objs $install_root 65 + cp -r $work_dir/${INSTALL}/conf $install_root &&
  66 + cp -r $work_dir/${INSTALL}/etc $install_root &&
  67 + cp -r $work_dir/${INSTALL}/objs $install_root
68 ) >>$log 2>&1 68 ) >>$log 2>&1
69 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy core components failed"; exit $ret; fi 69 ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy core components failed"; exit $ret; fi
70 ok_msg "copy core components success" 70 ok_msg "copy core components success"