Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Creates an installable package containing H.264 and MP3 support libraries for Opera on Linux
#!/bin/sh
#
# Creates an installable package containing H.264 and MP3 support
# libraries for Opera on Linux
#
# Note: You will need a suitable development environment to run this
# script successfully. Make sure the following is installed before
# proceeding:
#
# * autoconf
# * automake
# * gcc
# * gcc-c++
# * libtool
# * make
# * nasm (or yasm)
# * pkg-config
# * the zlib development support files
FFMPEG_VERSION=${FFMPEG_VERSION-2.6.3}
available () {
command -v "$1" >/dev/null 2>&1
}
errormsg () {
echo "Make sure the following are installed before trying again: autoconf, automake, gcc, gcc-c++, libtool, make, nasm (or yasm), pkg-config and the zlib development support files." >&2
if available apt-get; then
echo "Issue the following command to install these packages:" >&2
echo " sudo apt-get install automake build-essential libtool pkg-config yasm zlib1g-dev" >&2
fi
exit 1
}
if available wget; then
FETCH=wget
elif available curl; then
FETCH='curl -O'
else
echo "Install wget or curl" >&2
exit 1
fi
ARCH=`uname -m`
case "$ARCH" in
x86_64) PATHARCH=x86_64;;
i?86) PATHARCH=i386;;
*) echo "The architecture $ARCH is not supported." >&2 ; exit 1 ;;
esac
set -e
cd /tmp
if ! [ -r "ffmpeg-${FFMPEG_VERSION}.tar.bz2" ]; then
$FETCH http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2
fi
if [ -d "ffmpeg-${FFMPEG_VERSION}" ]; then
rm -r ffmpeg-${FFMPEG_VERSION}
fi
tar fx ffmpeg-${FFMPEG_VERSION}.tar.bz2
cd ffmpeg-${FFMPEG_VERSION}
./configure \
--build-suffix=-opera \
--enable-shared \
--disable-programs \
--disable-doc \
--disable-debug \
--disable-encoders \
--prefix=/tmp/ffmpeg-${FFMPEG_VERSION}/opera || errormsg
make install
cd opera
tar fzvc /var/tmp/ffmpeg-${FFMPEG_VERSION}-opera-${ARCH}-binaries.tar.gz lib/*opera.so* --owner 0 --group 0 --format pax
cat <<EOM
Created: /var/tmp/ffmpeg-${FFMPEG_VERSION}-opera-${ARCH}-binaries.tar.gz
To install issue the following as root or with sudo, adjusting the *Install* path as needed (see opera://about):
tar fx /var/tmp/ffmpeg-${FFMPEG_VERSION}-opera-${ARCH}-binaries.tar.gz -C /usr/lib/${PATHARCH}-linux-gnu/opera
Now restart Opera and you should have working H.264 and MP3 support.
EOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment