#!/bin/sh #script by kingdomcome modified by jls_legalize . /etc/init.d/tc-functions checkroot export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe -fno-asynchronous-unwind-tables" export LDFLAGS="-Wl,-O1" TODAY=`date +%Y/%m/%d` PACKAGE="ffmpeg-0.11" MIRROR="http://ffmpeg.org/releases/" SEP="-" VERSION="0.11.1" AVCODECV=54 AVDEVICEV=54 AVFILTERV=2 AVFORMATV=54 #AVRESAMPLEV=0 AVUTILV=51 POSTPROCV=52 SWRESAMPLEV=0 SWSCALEV=2 DESCRIPTION="a complete, cross-platform solution to record, convert and stream audio and video" AVCODECDESC="ffmpeg codec library" AVDEVICEDESC="ffmpeg device handling library" AVFILTERDESC="ffmpeg video filtering library" AVFORMATDESC="ffmpeg file format library" #AVRESAMPLEDESC="FFmpeg audio conversion library" AVUTILDESC="ffmpeg utility library" POSTPROCDESC="ffmpeg video postprocessing library" SWRESAMPLEDESC="FFmpeg audio rescaling library" SWSCALEDESC="FFmpeg video scaling library" TAGS="Record, convert stream audio video" AUTHORS="Fabrice Bellard" HOMEPAGE="http://ffmpeg.org/" LICENSE="GNU Lesser General Public License version 2.1" ME="jls_legalize (jlslegalize at gmail dot com)" DEPS="" AFTERDEPS="libavdevice$AVDEVICEV.tcz \ libswscale$SWSCALEV.tcz" BUILDDEPS="libvorbis-dev.tcz \ gnutls2-dev.tcz \ libvpx-dev.tcz \ xvid-dev.tcz \ xvid.tcz \ libopenal-dev.tcz \ openssl-1.0.0-dev.tcz \ x264-dev.tcz \ x264-124.tcz \ speex-dev.tcz \ rtmpdump-dev.tcz \ openjpeg-dev.tcz \ libvpx-dev.tcz \ libvorbis-dev.tcz \ libvdpau-dev.tcz \ libva.tcz \ libtheora-dev.tcz \ libdc1394-dev.tcz \ lame-dev.tcz \ lame.tcz \ freetype_base-dev.tcz \ bzip2-dev.tcz \ libschroedinger-dev.tcz \ SDL-dev.tcz \ SDL.tcz \ libvdpau-dev.tcz \ frei0r.tcz \ faac-dev.tcz \ faac.tcz \ libgsm-dev.tcz \ libmodplug-dev.tcz \ libmodplug.tcz \ libass-dev.tcz \ libass.tcz \ opencv.tcz \ libcdio-dev.tcz \ libcdio.tcz \ celt-dev.tcz \ libv4l-dev.tcz \ yasm-dev.tcz \ yasm.tcz \ mktemp.tcz" #pulseaudio-dev.tcz \ AVCODECDEPS="libavutil$AVUTILV.tcz \ libva.tcz \ xvid.tcz \ libvpx.tcz \ libvorbis.tcz \ libtheora.tcz \ speex.tcz \ libschroedinger.tcz \ libogg.tcz \ liborc.tcz \ x264-124.tcz \ lame.tcz \ faac.tcz \ openjpeg.tcz" AVDEVICEDEPS="libavfilter$AVFILTERV.tcz \ libcdio.tcz \ libasound.tcz \ SDL.tcz \ libdc1394.tcz \ libopenal.tcz \ libusb.tcz \ libpulseaudio.tcz \ libv4l.tcz" AVFILTERDEPS="libswresample$SWRESAMPLEV.tcz \ libavformat$AVFORMATV.tcz \ libpostproc$POSTPROCV.tcz libswscale$SWSCALEV.tcz" #libavresample$AVRESAMPLEV.tcz" AVFORMATDEPS="libavcodec$AVCODECV.tcz \ rtmpdump.tcz \ openssl-1.0.0.tcz \ bzip2-lib.tcz" #AVRESAMPLEDEPS="libavutil$AVUTILV.tcz" POSTPROCDEPS="libavutil$AVUTILV.tcz" SWRESAMPLEDEPS="libavutil$AVUTILV.tcz" SWSCALEDEPS="libavutil$AVUTILV.tcz" FLAGS="--disable-debug \ --enable-shared \ --enable-nonfree \ --enable-libfaac \ --enable-libmp3lame \ --enable-version3 \ --enable-gpl \ --enable-libxvid \ --enable-openal \ --enable-libopenjpeg \ --enable-librtmp \ --enable-libschroedinger \ --enable-libspeex \ --enable-libtheora \ --enable-libv4l2 \ --enable-vdpau \ --enable-frei0r \ --enable-libvpx \ --enable-libvorbis \ --enable-libdc1394 \ --enable-libcdio \ --enable-libx264 \ --enable-postproc" #--enable-libopencore-amrwb \ #--enable-libopencore-amrnb \ #--enable-x11grab \ #--enable-libpulse \ #--disable-yasm" #--prefix=/usr/local \ DOCS="" TCUSER=`cat /etc/sysconfig/tcuser` SRC="ffmpeg${SEP}${VERSION}.tar.bz2" THISDIR=`pwd` PKGDIR="${THISDIR}/${PACKAGE}" SRCDIR="${PKGDIR}/ffmpeg${SEP}${VERSION}" TCEDIR="/etc/sysconfig/tcedir" COPYING="LICENSE" #CURRENT="${TODAY} Updated to ${VERSION}, enabled x264, disabled pulseaudio" clean(){ rm -rf ${THISDIR}/${PACKAGE} } environment(){ for each in compiletc.tcz ${DEPS} ${BUILDDEPS}; do APPNAME=$(getbasefile "$each" 1) if [ ! -f /usr/local/tce.installed/"${APPNAME}" ]; then if [ ! -e ${TCEDIR}/optional/${each} ]; then sudo -u ${TCUSER} tce-load -w ${each} fi sudo -u ${TCUSER} tce-load -i ${TCEDIR}/optional/${each} fi done [ -e ${PKGDIR}/tmp ] || mkdir -p ${PKGDIR}/tmp cd ${PKGDIR} [ -e ${SRC} ] || (wget ${MIRROR}/${SRC} && tar xjf ${SRC}) } buildit(){ cd ${SRCDIR} make clean ./configure ${FLAGS} || exit 1 # echo -n "Press Enter key." # read gagme make || exit 1 make DESTDIR=${PKGDIR}/tmp install || exit 1 cp -a ${PKGDIR}/tmp ${PKGDIR}/tmp-copy } workit(){ splitit(){ mkdir -p ${PKGDIR}/$1/usr/local/lib mv ${PKGDIR}/tmp/usr/local/lib/$1* ${PKGDIR}/$1/usr/local/lib } cd ${PKGDIR}/tmp rm -rf ${DOCS} mkdir -p usr/local/share/doc/License cp "${SRCDIR}/${COPYING}" "usr/local/share/doc/License/${PACKAGE}.txt" find usr/ | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find usr/ | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null #dev for I in $(find `ls` -name *.h); do export DIR=`dirname "$I"`; [ -d ../dev/"$DIR" ] || mkdir -p ../dev/"$DIR"; mv "$I" ../dev/"$DIR"/; done for I in $(find `ls` -name *.a); do export DIR=`dirname "$I"`; [ -d ../dev/"$DIR" ] || mkdir -p ../dev/"$DIR"; mv "$I" ../dev/"$DIR"/; done for I in $(find `ls` -name *.la); do export DIR=`dirname "$I"`; [ -d ../dev/"$DIR" ] || mkdir -p ../dev/"$DIR"; mv "$I" ../dev/"$DIR"/; done for I in $(find `ls` -name *.pc); do export DIR=`dirname "$I"`; [ -d ../dev/"$DIR" ] || mkdir -p ../dev/"$DIR"; mv "$I" ../dev/"$DIR"/; done cd ../dev/usr/local/include rm -rf ${PKGDIR}/tmp/usr/local/include rm -rf ${PKGDIR}/tmp/usr/local/lib/pkgconfig splitit libavcodec splitit libavdevice splitit libavfilter splitit libavformat # splitit libavresample splitit libavutil splitit libpostproc splitit libswresample splitit libswscale rm -rf ${PKGDIR}/tmp/usr/local/lib } getinfo(){ cd ${PKGDIR} rm *.tcz.info getMirror busybox wget "$MIRROR/$PACKAGE.tcz.info" busybox wget "$MIRROR/$PACKAGE-dev.tcz.info" busybox wget "$MIRROR/libavcodec$AVCODECV.tcz.info" busybox wget "$MIRROR/libavdevice$AVDEVICEV.tcz.info" busybox wget "$MIRROR/libavfilter$AVFILTERV.tcz.info" busybox wget "$MIRROR/libavformat$AVFORMATV.tcz.info" # busybox wget "$MIRROR/libavresample$AVRESAMPLEV.tcz.info" busybox wget "$MIRROR/libavutil$AVUTILV.tcz.info" busybox wget "$MIRROR/libpostproc$POSTPROCV.tcz.info" busybox wget "$MIRROR/libswscale$SWSCALEV.tcz.info" busybox wget "$MIRROR/libswresample$SWRESAMPLEV.tcz.info" } packageit(){ packageone(){ [ -e ../$1.tcz.list ] && rm ../$1.tcz.list for dir in `ls -A`; do find ${dir} -not -type d | sort >> ../$1.tcz.list done [ -e ../$1.tcz ] && rm ../$1.tcz mksquashfs . ../$1.tcz cd ${PKGDIR} md5sum $1.tcz > $1.tcz.md5.txt [ -e $1.tcz.dep ] && rm $1.tcz.dep [ "$6" ] && for each in ${6}; do echo ${each} >> $1.tcz.dep; done size=`du -h $1.tcz | cut -f 1` if [ "$5" -eq "1" ] then cat < $1.tcz.info Title: $1.tcz Description: ${2} Version: ${3} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${4} Comments: ----------- Change-log: ----------------------------- Current: ${TODAY}$ First version {3} EOF else sed -i "s/Version:.*/Version: ${3}/" ${1}.tcz.info sed -i "s/Size:.*/Size: ${size}/" ${1}.tcz.info sed -i "s/Current:/ /" $1.tcz.info echo "Current: ${TODAY} Updated to $3" >> $1.tcz.info fi } if [ ! -f /usr/local/tce.installed/squashfs-tools-4.x ]; then if [ ! -e ${TCEDIR}/optional/squashfs-tools-4.x.tcz ]; then sudo -u ${TCUSER} tce-load -w squashfs-tools-4.x.tcz fi su ${TCUSER} -c "tce-load -is squashfs-tools-4.x.tcz" fi cd ${PKGDIR}/tmp packageone ${PACKAGE} "${DESCRIPTION}" ${VERSION} "${TAGS}" 0 "${DEPS} ${AFTERDEPS}" cd ${PKGDIR}/dev packageone ${PACKAGE}-dev "${DESCRIPTION} development files" ${VERSION} "${TAGS}" 0 "${BUILDDEPS}" cd ${PKGDIR}/libavcodec packageone libavcodec${AVCODECV} "${AVCODECDESC}" ${VERSION} "${AVCODECDESC}" 0 "${AVCODECDEPS}" cd ${PKGDIR}/libavdevice packageone libavdevice${AVDEVICEV} "${AVDEVICEDESC}" ${VERSION} "${AVDEVICEDESC}" 0 "${AVDEVICEDEPS}" cd ${PKGDIR}/libavfilter packageone libavfilter${AVFILTERV} "${AVFILTERDESC}" ${VERSION} "${AVFILTERDESC}" 0 "${AVFILTERDEPS}" cd ${PKGDIR}/libavformat packageone libavformat${AVFORMATV} "${AVFORMATDESC}" ${VERSION} "${AVFORMATDESC}" 0 "${AVFORMATDEPS}" # cd ${PKGDIR}/libavresample # packageone libavresample${AVRESAMPLEV} "${AVRESAMPLEDESC}" ${VERSION} "${AVRESAMPLEDESC}" 0 "${AVRESAMPLEDEPS}" cd ${PKGDIR}/libavutil packageone libavutil${AVUTILV} "${AVUTILDESC}" ${VERSION} "${AVUTILDESC}" 0 cd ${PKGDIR}/libpostproc packageone libpostproc${POSTPROCV} "${POSTPROCDESC}" ${VERSION} "${POSTPROCDESC}" 0 "${POSTPROCDEPS}" cd ${PKGDIR}/libswresample packageone libswresample${SWRESAMPLEV} "${SWRESAMPLEDESC}" ${VERSION} "${SWRESAMPLEDESC}" 0 "${SWRESAMPLEDEPS}" cd ${PKGDIR}/libswscale packageone libswscale${SWSCALEV} "${SWSCALEDESC}" ${VERSION} "${SWSCALEDESC}" 0 "${SWSCALEDEPS}" } checkit(){ sudo chown ${TCUSER}:staff ${THISDIR} cd ${PKGDIR} if [ ! -f /usr/local/tce.installed/submitqc4 ]; then if [ ! -e ${TCEDIR}/optional/submitqc4 ]; then sudo -u ${TCUSER} tce-load -w submitqc4 fi su ${TCUSER} -c "tce-load -is submitqc4" fi submitqc4 || exit 1 } tarit(){ cd ${PKGDIR} busybox cp ../${PACKAGE}.tcbuild . if [ ! -f /usr/local/tce.installed/xz ]; then if [ ! -e ${TCEDIR}/optional/xz ]; then sudo -u ${TCUSER} tce-load -w xz fi su ${TCUSER} -c "tce-load -is xz" fi [ -e ../${PACKAGE}.tar ] && rm ../${PACKAGE}.tar tar cvf ../${PACKAGE}$SEP$VERSION.tar \ ${PACKAGE}.tcz* \ ${PACKAGE}-dev.tcz* \ libavcodec$AVCODECV.tcz* \ libavdevice$AVDEVICEV.tcz* \ libavfilter$AVFILTERV.tcz* \ libavformat$AVFORMATV.tcz* \ libavutil$AVUTILV.tcz* \ libpostproc$POSTPROCV.tcz* \ libswresample$SWRESAMPLEV.tcz* \ libswscale$SWSCALEV.tcz* \ ${PACKAGE}.tcbuild \ ${SRC} # libavresample${AVRESAMPLEV}.tcz* \ cd ${THISDIR} [ -f ${PACKAGE}$SEP$VERSION.tar.xz ] && rm ${PACKAGE}$SEP$VERSION.tar.xz xz ${PACKAGE}$SEP$VERSION.tar } copy2tce(){ cd ${PKGDIR} busybox cp ${PACKAGE}.tcz* "${TCEDIR}"/optional busybox cp ${PACKAGE}-dev.tcz* "${TCEDIR}"/optional busybox cp libavcodec$AVCODECV.tcz* "${TCEDIR}"/optional busybox cp libavdevice$AVDEVICEV.tcz* "${TCEDIR}"/optional busybox cp libavfilter$AVFILTERV.tcz* "${TCEDIR}"/optional busybox cp libavformat$AVFORMATV.tcz* "${TCEDIR}"/optional busybox cp libavutil$AVUTILV.tcz* "${TCEDIR}"/optional busybox cp libpostproc$POSTPROCV.tcz* "${TCEDIR}"/optional busybox cp libswresample$SWRESAMPLEV.tcz* "${TCEDIR}"/optional busybox cp libswscale$SWSCALEV.tcz* "${TCEDIR}"/optional } #here we go #clean #environment ##echo -n "Next step buildit. Press Enter key." ##read gagme #buildit ##echo -n "Next step workit. Press Enter key." ##read gagme #workit ##echo -n "Next step getinfo. Press Enter key." ##read gagme getinfo #echo -n "Next step packageit. Press Enter key." #read gagme packageit echo -n "Next step checkit. Press Enter key." read gagme checkit echo -n "Next step copy2tce. Press Enter key." read gagme copy2tce tarit