source: titan/libeplayer3/makeBRCM.sh @ 42227

Last change on this file since 42227 was 40360, checked in by obi, 5 years ago

cleanup

File size: 7.2 KB
Line 
1#!/bin/bash
2
3set -e
4
5function usage {
6   echo "Usage:"
7   echo "$0 platform ffmpeg_ver"
8   echo "platform:       mipsel | mipsel_softfpu | armv7 | armv5t"
9   echo "ffmpeg_ver:     2.8.5 | 3.0.5 | 3.1.1 | 3.2.2"
10   exit 1
11}
12
13if [ "$#" -ne 2 ];
14then
15    usage
16fi
17
18EPLATFORM=$1
19FFMPEG_VERSION=$2
20
21if [ "$EPLATFORM" != "mipsel" -a "$EPLATFORM" != "mipsel_softfpu" -a "$EPLATFORM" != "armv7" -a "$EPLATFORM" != "armv5t" ];
22then
23    echo "Please give supported platform (mipsel|mipsel_softfpu|armv7|armv5t) version!"
24    usage
25fi
26
27if [ "$FFMPEG_VERSION" != "2.8.5" -a "$FFMPEG_VERSION" != "3.0.5" -a "$FFMPEG_VERSION" != "3.1.1" -a "$FFMPEG_VERSION" != "3.2.2" ];
28then
29    echo "Please give supported ffmpeg (2.8.5|3.0.5|3.1.1|3.2.2) version!"
30    usage
31fi
32
33case "$EPLATFORM" in
34    mipsel)
35        BASE_PATH="/mnt/new2/xspeedlx1/build-enviroment/builds/openatv/release/et4x00/tmp/sysroots/"
36        export TOOLCHAIN_NAME="mipsel-oe-linux"
37        export PATH=$BASE_PATH"i686-linux/usr/bin/mipsel-oe-linux/":$PATH
38        export SYSROOT=$BASE_PATH"et4x00"
39        CFLAGS="  -mel -mabi=32 -march=mips32 "
40        FFMPEG_CFLAGS=" -mel -mabi=32 -march=mips32 -I$SYSROOT/usr/include/libxml2/ "
41        FFMPEG_LDFLAGS=" -lssl -lcrypto -lxml2 "
42        ;;
43    mipsel_softfpu)
44        BASE_PATH="/mnt/new2/softFPU/openpli/build/tmp/sysroots/"
45        export TOOLCHAIN_NAME="mipsel-oe-linux"
46        export PATH=$BASE_PATH"i686-linux/usr/bin/mipsel-oe-linux/":$PATH
47        export SYSROOT=$BASE_PATH"et4x00"
48        CFLAGS="  -mel -mabi=32 -msoft-float -march=mips32 "
49        FFMPEG_CFLAGS=" -mel -mabi=32 -msoft-float -march=mips32 "
50        ;;
51    armv7)
52        if [ 0 -eq 1 ];
53        then
54            echo "ARMv7 toolchain openvuplus_3.0"
55            BASE_PATH="/mnt/new2/vusolo4k/openvuplus_3.0/build/vusolo4k/tmp/sysroots/"
56            export TOOLCHAIN_NAME="arm-oe-linux-gnueabi"
57            export PATH=$BASE_PATH"i686-linux/usr/bin/arm-oe-linux-gnueabi/":$PATH
58            export SYSROOT=$BASE_PATH"vusolo4k"
59        else
60            echo "ARMv7 toolchain openpli_4.0"
61            BASE_PATH="/mnt/new2/openpli_micro/openpli-oe-core/build/tmp/sysroots/"
62            export TOOLCHAIN_NAME="arm-oe-linux-gnueabi"
63            export PATH=$BASE_PATH"i686-linux/usr/bin/arm-oe-linux-gnueabi/":$PATH
64            export SYSROOT=$BASE_PATH"hd51"
65
66        fi
67        CFLAGS=" -march=armv7-a -mfloat-abi=hard -mfpu=neon "
68        ;;
69    armv5t)
70        BASE_PATH="/mnt/new2/openatv2/build-enviroment/builds/openatv/release/cube/tmp/sysroots/"
71        export TOOLCHAIN_NAME="arm-oe-linux-gnueabi"
72        export PATH=$BASE_PATH"i686-linux/usr/bin/arm-oe-linux-gnueabi/":$PATH
73        export SYSROOT=$BASE_PATH"cube"
74        CFLAGS=" -mfloat-abi=softfp -mtune=cortex-a9 -mfpu=vfpv3-d16 "
75        ;;
76    *)
77        usage
78        exit 1
79esac
80
81CFLAGS="$CFLAGS -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE "
82
83export CROSS_COMPILE=$TOOLCHAIN_NAME"-"
84
85SOURCE_FILES="main/exteplayer.c"
86SOURCE_FILES+=" container/container.c"
87SOURCE_FILES+=" container/container_ffmpeg.c"
88SOURCE_FILES+=" manager/manager.c"
89SOURCE_FILES+=" manager/audio.c"
90SOURCE_FILES+=" manager/video.c"
91SOURCE_FILES+=" manager/subtitle.c"
92SOURCE_FILES+=" output/linuxdvb_mipsel.c"
93SOURCE_FILES+=" output/output_subtitle.c"
94SOURCE_FILES+=" output/output.c"
95
96SOURCE_FILES+=" output/writer/mipsel/writer.c"
97SOURCE_FILES+=" output/writer/common/pes.c"
98SOURCE_FILES+=" output/writer/common/misc.c"
99
100SOURCE_FILES+=" output/writer/mipsel/aac.c" 
101SOURCE_FILES+=" output/writer/mipsel/ac3.c" 
102SOURCE_FILES+=" output/writer/mipsel/mp3.c" 
103SOURCE_FILES+=" output/writer/mipsel/pcm.c" 
104SOURCE_FILES+=" output/writer/mipsel/lpcm.c" 
105SOURCE_FILES+=" output/writer/mipsel/dts.c" 
106SOURCE_FILES+=" output/writer/mipsel/amr.c"
107SOURCE_FILES+=" output/writer/mipsel/wma.c"
108
109SOURCE_FILES+=" output/writer/mipsel/h265.c"
110SOURCE_FILES+=" output/writer/mipsel/h264.c"
111SOURCE_FILES+=" output/writer/mipsel/h263.c"
112SOURCE_FILES+=" output/writer/mipsel/mpeg2.c"
113SOURCE_FILES+=" output/writer/mipsel/mpeg4.c"
114SOURCE_FILES+=" output/writer/mipsel/divx3.c"
115SOURCE_FILES+=" output/writer/mipsel/vc1.c"
116SOURCE_FILES+=" output/writer/mipsel/vp.c"
117SOURCE_FILES+=" output/writer/mipsel/wmv.c"
118SOURCE_FILES+=" playback/playback.c"
119
120SOURCE_FILES+=" external/ffmpeg/src/bitstream.c"
121SOURCE_FILES+=" external/ffmpeg/src/latmenc.c"
122SOURCE_FILES+=" external/ffmpeg/src/mpeg4audio.c"
123CURR_PATH=$PWD
124
125EXTEPLAYER3_OUT_FILE=$CURR_PATH"/tmp/out/$EPLATFORM/exteplayer3_ffmpeg"$FFMPEG_VERSION
126
127function buildFFmpeg
128{
129    FFMPEG_VERSION=$1
130    FFMPEG_BASE_PATH=$CURR_PATH"/tmp/ffmpeg/"
131    mkdir -p $FFMPEG_BASE_PATH"tmp/$EPLATFORM/"
132    FFMPEG_PATH=$FFMPEG_BASE_PATH"tmp/$EPLATFORM/ffmpeg-"$FFMPEG_VERSION
133    FFMPEG_PATCHES_PATH=$FFMPEG_BASE_PATH"patches/"$FFMPEG_VERSION"/"
134   
135    SOURCE_URL="http://ffmpeg.org/releases/ffmpeg-"$FFMPEG_VERSION".tar.gz"
136    OUT_FILE=$FFMPEG_BASE_PATH"tmp/ffmpeg-"$FFMPEG_VERSION".tar.gz"
137   
138    echo "FFMPEG PATH: $FFMPEG_PATH"
139   
140    if [ "true" == "$2" ] || [ ! -d $FFMPEG_PATH ];
141    then
142        if [ -d $FFMPEG_PATH ] && [ "true" == "$3"  ];
143        then
144            rm -rf $FFMPEG_PATH
145        fi
146       
147        if [ ! -f $OUT_FILE ];
148        then
149            wget $SOURCE_URL -O $OUT_FILE
150        fi
151       
152        if [ ! -d $FFMPEG_PATH ];
153        then
154            tar -zxf $OUT_FILE -C $FFMPEG_BASE_PATH"tmp/$EPLATFORM/"
155           
156            if [ -d $FFMPEG_PATCHES_PATH ];
157            then
158                echo "Applay patches for ffmpeg version $FFMPEG_VERSION if any"
159                cd $FFMPEG_PATH
160                for i in "$FFMPEG_PATCHES_PATH"*.patch; do patch -p1 < $i; done
161                cd $CURR_PATH
162            fi
163        fi
164       
165        CONFIGURE_PATH=$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/configure_"$FFMPEG_VERSION".sh"
166       
167        $FFMPEG_BASE_PATH"/scripts_$EPLATFORM/make.sh" $FFMPEG_PATH $CONFIGURE_PATH $SYSROOT "$FFMPEG_CFLAGS" "$FFMPEG_LDFLAGS"
168    else
169        #CONFIGURE_PATH=$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/configure_"$FFMPEG_VERSION".sh"
170        #$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/make.sh" $FFMPEG_PATH $CONFIGURE_PATH $SYSROOT
171        echo "Skip ffmpeg build"
172    fi
173}
174
175# rebuild ffmpeg libs, force rebuild
176buildFFmpeg $FFMPEG_VERSION "true" "true"
177
178rm -rf $EXTEPLAYER3_OUT_FILE
179
180echo "FFMPEG_PATH = $FFMPEG_PATH"
181"$CROSS_COMPILE"gcc -Wimplicit-function-declaration -Wimplicit-int -fdata-sections -ffunction-sections -Wl,--gc-sections -Os $CFLAGS --sysroot=$SYSROOT $LDFLAGS $CPPFLAGS -I"$CURR_PATH"/include -I"$CURR_PATH"/external/ -I$FFMPEG_PATH/usr/include/ -L$FFMPEG_PATH/usr/lib/ $SOURCE_FILES -o $EXTEPLAYER3_OUT_FILE -Wfatal-errors -lpthread -lavformat -lavcodec -lavutil -lswresample
182"$CROSS_COMPILE"strip -s $EXTEPLAYER3_OUT_FILE
183
184#exit 0
185
186FFMPEG_PACK_TMP=tmp/ffmpeg/tmp/ffmpeg"$FFMPEG_VERSION"_$EPLATFORM
187rm -rf $FFMPEG_PACK_TMP
188mkdir $FFMPEG_PACK_TMP
189
190cp -R tmp/ffmpeg/tmp/$EPLATFORM/ffmpeg-"$FFMPEG_VERSION"/usr $FFMPEG_PACK_TMP"/usr"
191cd  $FFMPEG_PACK_TMP
192rm -Rf usr/include
193rm -Rf usr/share
194rm -Rf usr/lib/pk*
195echo ">>>>>>>>>>>>>>>>>>>>>>"
196tar -zcvf ../ffmpeg"$FFMPEG_VERSION"_$EPLATFORM.tar.gz usr
197
198   
Note: See TracBrowser for help on using the repository browser.