Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active April 28, 2017 19:51
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruario/49351d4a72e5c6c1ffb5 to your computer and use it in GitHub Desktop.
Save ruario/49351d4a72e5c6c1ffb5 to your computer and use it in GitHub Desktop.
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