#!/bin/sh
## Builds ffmpeg on Ubuntu 9.10 with mp3 encoding support (libmp3lame)
## THERE IS NO WARRANTY FOR ANYTHING!
## Untested on other systems then mine!
## Please read the comments in this file, maybe you have to change
## something.
##     written 01/01/2010 by Raphael Michel <webmaster@raphaelmichel.de>

cd /usr/src
sudo apt-get build-dep ffmpeg
sudo apt-get source ffmpeg
sudo apt-get install libxvidcore4 libxvidcore-dev libmp3lame-dev fakeroot
     ## You may want to install more libs. You can!

cd ffmpeg-0.5+svn20090706/ ## maybe you got a newer version so you
                           ## have to change this (not expected with
                           ## karmic koala). if you're executing
                           ## this manually use the TAB key
                           ## You can see the current version string on:
                           ## http://packages.ubuntu.com/source/karmic/ffmpeg
export DEB_BUILD_OPTIONS=risky
sudo dpkg-buildpackage -rfakeroot -uc -b ## here you execute something
                ## as root. not good. you're also able to execute this
                ## with every user who has write permissions to /usr/src
cd ..
sudo dpkg -i lib*.deb ## i hope in your /usr/src aren't lib*.deb
                      ## files you don't want to install - otherwise
                      ## insert here every lib*.deb which wasn't there
                      ## before (see the creation date)
sudo dpkg -i ffmpeg*.deb ## i hope our compiled version is the only
                         ## ffmpeg binary in your /usr/src,
                         ## otherwise change this to the new .deb file

## if you want to create an archive with all needed *.deb files,
## uncomment one of the following lines. Maybe you have to change the
## versions in the filename (use search and replace in your editor)!
## on i386:
#tar -cf ffmpeg-withmp3.tar ffmpeg_0.5+svn20090706-2ubuntu2_i386.deb libavcodec52_0.5+svn20090706-2ubuntu2_i386.deb libavcodec-dev_0.5+svn20090706-2ubuntu2_i386.deb libavdevice52_0.5+svn20090706-2ubuntu2_i386.deb libavdevice-dev_0.5+svn20090706-2ubuntu2_i386.deb libavfilter0_0.5+svn20090706-2ubuntu2_i386.deb libavfilter-dev_0.5+svn20090706-2ubuntu2_i386.deb libavformat52_0.5+svn20090706-2ubuntu2_i386.deb libavformat-dev_0.5+svn20090706-2ubuntu2_i386.deb libavutil49_0.5+svn20090706-2ubuntu2_i386.deb libavutil-dev_0.5+svn20090706-2ubuntu2_i386.deb  libpostproc51_0.5+svn20090706-2ubuntu2_i386.deb libpostproc-dev_0.5+svn20090706-2ubuntu2_i386.deb libswscale0_0.5+svn20090706-2ubuntu2_i386.deb libswscale-dev_0.5+svn20090706-2ubuntu2_i386.deb
## on amd64:
#tar -cf ffmpeg-withmp3.tar ffmpeg_0.5+svn20090706-2ubuntu2_amd64.deb libavcodec52_0.5+svn20090706-2ubuntu2_amd64.deb libavcodec-dev_0.5+svn20090706-2ubuntu2_amd64.deb libavdevice52_0.5+svn20090706-2ubuntu2_amd64.deb libavdevice-dev_0.5+svn20090706-2ubuntu2_amd64.deb libavfilter0_0.5+svn20090706-2ubuntu2_amd64.deb libavfilter-dev_0.5+svn20090706-2ubuntu2_amd64.deb libavformat52_0.5+svn20090706-2ubuntu2_amd64.deb libavformat-dev_0.5+svn20090706-2ubuntu2_amd64.deb libavutil49_0.5+svn20090706-2ubuntu2_amd64.deb libavutil-dev_0.5+svn20090706-2ubuntu2_amd64.deb  libpostproc51_0.5+svn20090706-2ubuntu2_amd64.deb libpostproc-dev_0.5+svn20090706-2ubuntu2_amd64.deb libswscale0_0.5+svn20090706-2ubuntu2_amd64.deb libswscale-dev_0.5+svn20090706-2ubuntu2_amd64.deb

## Done! EOF.
