From 21f40a9a2f055cc2c531db5c4a58c7bb95cdfcbc Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 9 Dec 2003 15:59:48 +0000 Subject: [PATCH] sandbox to get ffmpeg to play nicely in all cases Original commit message from CVS: sandbox to get ffmpeg to play nicely in all cases --- AUTHORS | 0 ChangeLog | 0 Makefile.am | 1 + NEWS | 0 README | 2 + autogen.sh | 103 +++++++++++++++++++++++++++++++++++++ configure.ac | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++ gst-libs/Makefile.am | 1 + m4/as-slurp-ffmpeg.m4 | 59 ++++++++++++++++++++++ 9 files changed, 303 insertions(+) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 gst-libs/Makefile.am create mode 100644 m4/as-slurp-ffmpeg.m4 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..07a1eb8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = gst-libs ext diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..7c36d59 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +This is a sandbox module to test if our build setup for external libraries +(for example FFmpeg) is sane. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..b0051d2 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +DIE=0 +package=gst-ffmpeg +srcfile=configure.ac + +# a quick cvs co if necessary to alleviate the pain - may remove this +# when developers get a clue ;) +if test ! -d common; +then + echo "+ getting common/ from cvs" + cvs co common +fi + +# ensure that we have the dirs we put ext libs in to appease automake +mkdir -p gst-libs/ext/ffmpeg/ffmpeg + +# source helper functions +if test ! -f common/gst-autogen.sh; +then + echo There is something wrong with your source tree. + echo You are missing common/gst-autogen.sh + exit 1 +fi +. common/gst-autogen.sh + +CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-plugin-builddir --enable-debug --enable-DEBUG' + +autogen_options $@ + +echo -n "+ check for build tools" +if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi +version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53 autoconf-2.52" \ + "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1 +version_check "automake" "$AUTOMAKE automake automake-1.7 automake-1.6 automake-1.5" \ + "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1 +version_check "libtoolize" "$LIBTOOLIZE libtoolize libtoolize14" \ + "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 4 0 || DIE=1 +version_check "pkg-config" "" \ + "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1 + +die_check $DIE + +autoconf_2_52d_check || DIE=1 +aclocal_check || DIE=1 +autoheader_check || DIE=1 + +die_check $DIE + +# if no arguments specified then this will be printed +if test -z "$*"; then + echo "+ checking for autogen.sh options" + echo " This autogen script will automatically run ./configure as:" + echo " ./configure $CONFIGURE_DEF_OPT" + echo " To pass any additional options, please specify them on the $0" + echo " command line." +fi + +toplevel_check $srcfile + +tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS" +tool_run "$libtoolize" "--copy --force" +tool_run "$autoheader" + +# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo +echo timestamp > stamp-h.in 2> /dev/null + +tool_run "$autoconf" +tool_run "$automake" "-a -c" + +# if enable exists, add an -enable option for each of the lines in that file +if test -f enable; then + for a in `cat enable`; do + CONFIGURE_FILE_OPT="--enable-$a" + done +fi + +# if disable exists, add an -disable option for each of the lines in that file +if test -f disable; then + for a in `cat disable`; do + CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a" + done +fi + +test -n "$NOCONFIGURE" && { + echo "+ skipping configure stage for package $package, as requested." + echo "+ autogen.sh done." + exit 0 +} + +echo "+ running configure ... " +test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT" +test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT" +test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT" +echo + +./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || { + echo " configure failed" + exit 1 +} + +echo "Now type 'make' to compile $package." diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..965b894 --- /dev/null +++ b/configure.ac @@ -0,0 +1,137 @@ +dnl autoconf configuration file for gst-plugins +AC_INIT +AC_CANONICAL_TARGET([]) + +dnl We disable static building for development, for time savings +dnl this goes before AS_LIBTOOL to appease autoconf +dnl *NOTE*: dnl this line before release, so release does static too +AM_DISABLE_STATIC + +dnl AM_MAINTAINER_MODE only provides the option to configure to enable it +AM_MAINTAINER_MODE + +dnl when going to/from release please set the nano (fourth number) right ! +dnl releases only do Wall, cvs and prerelease does Werror too +AS_VERSION(gst-ffmpeg, GST_FFMPEG_VERSION, 0, 7, 2, 1, GST_CVS="no", GST_CVS="yes") + +AM_INIT_AUTOMAKE($PACKAGE,$VERSION) + +dnl our libraries and install dirs use major.minor as a version +GST_MAJORMINOR=$GST_FFMPEG_VERSION_MAJOR.$GST_FFMPEG_VERSION_MINOR +AC_SUBST(GST_MAJORMINOR) + +dnl CURRENT, REVISION, AGE +dnl - library source changed -> increment REVISION +dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 +dnl - interfaces added -> increment AGE +dnl - interfaces removed -> AGE = 0 +AS_LIBTOOL(GST_FFMPEG, 1, 0, 0) + +AC_CONFIG_SRCDIR(configure.ac) +AM_CONFIG_HEADER(config.h) + +dnl Add parameters for aclocal +dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL) +ACLOCAL_FLAGS="-I m4 -I common/m4" +AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS) + +AC_PROG_CC +AM_PROG_CC_STDC +AS="${CC}" + +dnl decide on error flags +AS_COMPILER_FLAG(-Wall, GST_WALL="yes", GST_WALL="no") + +if test "x$GST_WALL" = "xyes"; then + GST_ERROR="$GST_ERROR -Wall" + + if test "x$GST_CVS" = "xyes"; then + AS_COMPILER_FLAG(-Werror,GST_ERROR="$GST_ERROR -Werror",GST_ERROR="$GST_ERROR") + GST_ERROR="$GST_ERROR -DG_DISABLE_DEPRECATED" + fi +fi + +AC_HEADER_STDC([]) + + +dnl check for gstreamer; uninstalled is selected preferentially -- see pkg-config(1) +PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_FFMPEG_VERSION_MAJOR.$GST_FFMPEG_VERSION_MINOR.$GST_FFMPEG_VERSION_MICRO, + HAVE_GST="yes", HAVE_GST="no") + +if test "x$HAVE_GST" = "xno"; then + AC_MSG_ERROR(no GStreamer found) +fi + +dnl ============================= gst plug-ins ================================ + +plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" +AC_SUBST(plugindir) + +GST_PLUGIN_LDFLAGS='-module -avoid-version' +AC_SUBST(GST_PLUGIN_LDFLAGS) + +dnl *** FFMPEG *** +translit(dnm, m, l) AM_CONDITIONAL(USE_FFMPEG, true) +GST_CHECK_FEATURE(FFMPEG, [ffmpeg plug-ins], ffmpeg, [ + # only slurp in the case where we are in CVS mode; + # prerelease and release should get it disted + if test "x$GST_PLUGINS_VERSION_NANO" = x1; then + AC_MSG_NOTICE(slurping FFmpeg CVS source) + AS_SLURP_FFMPEG(gst-libs/ext/ffmpeg, 2003-10-26 10:00 GMT, + HAVE_FFMPEG=yes, HAVE_FFMPEG=no) + else + AC_MSG_NOTICE(FFmpeg CVS code should be included already) + HAVE_FFMPEG=yes + fi + # we only bother with uninstalled (included) ffmpeg for now + AC_DEFINE_UNQUOTED(HAVE_FFMPEG_UNINSTALLED, 1, + [defined if we use uninstalled ffmpeg]) +]) + +dnl Determine CPU +case "x${target_cpu}" in + xi?86 | k?) HAVE_CPU_I386=yes + AC_DEFINE(HAVE_CPU_I386, 1, [Define if the target CPU is an x86]) + dnl FIXME could use some better detection + dnl (ie CPUID) + case "x${target_cpu}" in + xi386 | xi486) ;; + *) AC_DEFINE(HAVE_RDTSC, 1, [Define if RDTSC is available]) ;; + esac ;; + xpowerpc) HAVE_CPU_PPC=yes + AC_DEFINE(HAVE_CPU_PPC, 1, [Define if the target CPU is a PPC]) ;; xalpha) HAVE_CPU_ALPHA=yes + AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the target CPU is an Alpha]) ;; + xarm*) HAVE_CPU_ARM=yes + AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the target CPU is an ARM]) ;; + xsparc*) HAVE_CPU_SPARC=yes + AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the target CPU is a PPC]) ;; + + xmips*) HAVE_CPU_MIPS=yes + AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the target CPU is a MIPS]) ;; + xhppa*) HAVE_CPU_HPPA=yes + AC_DEFINE(HAVE_CPU_HPPA, 1, [Define if the target CPU is a HPPA]) ;; +esac + +AM_CONDITIONAL(HAVE_CPU_I386, test "x$HAVE_CPU_I386" = "xyes") +AM_CONDITIONAL(HAVE_CPU_PPC, test "x$HAVE_CPU_PPC" = "xyes") +AM_CONDITIONAL(HAVE_CPU_ALPHA, test "x$HAVE_CPU_ALPHA" = "xyes") +AM_CONDITIONAL(HAVE_CPU_ARM, test "x$HAVE_CPU_ARM" = "xyes") +AM_CONDITIONAL(HAVE_CPU_SPARC, test "x$HAVE_CPU_SPARC" = "xyes") + + +dnl ########################### +dnl # Configure external libs # +dnl ########################### +if test "x$HAVE_FFMPEG" = xyes; then + AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg/ffmpeg) +fi + +AC_CONFIG_FILES( +Makefile +ext/Makefile +ext/ffmpeg/Makefile +gst-libs/Makefile +gst-libs/ext/Makefile +gst-libs/ext/ffmpeg/Makefile +) +AC_OUTPUT diff --git a/gst-libs/Makefile.am b/gst-libs/Makefile.am new file mode 100644 index 0000000..f7b5f98 --- /dev/null +++ b/gst-libs/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = ext diff --git a/m4/as-slurp-ffmpeg.m4 b/m4/as-slurp-ffmpeg.m4 new file mode 100644 index 0000000..0df909c --- /dev/null +++ b/m4/as-slurp-ffmpeg.m4 @@ -0,0 +1,59 @@ +dnl slurp-ffmpeg.m4 0.1.1 +dnl a macro to slurp in ffmpeg's cvs source inside a project tree +dnl taken from Autostar Sandbox, http://autostars.sourceforge.net/ + +dnl Usage: +dnl AS_SLURP_FFMPEG(DIRECTORY, DATE, [ACTION-IF-WORKED [, ACTION-IF-NOT-WORKED]]]) +dnl +dnl Example: +dnl AM_PATH_FFMPEG(lib/ffmpeg, 2002-12-14 12:00 GMT) +dnl +dnl make sure you have a Tag file in the dir where you check out that +dnl is the Tag of CVS you want to have checked out +dnl it should correspond to the DATE argument you supply, ie resolve to +dnl the same date +dnl (in an ideal world, cvs would understand it's own Tag file format as +dnl a date spec) + +AC_DEFUN(AS_SLURP_FFMPEG, +[ + # save original dir + FAILED="" + DIRECTORY=`pwd` + # get/update cvs + if test ! -d $1; then mkdir -p $1; fi + dnl we need to check $srcdir/$1 or it will always checkout ffmpeg even if it is there + dnl at least when top_srcdir != top_builddir. + dnl FIXME: unfortunately this makes the checkout go into top_srcdir + cd $srcdir/$1 + + if test ! -e ffmpeg/README; then + # check out cvs code + AC_MSG_NOTICE(checking out ffmpeg cvs code from $2 into $1) + cvs -Q -z4 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -D '$2' ffmpeg || FAILED=yes + else + # compare against Tag file and see if it needs updating + if test "`cat Tag`" == "$2"; then + AC_MSG_NOTICE(ffmpeg cvs code in sync) + else + cd ffmpeg + AC_MSG_NOTICE(updating ffmpeg cvs code to $2) + cvs -Q -z4 update -dP -D '$2' || FAILED=yes + cd .. + fi + fi + if test "x$FAILED" != "xyes"; then + echo "$2" > Tag + fi + + # now go back + cd $DIRECTORY + + if test "x$FAILED" == "xyes"; then + [$4] + false + else + [$3] + true + fi +]) -- 2.7.4