2009-03-30 17:10:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Tvheadend configure shared functions
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005-2008 Andreas Öman
|
|
|
|
#
|
|
|
|
# Based on FFmpeg's configure script:
|
|
|
|
#
|
|
|
|
# Copyright (c) 2000-2002 Fabrice Bellard
|
|
|
|
# Copyright (c) 2005-2008 Diego Biurrun
|
|
|
|
# Copyright (c) 2005-2008 Mans Rullgard
|
|
|
|
#
|
|
|
|
|
|
|
|
TOPDIR=`pwd`
|
|
|
|
TMPDIR=${TOPDIR}/tmp
|
|
|
|
BUILDDIR=build.${PLATFORM}
|
|
|
|
DEFAULT_THEME="new"
|
|
|
|
RELEASE=no
|
|
|
|
|
|
|
|
RELEASENAME=`head -n1 ${TOPDIR}/ChangeLog | awk '{print $2}' | sed s/\(// | sed s/\)//`
|
|
|
|
|
|
|
|
CONFIG_LIST="
|
|
|
|
cwc
|
|
|
|
"
|
|
|
|
|
|
|
|
die() {
|
|
|
|
rm -rf $TMPDIR
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
set_all(){
|
|
|
|
value=$1
|
|
|
|
shift
|
|
|
|
for var in $*; do
|
|
|
|
eval $var=$value
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
enable(){
|
|
|
|
set_all yes $*
|
|
|
|
}
|
|
|
|
|
|
|
|
disable(){
|
|
|
|
set_all no $*
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enabled(){
|
|
|
|
test "${1#!}" = "$1" && op== || op=!=
|
|
|
|
eval test "x\$${1#!}" $op "xyes"
|
|
|
|
}
|
|
|
|
|
|
|
|
disabled(){
|
|
|
|
test "${1#!}" = "$1" && op== || op=!=
|
|
|
|
eval test "x\$${1#!}" $op "xno"
|
|
|
|
}
|
|
|
|
|
|
|
|
toupper(){
|
|
|
|
echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
|
|
}
|
|
|
|
|
|
|
|
print_config(){
|
|
|
|
pfx=$1
|
|
|
|
header=$2
|
|
|
|
makefile=$3
|
|
|
|
shift 3
|
|
|
|
for cfg; do
|
|
|
|
ucname="`toupper $cfg`"
|
|
|
|
if enabled $cfg; then
|
|
|
|
echo "#define ${pfx}${ucname} 1" >> $header
|
|
|
|
echo "#define ENABLE_${ucname} 1" >> $header
|
|
|
|
echo "${pfx}${ucname}=yes" >> $makefile
|
|
|
|
else
|
|
|
|
echo "#define ENABLE_${ucname} 0" >> $header
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup_env(){
|
|
|
|
# Create the dir for local libs, and get rid of any relative path
|
|
|
|
|
|
|
|
mkdir -p ${BUILDDIR}
|
|
|
|
BUILDDIR=`cd ${BUILDDIR} && pwd`
|
|
|
|
|
|
|
|
CONFIG_H=${BUILDDIR}/config.h
|
|
|
|
CONFIG_MAK=${BUILDDIR}/config.mak
|
|
|
|
CONFIG_DEF=${TOPDIR}/config.default
|
|
|
|
|
|
|
|
mkdir -p ${BUILDDIR}
|
|
|
|
|
|
|
|
# Create a tmpdir used during configure
|
|
|
|
mkdir -p ${TMPDIR}
|
|
|
|
TMPDIR=`cd ${TMPDIR} && pwd`
|
|
|
|
|
|
|
|
# Create config.mak
|
|
|
|
|
|
|
|
cat > ${CONFIG_MAK} << EOF
|
|
|
|
# Automatically generated by configure, do not edit
|
|
|
|
TOPDIR=$TOPDIR
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Create config.h
|
|
|
|
|
|
|
|
cat > ${CONFIG_H} << EOF
|
|
|
|
/* Automatically generated by configure, do not edit */
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Create config.default
|
|
|
|
|
|
|
|
cat > ${CONFIG_DEF} << EOF
|
|
|
|
# Automatically generated by configure, do not edit
|
|
|
|
PLATFORM ?= $PLATFORM
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setup_ffmpeg() {
|
|
|
|
echo "Configuring FFmpeg"
|
|
|
|
mkdir -p ${BUILDDIR}/ffmpeg/build
|
|
|
|
rm -rf ${BUILDDIR}/ffmpeg/install
|
|
|
|
|
|
|
|
(cd ${BUILDDIR}/ffmpeg/build && \
|
|
|
|
${TOPDIR}/ext/ffmpeg/configure \
|
|
|
|
$CC_FFMPEG \
|
|
|
|
--disable-encoders \
|
|
|
|
--enable-encoder=mp2 \
|
|
|
|
--enable-encoder=mpeg2video \
|
|
|
|
--disable-muxers \
|
|
|
|
--enable-muxer=matroska \
|
|
|
|
--disable-decoders \
|
|
|
|
--enable-decoder=mp2 \
|
|
|
|
--enable-decoder=mp3 \
|
|
|
|
--enable-decoder=mpeg2video \
|
|
|
|
--enable-decoder=h264 \
|
|
|
|
--enable-decoder=ac3 \
|
|
|
|
--disable-demuxers \
|
|
|
|
--disable-filters \
|
|
|
|
--disable-devices \
|
|
|
|
--disable-stripping \
|
|
|
|
--enable-static \
|
|
|
|
--disable-shared \
|
|
|
|
--enable-pthreads \
|
|
|
|
--prefix=${BUILDDIR}/ffmpeg/install \
|
|
|
|
--disable-ffserver \
|
|
|
|
--disable-ffmpeg \
|
|
|
|
--disable-ffplay \
|
|
|
|
$@
|
|
|
|
)
|
|
|
|
|
|
|
|
cat >> ${CONFIG_MAK} << EOF
|
|
|
|
CFLAGS_cfg += -I${BUILDDIR}/ffmpeg/install/include
|
|
|
|
LDFLAGS_cfg += -L${BUILDDIR}/ffmpeg/install/lib
|
|
|
|
LDFLAGS_cfg += -lavformat -lavcodec -lavutil
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finalize() {
|
|
|
|
|
|
|
|
if [ ${RELEASE} = yes ]; then
|
|
|
|
echo Release build: ${RELEASENAME}
|
|
|
|
echo >>${CONFIG_H} "#define TVHEADEND_RELEASE_TAG \"${RELEASENAME}\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cat >> ${CONFIG_MAK} << EOF
|
|
|
|
OSENV=${OSENV}
|
2009-05-25 19:37:03 +00:00
|
|
|
LDFLAGS_cfg += -lm
|
2009-03-30 17:10:22 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
print_config CONFIG_ ${CONFIG_H} ${CONFIG_MAK} $CONFIG_LIST
|
|
|
|
|
|
|
|
echo "Final binary is: build.${PLATFORM}/tvheadend"
|
|
|
|
|
|
|
|
die
|
|
|
|
}
|