11#! /bin/bash
2+ #
3+ # Installs the open source dependencies
4+ # for Kinesis Video Sdk demo application
5+ # and builds the demo application
6+ #
7+
28set -e
9+
10+ # Confirm the tools
11+ echo " Starting to build the Kinesis Video Stream Demo Application
12+ - will be using the following open source libraries and tools
13+ openssl
14+ curl
15+ log4cplus
16+ gettext
17+ libffi
18+ libpcre
19+ zlib
20+ iconv
21+ googletest
22+ bison
23+ flex
24+ libtools
25+ autoconf
26+ automake
27+ m4
28+ also the gstreamer , gstreamer plugins and x264.
29+ "
30+
31+ echo "
32+ Y - Confirm to proceed with build install
33+ N - Exit build install "
34+ echo -n " Enter selection: "
35+ read confirm
36+ echo " "
37+
38+ if [[ " $confirm " = " N" || " $confirm " = " n" ]]; then
39+ exit
40+ fi
41+
342# --------- create require directories ---------
443KINESIS_VIDEO_ROOT=` pwd`
544
@@ -20,6 +59,7 @@ if [ "$CMAKE_MAJOR_VERSION" \< "$CMAKE_EXPECTED_MAJOR_VERSION" ]; then
2059 exit
2160fi
2261
62+
2363DOWNLOADS=" $KINESIS_VIDEO_ROOT /downloads"
2464if [ ! -d " $DOWNLOADS " ]; then
2565 mkdir " $DOWNLOADS "
@@ -39,9 +79,8 @@ elif [[ "$unamestr" == 'Darwin' ]]; then
3979 PLATFORM=' mac'
4080fi
4181
42- # --------- download libs ---------
4382
44- # --------- build + install libs ---------
83+ # --------- build + install libs ---------
4584echo " Checking openssl at $DOWNLOADS /local/lib/libssl.a"
4685if [ ! -f $DOWNLOADS /local/lib/libssl.a ]; then
4786 echo " openssl lib not found. Installing"
@@ -52,7 +91,7 @@ if [ ! -f $DOWNLOADS/local/lib/libssl.a ]; then
5291 cd $DOWNLOADS
5392 tar -xvf openssl-1.1.0f.tar.gz
5493 cd $DOWNLOADS /openssl-1.1.0f
55- ./config -fPIC --prefix=$DOWNLOADS /local/ --openssldir=$DOWNLOADS /local/
94+ ./config --prefix=$DOWNLOADS /local/ --openssldir=$DOWNLOADS /local/
5695 make
5796 make install
5897fi
@@ -83,28 +122,29 @@ if [ ! -f $DOWNLOADS/local/lib/liblog4cplus.dylib ]; then
83122 cd $DOWNLOADS
84123 tar -xvf log4cplus-1.2.0.tar.xz
85124 cd $DOWNLOADS /log4cplus-1.2.0
86- ./configure --prefix=$DOWNLOADS /local/ --with-pic
125+ ./configure --prefix=$DOWNLOADS /local/
87126 make
88127 make install
89128 fi
90129fi
91130
92131echo " Checking gettext at $DOWNLOADS /local/lib/libgettextlib.dylib/.so"
93132if [ ! -f $DOWNLOADS /local/lib/libgettextlib.dylib ]; then
94- if [ ! -f $DOWNLOADS /local/lib/libgettextlib.so ]; then
95- echo " gettext lib not found. Installing"
96- if [ ! -f $DOWNLOADS /gettext-0.19.8.tar.xz ]; then
97- cd $DOWNLOADS
98- curl -L " http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.tar.xz" -o " gettext-0.19.8.tar.xz"
99- fi
100- cd $DOWNLOADS
101- tar -xvf gettext-0.19.8.tar.xz
102- cd $DOWNLOADS /gettext-0.19.8
103- ./configure --prefix=$DOWNLOADS /local/
104- make
105- make install
106- fi
133+ if [ ! -f $DOWNLOADS /local/lib/libgettextlib.so ]; then
134+ echo " gettext lib not found. Installing"
135+ if [ ! -f $DOWNLOADS /gettext-0.19.8.tar.xz ]; then
136+ cd $DOWNLOADS
137+ curl -L " http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.tar.xz" -o " gettext-0.19.8.tar.xz"
138+ fi
139+ cd $DOWNLOADS
140+ tar -xvf gettext-0.19.8.tar.xz
141+ cd $DOWNLOADS /gettext-0.19.8
142+ ./configure --prefix=$DOWNLOADS /local/
143+ make
144+ make install
145+ fi
107146fi
147+
108148
109149echo " Checking libffi at $DOWNLOADS /local/lib/libffi.a"
110150if [ ! -f $DOWNLOADS /local/lib/libffi.dylib ]; then
@@ -193,29 +233,145 @@ if [[ $PLATFORM == 'linux' ]]; then
193233 fi
194234fi
195235
236+ # ----- libfl.2.dylib and libfl.2.so ---------------------
237+ if [ ! -f $DOWNLOADS /local/lib/libfl.2.dylib ]; then
238+ if [ ! -f $DOWNLOADS /local/lib/libfl.2.so ]; then
239+ if [ ! -f $DOWNLOADS /local/lib/libfl.so ]; then
240+ echo " flex not found. Installing"
241+ if [ ! -f $DOWNLOADS /flex-2.6.4.tar.gz ]; then
242+ cd $DOWNLOADS
243+ curl -L " https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz" -o " flex-2.6.4.tar.xz"
244+ fi
245+ cd $DOWNLOADS
246+ tar -xvf flex-2.6.4.tar.xz
247+ cd $DOWNLOADS /flex-2.6.4
248+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
249+ make
250+ make install
251+ fi
252+ fi
253+ fi
254+ # -----------------------liby.a----------------------------
255+ if [ ! -f $DOWNLOADS /local/lib/liby.a ]; then
256+ echo " bison not found. Installing"
257+ if [ ! -f $DOWNLOADS /bison-2.3.tar.gz ]; then
258+ cd $DOWNLOADS
259+ curl -L " http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz" -o " bison-3.0.4.tar.xz"
260+ fi
261+ cd $DOWNLOADS
262+ tar -xvf bison-3.0.4.tar.xz
263+ cd $DOWNLOADS /bison-3.0.4
264+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
265+ make
266+ make install
267+ fi
268+ # --------- libltdl------------------------------------------
269+ if [ ! -f $DOWNLOADS /local/lib/libltdl.7.dylib ]; then
270+ if [ ! -f $DOWNLOADS /local/lib/libltdl.7.so ]; then
271+ if [ ! -f $DOWNLOADS /local/lib/libltdl.so ]; then
272+ echo " libtools not found. Installing"
273+ if [ ! -f $DOWNLOADS /libtool-2.4.6.tar.gz ]; then
274+ cd $DOWNLOADS
275+ curl -L " http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz" -o " libtool-2.4.6.tar.xz"
276+ fi
277+ cd $DOWNLOADS
278+ tar -xvf libtool-2.4.6.tar.xz
279+ cd $DOWNLOADS /libtool-2.4.6
280+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
281+ make
282+ make install
283+ fi
284+ fi
285+ fi
286+
287+ # --------- glib ------------------------------------------
196288echo " Checking glib at $DOWNLOADS /local/lib/libglib-2.0.dylib/.so"
197289if [ ! -f $DOWNLOADS /local/lib/libglib-2.0.dylib ]; then
198- if [ ! -f $DOWNLOADS /local/lib/libglib-2.0.so ]; then
199- export LIBFFI_CFLAGS=" -I$DOWNLOADS /local/include -I$DOWNLOADS /local/lib/libffi-3.2.1/include -L$DOWNLOADS /local/lib"
200- export LIBFFI_LIBS=" -L$DOWNLOADS /local/lib -lffi"
201- export LDFLAGS=" -L$DOWNLOADS /local/lib"
202- export CPPFLAGS=" -I$DOWNLOADS /local/include"
203-
204- echo " glib lib not found. Installing"
205- if [ ! -f $DOWNLOADS /glib-2.54.2.tar.xz ]; then
290+ if [ ! -f $DOWNLOADS /local/lib/libglib-2.0.so ]; then
291+ export LIBFFI_CFLAGS=" -I$DOWNLOADS /local/include -I$DOWNLOADS /local/lib/libffi-3.2.1/include -L$DOWNLOADS /local/lib"
292+ export LIBFFI_LIBS=" -L$DOWNLOADS /local/lib -lffi"
293+ export LDFLAGS=" -L$DOWNLOADS /local/lib"
294+ export CPPFLAGS=" -I$DOWNLOADS /local/include"
295+
296+ echo " glib lib not found. Installing"
297+ if [ ! -f $DOWNLOADS /glib-2.54.2.tar.xz ]; then
298+ cd $DOWNLOADS
299+ curl -L " http://ftp.gnome.org/pub/gnome/sources/glib/2.54/glib-2.54.2.tar.xz" -o " glib-2.54.2.tar.xz"
300+ fi
301+ cd $DOWNLOADS
302+ tar -xvf glib-2.54.2.tar.xz
303+ cd $DOWNLOADS /glib-2.54.2
304+ # autoreconf -f -i
305+ ./configure --prefix=$DOWNLOADS /local/ --with-pcre --with-libiconv
306+ make
307+ make install
308+ fi
309+ fi
310+ # --------- googletest------------------------------------------
311+ echo " Checking googletest at $DOWNLOADS /local/lib/libgtest.a"
312+ if [ ! -f $DOWNLOADS /local/lib/libgtest.dylib ]; then
313+ if [ ! -f $DOWNLOADS /local/lib/libgtest.so ]; then
314+ echo " gtest lib not found. Installing"
315+ if [ ! -f $DOWNLOADS /google-test-1.8.0.gz ]; then
206316 cd $DOWNLOADS
207- curl -L " http ://ftp.gnome.org/pub/gnome/sources/glib/2.54/glib-2.54.2 .tar.xz " -o " glib-2.54.2.tar.xz "
317+ curl -L " https ://github.com/google/googletest/archive/release-1.8.0 .tar.gz " -o " google-test-1.8.0.gz "
208318 fi
209319 cd $DOWNLOADS
210- tar -xvf glib-2.54.2.tar.xz
211- cd $DOWNLOADS /glib-2.54.2
212- autoreconf -f -i
213- ./configure --prefix=$DOWNLOADS /local/ --with-pcre --with-libiconv
320+ tar -xvf google-test-1.8.0.gz
321+ cd googletest-release-1.8.0/googletest
322+ cmake -DBUILD_SHARED_LIBS=ON .
214323 make
215- make install
324+ mkdir -p $DOWNLOADS /local/lib
325+ cp -r ./include $DOWNLOADS /local
326+ cp ./lib* $DOWNLOADS /local/lib
216327 fi
217328fi
218329
330+ # -------------------------install program m4 --------------------------------------------------------------------
331+ if [ ! -f $DOWNLOADS /local/bin/m4 ]; then
332+ echo " m4 not found. Installing"
333+ if [ ! -f $DOWNLOADS /m4-1.4.10.tar.gz ]; then
334+ cd $DOWNLOADS
335+ curl -L " http://ftpmirror.gnu.org/m4/m4-1.4.10.tar.gz" -o " m4-1.4.10.tar.xz"
336+ fi
337+ cd $DOWNLOADS
338+ tar -xvf m4-1.4.10.tar.xz
339+ cd $DOWNLOADS /m4-1.4.10
340+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
341+ make
342+ make install
343+ fi
344+
345+ # -------------------autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate, and ifnames------------------
346+ if [ ! -f $DOWNLOADS /local/bin/autoconf ]; then
347+ echo " autoconf not found. Installing"
348+ if [ ! -f $DOWNLOADS /autoconf-2.69.tar.gz ]; then
349+ cd $DOWNLOADS
350+ curl -L " http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz" -o " autoconf-2.69.tar.xz"
351+ fi
352+ cd $DOWNLOADS
353+ tar -xvf autoconf-2.69.tar.xz
354+ cd $DOWNLOADS /autoconf-2.69
355+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
356+ make
357+ make install
358+ fi
359+
360+ # --------aclocal, aclocal-1.15 (hard linked with aclocal), automake, and automake-1.15 (hard linked with automake)--
361+ if [ ! -f $DOWNLOADS /local/bin/automake ]; then
362+ echo " automake not found. Installing"
363+ if [ ! -f $DOWNLOADS /automake-1.15.tar.gz ]; then
364+ cd $DOWNLOADS
365+ curl -L " https://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz" -o " automake-1.15.tar.xz"
366+ fi
367+ cd $DOWNLOADS
368+ tar -xvf automake-1.15.tar.xz
369+ cd $DOWNLOADS /automake-1.15
370+ ./configure --prefix=$DOWNLOADS /local CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
371+ make
372+ make install
373+ fi
374+
219375export GLIB_CFLAGS=" -I$DOWNLOADS /local/include/glib-2.0 -I$DOWNLOADS /local/include/glib-2.0/glib -I$DOWNLOADS /local/lib/glib-2.0/include"
220376
221377echo " Checking gstreamer at $DOWNLOADS /local/lib/libgstreamer-1.0.dylib/.so"
@@ -233,7 +389,7 @@ if [ ! -f $DOWNLOADS/local/lib/libgstreamer-1.0.dylib ]; then
233389
234390 for d in ./* / ; do
235391 if [ -f " $d /configure.ac" ]; then
236- (cd " $d " && autoreconf -f -i);
392+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
237393 fi
238394 done
239395
@@ -257,7 +413,7 @@ if [ ! -f $DOWNLOADS/local/lib/libgstvideo-1.0.dylib ]; then
257413
258414 for d in ./* / ; do
259415 if [ -f " $d /configure.ac" ]; then
260- (cd " $d " && autoreconf -f -i);
416+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
261417 fi
262418 done
263419
@@ -280,11 +436,11 @@ if [ ! -f $DOWNLOADS/local/lib/gstreamer-1.0/libgstavi.la ]; then
280436
281437 for d in ./* / ; do
282438 if [ -f " $d /configure.ac" ]; then
283- (cd " $d " && autoreconf -f -i);
439+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
284440 fi
285441 done
286442
287- ./configure --prefix=$DOWNLOADS /local --disable-examples --disable-x --disable-gtk-doc -- CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
443+ ./configure --prefix=$DOWNLOADS /local --disable-examples --disable-x --disable-gtk-doc CFLAGS=" -I$DOWNLOADS /local/include" LDFLAGS=" -L$DOWNLOADS /local/lib"
288444 make
289445 make install
290446fi
@@ -303,7 +459,7 @@ if [ ! -f $DOWNLOADS/local/lib/libgstbadvideo-1.0.dylib ]; then
303459
304460 for d in ./* / ; do
305461 if [ -f " $d /configure.ac" ]; then
306- (cd " $d " && autoreconf -f -i);
462+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
307463 fi
308464 done
309465
@@ -327,7 +483,7 @@ if [ ! -f $DOWNLOADS/local/lib/libx264.dylib ]; then
327483
328484 for d in ./* / ; do
329485 if [ -f " $d /configure.ac" ]; then
330- (cd " $d " && autoreconf -f -i);
486+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
331487 fi
332488 done
333489
@@ -351,7 +507,7 @@ if [ ! -f $DOWNLOADS/local/lib/gstreamer-1.0/libgstx264.dylib ]; then
351507
352508 for d in ./* / ; do
353509 if [ -f " $d /configure.ac" ]; then
354- (cd " $d " && autoreconf -f -i);
510+ (cd " $d " && ./ " ${DOWNLOADS} " /local/bin/ autoreconf -f -i);
355511 fi
356512 done
357513
@@ -361,25 +517,6 @@ if [ ! -f $DOWNLOADS/local/lib/gstreamer-1.0/libgstx264.dylib ]; then
361517 fi
362518fi
363519
364- echo " Checking googletest at $DOWNLOADS /local/lib/libgtest.a"
365- if [ ! -f $DOWNLOADS /local/lib/libgtest.dylib ]; then
366- if [ ! -f $DOWNLOADS /local/lib/libgtest.so ]; then
367- echo " gtest lib not found. Installing"
368- if [ ! -f $DOWNLOADS /google-test-1.8.0.gz ]; then
369- cd $DOWNLOADS
370- curl -L " https://github.com/google/googletest/archive/release-1.8.0.tar.gz" -o " google-test-1.8.0.gz"
371- fi
372- cd $DOWNLOADS
373- tar -xvf google-test-1.8.0.gz
374- cd googletest-release-1.8.0/googletest
375- cmake -DBUILD_SHARED_LIBS=ON .
376- make
377- mkdir -p $DOWNLOADS /local/lib
378- cp -r ./include $DOWNLOADS /local
379- cp ./lib* $DOWNLOADS /local/lib
380- fi
381- fi
382-
383520export PKG_CONFIG_LIBDIR=" $DOWNLOADS /local/lib/pkgconfig"
384521export CMAKE_PREFIX_PATH=" $DOWNLOADS /local"
385522
391528echo " **********************************************************"
392529echo Success!!!
393530echo " **********************************************************"
531+
0 commit comments