Compiler GStreamer depuis les sources sous GNU/Linux

Date: 8/06/2009 | Catégories: Gstreamer,Open-source,Systeme | Tags: ,,,,

Edit: j'ai ajouté un script SHELL "qui fait tout pour vous" en fin de billet...

Voici une petite procédure pour compiler la dernière version du framework multimédia GStreamer tout en préservant la version installée depuis les dépôts officiels. La procédure a été validé sur une GNU/Linux Ubuntu 9.04 mais doit facilement être adaptable à d'autres distribution (pour une procèdure équivalente sous Mac OS X, vous pouvez lire ce billet).

GStreamer étant un framework, il se base sur de nombreuses librairies externes. Pour nous simplifier la tache, nous allons utiliser les dépôts pour l'installation de ces librairies:

sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse bison flex git

Ensuite on récupère les dernières versions disponibles de GStreamer et de ses plugins:

mkdir ~/src
cd ~/src
wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-0.10.13.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-0.10.8.tar.gz

On commence par la compilation de GStreamer (core). L'installation se fera dans le répertoire /opt/gstreamer/gstreamer-0.10.24:

tar zxvf gstreamer-0.10.25.tar.gz
cd gstreamer-0.10.25
./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

... puis les plugins "base":

tar zxvf gst-plugins-base-0.10.25.tar.gz
cd gst-plugins-base-0.10.25
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

... puis les plugins "good":

tar zxvf gst-plugins-good-0.10.17.tar.gz
cd gst-plugins-good-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

... puis les plugins "bad":

tar zxvf gst-plugins-bad-0.10.17.tar.gz
cd gst-plugins-bad-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

... les plugins "ugly":

tar zxvf gst-plugins-ugly-0.10.13.tar.gz
cd gst-plugins-ugly-0.10.13
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

... et enfin les plugins FFMPEG (streaming):

tar zxvf gst-ffmpeg-0.10.8.tar.gz
cd gst-ffmpeg-0.10.8
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..

Puis on créé un lien symbolique entre le répertoire /opt/gstreamer/current et /opt/gstreamer/gstreamer-0.10.25. Ce lien nous permet d'avoir plusieur version de GStreamer sur notre système.

sudo cp /opt/gstreamer/gstreamer-0.10.25/lib/gstreamer-0.10.25/* /opt/gstreamer/gstreamer-0.10.25/lib/

sudo ln -s /opt/gstreamer/gstreamer-0.10.25/lib /opt/gstreamer/current

On teste enfin l'installation:

/opt/gstreamer/gstreamer-0.10.25/bin/gst-inspect --gst-plugin-path=/opt/gstreamer/current

Pour les plus faineant, voici un script sheel automatisant ces quelques taches

[shell]
#!/bin/sh

# A simple script to get/compile/install GStreamer

# Nicolas Hennion - GPL

#

# Remarks: the version will be installed in the /opt/gstreamer folder

# Change this to the latest version

GST_CORE=0.10.25

GST_BASE=0.10.25

GST_GOOD=0.10.17

GST_BAD=0.10.17

GST_UGLY=0.10.13

GST_FFMPEG=0.10.8

# Do not edit under this line

sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse

sudo aptitude install bison flex git

if [ ! -e gstreamer-$GST_CORE.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$GST_CORE.tar.gz

fi

if [ ! -e gst-plugins-base-$GST_BASE.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-$GST_BASE.tar.gz

fi

if [ ! -e gst-plugins-good-$GST_GOOD.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-$GST_GOOD.tar.gz

fi

if [ ! -e gst-plugins-bad-$GST_BAD.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-$GST_BAD.tar.gz

fi

if [ ! -e gst-plugins-ugly-$GST_UGLY.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-$GST_UGLY.tar.gz

fi

if [ ! -e gst-ffmpeg-$GST_FFMPEG.tar.gz ]

then

wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-$GST_FFMPEG.tar.gz

fi

sudo mkdir /opt/gstreamer

if [ ! -e gstreamer-$GST_CORE ]

then

tar zxvf gstreamer-$GST_CORE.tar.gz

cd gstreamer-$GST_CORE

./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-base-$GST_BASE ]

then

tar zxvf gst-plugins-base-$GST_BASE.tar.gz

cd gst-plugins-base-$GST_BASE

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-good-$GST_GOOD ]

then

tar zxvf gst-plugins-good-$GST_GOOD.tar.gz

cd gst-plugins-good-$GST_GOOD

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-bad-$GST_BAD ]

then

tar zxvf gst-plugins-bad-$GST_BAD.tar.gz

cd gst-plugins-bad-$GST_BAD

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-plugins-ugly-$GST_UGLY ]

then

tar zxvf gst-plugins-ugly-$GST_UGLY.tar.gz

cd gst-plugins-ugly-$GST_UGLY

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

if [ ! -e gst-ffmpeg-$GST_FFMPEG ]

then

tar zxvf gst-ffmpeg-$GST_FFMPEG.tar.gz

cd gst-ffmpeg-$GST_FFMPEG

PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE

make

sudo make install

cd ..

fi

sudo cp /opt/gstreamer/gstreamer-$GST_CORE/lib/gstreamer-$GST_CORE/* /opt/gstreamer/gstreamer-$GST_CORE/lib/

sudo ln -s /opt/gstreamer/gstreamer-$GST_CORE/lib /opt/gstreamer/current

/opt/gstreamer/gstreamer-$GST_CORE/bin/gst-inspect --gst-plugin-path=/opt/gstreamer/current

[/shell]

Partager ce billet