Please keep in mind this post is from 2013 and may no longer be valid.
We are going to compile libcec on a Raspberry Pi with Raspbian.
Install the necessary tools for compiling:
apt-get install build-essential autoconf liblockdev1-dev libudev-dev git libtool pkg-config
Clone the git repository:
git clone git://github.com/Pulse-Eight/libcec.git
cd libcec ./bootstrap ./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi make make install
Link the libraries so that cec-client can find them:
Check that cec-client have found the device by running:
cec-client -l Found devices: 1 device: 1 com port: RPI vendor id: 2708 product id: 1001 firmware version: 1 type: Raspberry Pi
To send commands to for instance a connected TV:
echo "standby 0" | cec-client -s