source: titan/libeplayer3/makeSH4.sh @ 42227

Last change on this file since 42227 was 39688, checked in by obi, 6 years ago

add extplayer3

File size: 5.5 KB
Line 
1#!/bin/bash
2
3set -e
4
5function usage {
6   echo "Usage:"
7   echo "$0 platform ffmpeg_ver"
8   echo "platform:       sh4 | sh4_new"
9   echo "ffmpeg_ver:     1.0.10 | 1.1.16 | 1.2.12 | 2.0.7 | 2.2.16 | 2.5.11 | 2.6.9 | 2.7.7 | 2.8.7 | 3.0.2 | 3.1.1 "
10   exit 1
11}
12
13if [ "$#" -ne 2 ];
14then
15    usage
16fi
17
18EPLATFORM=$1
19
20if [ "$EPLATFORM" != "sh4" -a "$EPLATFORM" != "sh4_new" ];
21then
22    echo "Please give supported platform (sh4|sh4_new) version!"
23    usage
24fi
25
26FFMPEG_VERSION=""
27ffmpegVersionArray=( "1.0.10" "1.1.16" "1.2.12" "2.0.7" "2.2.16" "2.5.11" "2.6.9" "2.7.7" "2.8.7" "3.0.2" "3.1.1" )
28for i in "${ffmpegVersionArray[@]}"
29do
30    if [ "$i" == "$2" ];
31    then
32        FFMPEG_VERSION=$2
33        break
34    fi
35done
36
37if [ "$FFMPEG_VERSION" == "" ];
38then
39    echo "Please give supported ffmpeg (1.0.10 | 1.1.16 | 1.2.12 | 2.0.7  | 2.2.16 | 2.5.11 | 2.6.9 | 2.7.7 | 2.8.7 | 3.0.2 | 3.1.1) version!"
40    usage
41fi
42
43case "$EPLATFORM" in
44    sh4)
45        BASE_PATH="/home/sulge/e2/tdt/tdt/tufsbox/"
46        export TOOLCHAIN_NAME="sh4-linux"
47        export PATH=$BASE_PATH"devkit/sh4/bin/":$PATH
48        export SYSROOT=""
49        CFLAGS=" -I$BASE_PATH/cdkroot/ -L$BASE_PATH/cdkroot/ "
50        LDFLAGS=" -L$BASE_PATH/cdkroot/ -L$BASE_PATH/cdkroot/ "
51       
52        OPENSSL_VER="openssl-1.0.2g"
53        OPENSSL_PATH="/mnt/new2/new_openssl_sh4/$OPENSSL_VER"
54       
55        FFMPEG_CFLAGS=" -I$BASE_PATH/cdkroot/ -I$OPENSSL_PATH/include "
56        FFMPEG_LDFLAGS=" -I$BASE_PATH/cdkroot/ -L$OPENSSL_PATH "
57        ;;
58    sh4_new)
59        BASE_PATH="/mnt/new2/openatv/build-enviroment/builds/openatv/spark/tmp/sysroots/"
60        export TOOLCHAIN_NAME="sh4-oe-linux"
61        export PATH=$BASE_PATH"i686-linux/usr/bin/sh4-oe-linux/":$PATH
62        export SYSROOT=$BASE_PATH"spark"
63        CFLAGS="  "
64        FFMPEG_CFLAGS="  "
65        ;;
66    *)
67        usage
68        exit 1
69esac
70
71CFLAGS="$CFLAGS -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE "
72
73export CROSS_COMPILE=$TOOLCHAIN_NAME"-"
74
75SOURCE_FILES="main/exteplayer.c"
76SOURCE_FILES+=" container/container.c"
77SOURCE_FILES+=" container/container_ffmpeg.c"
78SOURCE_FILES+=" manager/manager.c"
79SOURCE_FILES+=" manager/audio.c"
80SOURCE_FILES+=" manager/video.c"
81SOURCE_FILES+=" manager/subtitle.c"
82SOURCE_FILES+=" output/linuxdvb_sh4.c"
83SOURCE_FILES+=" output/output_subtitle.c"
84SOURCE_FILES+=" output/output.c"
85
86SOURCE_FILES+=" output/writer/common/pes.c"
87SOURCE_FILES+=" output/writer/common/misc.c"
88
89SOURCE_FILES+=" output/writer/sh4/writer.c"
90SOURCE_FILES+=" output/writer/sh4/aac.c"
91SOURCE_FILES+=" output/writer/sh4/ac3.c"
92#SOURCE_FILES+=" output/writer/sh4/divx.c"
93SOURCE_FILES+=" output/writer/sh4/divx2.c"
94SOURCE_FILES+=" output/writer/sh4/dts.c"
95SOURCE_FILES+=" output/writer/sh4/h263.c"
96SOURCE_FILES+=" output/writer/sh4/h264.c"
97SOURCE_FILES+=" output/writer/sh4/mp3.c"
98SOURCE_FILES+=" output/writer/sh4/mpeg2.c"
99SOURCE_FILES+=" output/writer/sh4/pcm.c"
100SOURCE_FILES+=" output/writer/sh4/vc1.c"
101#SOURCE_FILES+=" output/writer/sh4/vorbis.c"
102SOURCE_FILES+=" output/writer/sh4/wma.c"
103SOURCE_FILES+=" output/writer/sh4/wmv.c"
104SOURCE_FILES+=" playback/playback.c"
105
106CURR_PATH=$PWD
107
108EXTEPLAYER3_OUT_FILE=$CURR_PATH"/tmp/out/$EPLATFORM/exteplayer3_ffmpeg"$FFMPEG_VERSION
109
110function buildFFmpeg
111{
112    FFMPEG_VERSION=$1
113    FFMPEG_BASE_PATH=$CURR_PATH"/tmp/ffmpeg/"
114    mkdir -p $FFMPEG_BASE_PATH"tmp/$EPLATFORM/"
115    FFMPEG_PATH=$FFMPEG_BASE_PATH"tmp/$EPLATFORM/ffmpeg-"$FFMPEG_VERSION
116   
117    SOURCE_URL="http://ffmpeg.org/releases/ffmpeg-"$FFMPEG_VERSION".tar.gz"
118    OUT_FILE=$FFMPEG_BASE_PATH"tmp/ffmpeg-"$FFMPEG_VERSION".tar.gz"
119   
120    if [ "true" == "$2" ] || [ ! -d $FFMPEG_PATH ];
121    then
122        if [ -d $FFMPEG_PATH ] && [ "true" == "$3"  ];
123        then
124            rm -rf $FFMPEG_PATH
125        fi
126       
127        if [ ! -f $OUT_FILE ];
128        then
129            wget $SOURCE_URL -O $OUT_FILE
130        fi
131       
132        if [ ! -d $FFMPEG_PATH ];
133        then
134            tar -zxf $OUT_FILE -C $FFMPEG_BASE_PATH"tmp/$EPLATFORM/"
135        fi
136       
137        CONFIGURE_PATH=$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/configure_"$FFMPEG_VERSION".sh"
138       
139        $FFMPEG_BASE_PATH"/scripts_$EPLATFORM/make.sh" $FFMPEG_PATH $CONFIGURE_PATH $SYSROOT "$FFMPEG_CFLAGS"
140    else
141        #CONFIGURE_PATH=$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/configure_"$FFMPEG_VERSION".sh"
142        #$FFMPEG_BASE_PATH"/scripts_$EPLATFORM/make.sh" $FFMPEG_PATH $CONFIGURE_PATH $SYSROOT
143        echo "Skip ffmpeg build"
144    fi
145}
146
147# rebuild ffmpeg libs, force rebuild
148buildFFmpeg $FFMPEG_VERSION "false" "false"
149
150rm -rf $EXTEPLAYER3_OUT_FILE
151
152echo "FFMPEG_PATH = $FFMPEG_PATH"
153if [ "$SYSROOT" != "" ];
154then
155    SYSROOT_VAR="--sysroot=$SYSROOT"
156else
157    SYSROOT_VAR=""
158fi
159"$CROSS_COMPILE"gcc -fdata-sections -ffunction-sections -Wl,--gc-sections -Os $CFLAGS $SYSROOT_VAR $LDFLAGS $CPPFLAGS -I"$CURR_PATH"/include  -I$FFMPEG_PATH/usr/include/ -L$FFMPEG_PATH/usr/lib/ $SOURCE_FILES -o $EXTEPLAYER3_OUT_FILE -Wfatal-errors -lpthread -lavformat -lavcodec -lavutil -lswresample
160"$CROSS_COMPILE"strip -s $EXTEPLAYER3_OUT_FILE
161
162exit 0
163
164FFMPEG_PACK_TMP=tmp/ffmpeg/tmp/ffmpeg"$FFMPEG_VERSION"_$EPLATFORM
165rm -rf $FFMPEG_PACK_TMP
166mkdir $FFMPEG_PACK_TMP
167
168cp -R tmp/ffmpeg/tmp/ffmpeg-"$FFMPEG_VERSION"/usr $FFMPEG_PACK_TMP"/usr"
169cd  $FFMPEG_PACK_TMP
170rm -Rf usr/include
171rm -Rf usr/share
172rm -Rf usr/lib/pk*
173echo ">>>>>>>>>>>>>>>>>>>>>>"
174tar -zcvf ../ffmpeg"$FFMPEG_VERSION"_$EPLATFORM.tar.gz usr
175
176   
Note: See TracBrowser for help on using the repository browser.