Browse code

prettify lib* version number extraction

Originally committed as revision 12128 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2008/02/17 09:00:10
Showing 1 changed files
... ...
@@ -2002,14 +2002,18 @@ if enabled texi2html; then
2002 2002
     echo "BUILD_DOC=yes" >> config.mak
2003 2003
 fi
2004 2004
 
2005
-sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
2006
-pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
2007
-lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
2008
-lavd_version=`grep '#define LIBAVDEVICE_VERSION ' "$source_path/libavdevice/avdevice.h" | sed 's/[^0-9\.]//g'`
2009
-lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
2010
-lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
2011
-
2012
-
2005
+get_version(){
2006
+    name=$1
2007
+    file=$source_path/$2
2008
+    grep "#define ${name}_VERSION " "$file" | sed 's/[^0-9\.]//g'
2009
+}
2010
+
2011
+sws_version=$(get_version  LIBSWSCALE  libswscale/swscale.h)
2012
+pp_version=$(get_version   LIBPOSTPROC libpostproc/postprocess.h)
2013
+lavc_version=$(get_version LIBAVCODEC  libavcodec/avcodec.h)
2014
+lavd_version=$(get_version LIBAVDEVICE libavdevice/avdevice.h)
2015
+lavf_version=$(get_version LIBAVFORMAT libavformat/avformat.h)
2016
+lavu_version=$(get_version LIBAVUTIL   libavutil/avutil.h)
2013 2017
 
2014 2018
 if enabled shared; then
2015 2019
     echo "BUILD_SHARED=yes" >> config.mak