-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ksh
More file actions
executable file
·530 lines (483 loc) · 13.1 KB
/
Copy pathinstall.ksh
File metadata and controls
executable file
·530 lines (483 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
#!/bin/bash
PROJET=mcumediaserver
VERSION="1.8.7"
#Repertoire d'installation des includes
DESTDIR_INC=/usr/include/
#Repertoire d'installation des librairies
if [ "`uname -m`" == "x86_64" ]
then
DESTDIR_LIB=/usr/lib64
else
DESTDIR_LIB=/usr/lib
fi
WEBRTCTAG=0.0.1
#RPepertoire d'installation des fichiers so
DESTDIR_MOD=$DESTDIR_LIB/asterisk/modules
#Repertoire d'installation du fichier mp4tool
DESTDIR_BIN=/usr/bin/
#Repertoire temporaire utiliser pour preparer les packages
TEMPDIR=/tmp
#Creation de l'environnement de packaging rpm
function create_rpm
{
#Cree l'environnement de creation de package
#Creation des macros rpmbuild
rm ~/.rpmmacros
touch ~/.rpmmacros
echo "%name" $PROJET >> ~/.rpmmacros
echo "%version" $VERSION >> ~/.rpmmacros
echo "%_topdir" $PWD"/rpmbuild" >> ~/.rpmmacros
echo "%_tmppath %{_topdir}/TMP" >> ~/.rpmmacros
echo "%_signature gpg" >> ~/.rpmmacros
echo "%_gpg_name IVeSkey" >> ~/.rpmmacros
echo "%_gpg_path" $PWD"/gnupg" >> ~/.rpmmacros
echo "%vendor IVeS" >> ~/.rpmmacros
if [[ -z $2 || $2 -ne nosign ]]
then
#Import de la clef gpg IVeS
#svn export https://svn.ives.fr/svn-libs-dev/gnupg
rm -rf gnupg
git clone git@git.ives.fr:internal/gnupg.git
fi
mkdir -p rpmbuild
mkdir -p rpmbuild/SOURCES
mkdir -p rpmbuild/SPECS
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/SRPMS
mkdir -p rpmbuild/TMP
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/RPMS/noarch
mkdir -p rpmbuild/RPMS/i386
mkdir -p rpmbuild/RPMS/i686
mkdir -p rpmbuild/RPMS/i586
mkdir -p rpmbuild/RPMS/x86_64
#Recuperation de la description du package
cd ./rpmbuild/SPECS/
cp ../../mcumediaserver.spec .
cd ../../
rm -rf $HOME/xmlrpc-c
rm -f staticdeps/lib/libxmlrpc*.a
if [[ -z $2 || $2 -ne nosign ]]
then
rpmbuild -bb --sign $PWD/rpmbuild/SPECS/mcumediaserver.spec
else
rpmbuild -bb $PWD/rpmbuild/SPECS/mcumediaserver.spec
fi
if [ $? == 0 ]
then
echo "************************* fin du rpmbuild ****************************"
#Recuperation du rpm
mv -f $PWD/rpmbuild/RPMS/i386/*.rpm $PWD/.
mv -f $PWD/rpmbuild/RPMS/i586/*.rpm $PWD/.
mv -f $PWD/rpmbuild/RPMS/i686/*.rpm $PWD/.
mv -f $PWD/rpmbuild/RPMS/x86_64/*.rpm $PWD/.
clean
else
clean
echo "*** error during build ***"
exit 20
fi
}
function clean
{
# On efface les liens ainsi que le package precedemment cr.
echo Effacement des fichiers et liens gnupg rpmbuild ${PROJET}.rpm ${TEMPDIR}/${PROJET}
rm -rf gnupg rpmbuild ${TEMPDIR}/${PROJET}
cd mcu
make -f Makefile.rpm clean
cd -
}
function compile_webrtc_from_google
{
MEDIASERVERPATH=$PWD
echo "compiling some Webrtc libs used in the mcu"
cd $HOME
if [ -x /urr/local/bin/python ]
then
hash python /usr/local/bin/python
echo "using specific python installlation"
fi
python -V 2> version
if [ $? -ne 0 ]
then
echo "python doit etre installe en version 2.6 ou superieure"
return
fi
echo "now checking installed version"
egrep "( 2.6| 2.7)" version
if [ $? -ne 0 ]
then
echo "version incorrecte de python :"
python -V
rm -r version
echo " il faut installer une version 2.6 ou 2.7 "
return
fi
rm -f version
if [ ! -r depot_tools ]
then
echo getting chromium depot tools
svn co http://src.chromium.org/chrome/trunk/tools/depot_tools
fi
export PATH=$PATH:$HOME/depot_tools
if [ ! -r webrtc/trunk/webrtc/common_audio ]
then
echo downloading webrtc
mkdir webrtc
cd webrtc
gclient config http://webrtc.googlecode.com/svn/trunk
gclient sync --force
gclient runhooks --force
echo building webrtc
cd trunk
#sed -e 's/BUILDTYPE ?= Debug/BUILDTYPE ?= Release/g' Makefile > Makefike.new
mv Makefile Makefile.sav
#mv Makefike.new Makefile
cp $MEDIASERVERPATH/media/Makefile.webrtc Makefile
else
cd webrtc/trunk
cp $MEDIASERVERPATH/media/Makefile.webrtc Makefile
fi
if [ ! -r out/Release/obj.target/webrtc/common_audio/libsignal_processing.a ]
then
make out/Release/obj.target/webrtc/common_audio/libsignal_processing.a
make out/Release/obj.target/webrtc/common_audio/libvad.a
fi
}
function compile_webrtc_ives
{
MEDIASERVERPATH=$PWD
cd $HOME
if [ ! -r webrtc/trunk/webrtc/common_audio ]
then
echo downloading webrtc
mkdir webrtc
cd webrtc
svn co http://svn.ives.fr/svn-libs-dev/webrtc/tags/$WEBRTCTAG trunk
cd trunk
else
cd webrtc/trunk
fi
if [ ! -r out/Release/obj.target/webrtc/common_audio/libsignal_processing.a ]
then
make out/Release/obj.target/webrtc/common_audio/libsignal_processing.a
make out/Release/obj.target/webrtc/common_audio/libvad.a
fi
cd $MEDIASERVERPATH
}
function compile_webrtc
{
MEDIASERVERPATH=$PWD
cd $HOME
if [ ! -r webrtc/trunk/webrtc/common_audio ]
then
echo downloading webrtc
git clone https://github.com/neutrino38/webrtc_stack.git
mv webrtc_stack webrtc
cd webrtc/trunk
else
cd webrtc/trunk
fi
if [ ! -r out/Release/obj.target/webrtc/common_audio/libsignal_processing.a ]
then
echo "Compiling VAD and signal processing from webrtc"
make out/Release/obj.target/webrtc/common_audio/libsignal_processing.a
git reset --hard
make out/Release/obj.target/webrtc/common_audio/libsignal_processing.a
make out/Release/obj.target/webrtc/common_audio/libvad.a
fi
cd $MEDIASERVERPATH
}
function archive_webrtc
{
MEDIASERVERPATH=$PWD
if [ "`uname -m`" == "x86_64" ]
then
if [ ! -r lib/linux-64bits/libvad.a ]
then
echo "archiving 64 bit lib"
mkdir -p lib/linux-64bits
cp $HOME/webrtc/trunk/out/Release/obj.target/webrtc/common_audio/libvad.a lib/linux-64bits
cp $HOME/webrtc/trunk/out/Release/obj.target/webrtc/common_audio/libsignal_processing.a lib/linux-64bits
else
echo "libvad was not compiled !!!"
fi
else
if [ ! -r lib/linux-64bits/libvad.a ]
then
echo "archiving 32 bits lib"
mkdir -p lib/linux-32bits
cp $HOME/webrtc/trunk/out/Release/obj.target/webrtc/common_audio/libvad.a lib/linux-32bits
cp $HOME/webrtc/trunk/out/Release/obj.target/webrtc/common_audio/libsignal_processing.a lib/linux-32bits
else
echo "libvad was not compiled !!!"
fi
fi
echo "archving headers"
# TODO archive headers
}
function local_compile
{
# compiler localement
echo checking if dependencies are installed
rpm -q gsm-devel
if [ $? != 0 ]
then
echo "installer gsm-devel"
exit 20
fi
rpm -q ffmpeg-devel
if [ $? != 0 ]
then
echo "installer ffmpeg-devel"
exit 20
fi
# compiler openssl en statique
BASESRCDIR=$PWD
if [ ! -f staticdeps/lib/libssl.a ]
then
echo "on doit compiler openssl 1.1.1d"
if [ ! -r $HOME/openssl ]
then
cd $HOME
rm -f OpenSSL_1_1_1d.tar.gz
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz
tar xzf OpenSSL_1_1_1d.tar.gz
mv openssl-OpenSSL_1_1_1d openssl
rm -f OpenSSL_1_1_1d.tar.gz
fi
cd $HOME/openssl
./config --prefix=$BASESRCDIR/staticdeps --openssldir=$BASESRCDIR/staticdeps shared zlib
make
make install
cd $BASESRCDIR
fi
# compiler mp4v2 en static
if [ ! -f staticdeps/lib/libmp4v2.a ]
then
echo "compilation libmp4v2"
cd $HOME
if [ ! -r mp4v2 ]
then
git clone https://github.com/InteractiviteVideoEtSystemes/mp4v2.git
fi
cd mp4v2
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make clean
make
make install
cd $BASESRCDIR
fi
# compiler speex en statique
BASESRCDIR=$PWD
if [ ! -f staticdeps/lib/libspeex.a ]
then
echo "on doit compiler SPEEX 1.2rc1"
if [ ! -r $HOME/speex-src ]
then
#svn export http://svn.ives.fr/svn-libs-dev/asterisk/libsmedia/speex/tags/1.2rc1 $HOME/speex-src
cd $HOME
rm -f speex-1.2rc2.tar.gz speex-1.2rc2.tar
wget http://downloads.xiph.org/releases/speex/speex-1.2rc2.tar.gz
tar xzf speex-1.2rc2.tar.gz
mv speex-1.2rc2 speex-src
cd $HOME/speex-src
fi
cd $HOME/speex-src
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make
make install
cd $BASESRCDIR
fi
if [ ! -f staticdeps/lib/libspeexdsp.a ]
then
echo "on doit compiler SPEEXDSP 1.2rc1"
if [ ! -r $HOME/speexdsp-src ]
then
#svn export http://svn.ives.fr/svn-libs-dev/asterisk/libsmedia/speex/tags/1.2rc1 $HOME/speex-src
cd $HOME
rm -f speexdsp-1.2rc3.tar.gz
wget http://downloads.xiph.org/releases/speex/speexdsp-1.2rc3.tar.gz
tar xzf speexdsp-1.2rc3.tar.gz
mv speexdsp-1.2rc3 speexdsp-src
cd $HOME/speexdsp-src
fi
cd $HOME/speexdsp-src
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make
make install
cd $BASESRCDIR
fi
# http://xmlrpc-c.svn.sourceforge.net/viewvc/xmlrpc-c/super_stable?view=tar
if [ ! -f staticdeps/lib/libxmlrpc_abyss.a ]
then
echo "compilation XMLRPC-C"
cd $HOME
if [ ! -f xmlrpc-c ]
then
#svn export svn://svn.code.sf.net/p/xmlrpc-c/code/release_number/01.39.06 xmlrpc-c
svn export svn://svn.code.sf.net/p/xmlrpc-c/code/stable xmlrpc-c
fi
cd xmlrpc-c
./configure --disable-abyss-openssl --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make
make install
cd $BASESRCDIR
fi
if [ ! -f staticdeps/lib/libsrtp.a ]
then
echo "compilation SRTP"
cd $HOME
if [ ! -f srtp ]
then
git clone https://github.com/InteractiviteVideoEtSystemes/patchedLibSRTP.git srtp
fi
cd srtp
chmod 755 configure
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make
make uninstall
make install
cd $BASESRCDIR
fi
if [ ! -f staticdeps/lib/libopus.a ]
then
echo "compilation OPUS"
cd $HOME
if [ ! -f opus-1.1 ]
then
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar xzf opus-1.1.tar.gz
rm -f opus-1.1.tar.gz opus-1.1.tar
fi
cd opus-1.1
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make
make install
cd $BASESRCDIR
fi
if [ ! -f staticdeps/lib/libg722_1.a ]
then
echo "compilation SIREN / G.722.1"
cd $HOME
if [ ! -r libg722_1 ]
then
#svn export http://svn.ives.fr/svn-libs-dev/libg722_1
git clone https://github.com/neutrino38/libg722_1.git
fi
cd libg722_1
./configure --prefix=$BASESRCDIR/staticdeps --exec-prefix=$BASESRCDIR/staticdeps --enable-shared=no
make clean
make
make install
cd $BASESRCDIR
fi
if [ ! -r staticdeps/lib/libvpx.a ]
then
echo "Compiling VP8 codec"
#cd $HOME/webrtc/trunk/third_party/libvpx/source/libvpx
cd $HOME
rm -rf libvpx
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout v1.7.0
chmod 750 configure
./configure --disable-shared --enable-static --prefix=$BASESRCDIR/staticdeps --enable-vp8 --enable-error-concealment --disable-multithread
make
make install
cd $BASESRCDIR
fi
compile_webrtc;
cd $BASESRCDIR
mkdir -p bin/debug
cd mcu
make -f Makefile.rpm mcu
}
function compile_rabbitmq
{
MEDIASERVERPATH=$PWD
rpm -q cmake > /dev/null
if [ $? != 0 ]
then
echo "Installer cmake (sudo yum install cmake)"
exit 20
fi
if [ ! -r staticdeps/lib/librabbitmq.a ]
then
echo "Compilation RABBITMQ-C"
cd $HOME
svn export http://svn.ives.fr/svn-libs-dev/rabbitmq-c/tags/0.3.0 rabbitmq-c
cd rabbitmq-c
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$MEDIASERVERPATH/staticdeps -DBUILD_STATIC_LIBS=1 -DBUILD_SHARED_LIBS=0 ..
make
make install
fi
if [ ! -r staticdeps/lib/libamqpcpp.a ]
then
echo "Compilation AMPQCPP"
cd $HOME
svn export http://svn.ives.fr/svn-libs-dev/ampqcpp/trunk ampqcpp
cd ampqcpp
make clean
make INSTALLPREFIX=$MEDIASERVERPATH/staticdeps lib
cp libamqpcpp.a $MEDIASERVERPATH/staticdeps/lib
cp include/AMQPcpp.h $MEDIASERVERPATH/staticdeps/include
fi
cd $MEDIASERVERPATH
}
function compile_protobuf
{
MEDIASERVERPATH=$PWD
if [ ! -r staticdeps/lib/libprotobuf.a ]
then
echo "Compilation PROTOBUF"
cd $HOME
svn export http://svn.ives.fr/svn-libs-dev/protobuf/tags/2.5.0 protobuf
cd protobuf
./configure --prefix=$MEDIASERVERPATH/staticdeps --exec-prefix=$MEDIASERVERPATH/staticdeps --enable-shared=no
make
make install
cd $BASESRCDIR
fi
cd $MEDIASERVERPATH
}
case $1 in
"clean")
echo "Nettoyage des liens et du package crees par la cible dev"
clean ;;
"rpm")
echo "Creation du rpm"
create_rpm "$@";;
"export")
echo "{" >> build.properties
echo "'VERSION': '$VERSION'," >> build.properties
echo "'PROJET':'$PROJET'," >> build.properties
echo "'DESTDIR':'$DESTDIR'" >> build.properties
echo "}" >> build.properties
;;
"localcompile")
local_compile;;
"webrtc")
compile_webrtc;;
"webrtcives")
compile_webrtc_ives;;
"rabbitmq")
compile_rabbitmq;;
"protobuf")
compile_protobuf;;
"upload")
upload_rpm ;;
"prereq")
sudo yum install -y gsm-devel ffmpeg-devel ;;
*)
echo "usage: install.ksh [options]"
echo "options :"
echo " rpm Generation d'un package rpm"
echo " localcompile Compilation du logiciel sans creation de paquet rpm"
echo " webrtc Compilation des libs webrtc"
echo " rabbitmq Compilation des libs RABBITMQ (projet moteli)"
echo " upload TODO: envoi les paquets RPM dans le repo"
echo " clean Nettoie tous les fichiers cree ce script, liens, tar.gz et rpm";;
esac