From 9997e177ee70904810fa5018a8996bfd4cd9aaec Mon Sep 17 00:00:00 2001 From: David Spencer Date: Wed, 5 Jun 2013 19:45:02 -0400 Subject: academic/grass: Fixed build with recent ffmpeg + other tweaks. Signed-off-by: dsomero --- academic/grass/README | 12 +- academic/grass/gentoo392371b.patch | 60 --------- academic/grass/grass-6.4.1-libav-0.8.patch | 60 +++++++++ academic/grass/grass-6.4.2-configure-slack.patch | 161 +++++++++++++++++++++++ academic/grass/grass-6.4.2-ffmpeg-1.patch | 79 +++++++++++ academic/grass/grass-6.4.2-libav-9.patch | 11 ++ academic/grass/grass.SlackBuild | 17 ++- academic/grass/grass.info | 2 +- academic/grass/slack-desc | 10 +- 9 files changed, 336 insertions(+), 76 deletions(-) delete mode 100644 academic/grass/gentoo392371b.patch create mode 100644 academic/grass/grass-6.4.1-libav-0.8.patch create mode 100644 academic/grass/grass-6.4.2-configure-slack.patch create mode 100644 academic/grass/grass-6.4.2-ffmpeg-1.patch create mode 100644 academic/grass/grass-6.4.2-libav-9.patch (limited to 'academic') diff --git a/academic/grass/README b/academic/grass/README index 1ffc0aa334..98a86beefb 100644 --- a/academic/grass/README +++ b/academic/grass/README @@ -5,12 +5,18 @@ and visualization. GRASS is an official project of the Open Source Geospatial Foundation. The following optional dependencies may be enabled: - blas lapack geos ffmpeg mysql postgresql sqlite + blas, lapack for the GRASS gmath library + ffmpeg for the GRASS ogsf library and nviz animation + mysql for mysql (or mariadb) database support + postgresql for postgresql database support + sqlite for sqlite database support The options you require must be specified by setting the variable ENABLE before running grass.SlackBuild, for example ENABLE="sqlite,ffmpeg" ./grass.SlackBuild -If you need to make grass libraries available on the system, do this: -echo /opt/grass/lib >> /etc/ld.so.conf && ldconfig +If you need to make grass libraries available to other applications (e.g. +qgis) do this: + + echo /opt/grass/lib >> /etc/ld.so.conf && ldconfig diff --git a/academic/grass/gentoo392371b.patch b/academic/grass/gentoo392371b.patch deleted file mode 100644 index 4864d88da7..0000000000 --- a/academic/grass/gentoo392371b.patch +++ /dev/null @@ -1,60 +0,0 @@ -Adjust Grass 6.4.1 to work with ffmpeg 8. - -2011-11-17 Fabio Erculiani -2011-12-08 Martin von Gagern - -References: -https://bugs.gentoo.org/390827 -https://bugs.gentoo.org/392371 - ---- grass-6.4.1.orig/lib/ogsf/gsd_img_mpeg.c -+++ grass-6.4.1/lib/ogsf/gsd_img_mpeg.c -@@ -66,7 +66,7 @@ static AVStream *add_video_stream(AVForm - - c = st->codec; - c->codec_id = codec_id; -- c->codec_type = CODEC_TYPE_VIDEO; -+ c->codec_type = AVMEDIA_TYPE_VIDEO; - - /* put sample parameters */ - c->bit_rate = 400000; -@@ -215,7 +215,7 @@ static void write_video_frame(AVFormatCo - - av_init_packet(&pkt); - -- pkt.flags |= PKT_FLAG_KEY; -+ pkt.flags |= AV_PKT_FLAG_KEY; - pkt.stream_index = st->index; - pkt.data = (uint8_t *) picture; - pkt.size = sizeof(AVPicture); -@@ -236,7 +236,7 @@ static void write_video_frame(AVFormatCo - av_rescale_q(c->coded_frame->pts, c->time_base, - st->time_base); - if (c->coded_frame->key_frame) -- pkt.flags |= PKT_FLAG_KEY; -+ pkt.flags |= AV_PKT_FLAG_KEY; - pkt.stream_index = st->index; - pkt.data = video_outbuf; - pkt.size = out_size; -@@ -301,10 +301,10 @@ int gsd_init_mpeg(const char *filename) - av_register_all(); - - /* auto detect the output format from the name. default is mpeg. */ -- fmt = guess_format(NULL, filename, NULL); -+ fmt = av_guess_format(NULL, filename, NULL); - if (!fmt) { - G_warning(_("Unable to deduce output format from file extension: using MPEG")); -- fmt = guess_format("mpeg", NULL, NULL); -+ fmt = av_guess_format("mpeg", NULL, NULL); - } - if (!fmt) { - G_warning(_("Unable to find suitable output format")); -@@ -312,7 +312,7 @@ int gsd_init_mpeg(const char *filename) - } - - /* allocate the output media context */ -- oc = av_alloc_format_context(); -+ oc = av_malloc(sizeof(AVFormatContext)); - if (!oc) { - G_warning(_("Out of memory")); - return (-1); diff --git a/academic/grass/grass-6.4.1-libav-0.8.patch b/academic/grass/grass-6.4.1-libav-0.8.patch new file mode 100644 index 0000000000..4864d88da7 --- /dev/null +++ b/academic/grass/grass-6.4.1-libav-0.8.patch @@ -0,0 +1,60 @@ +Adjust Grass 6.4.1 to work with ffmpeg 8. + +2011-11-17 Fabio Erculiani +2011-12-08 Martin von Gagern + +References: +https://bugs.gentoo.org/390827 +https://bugs.gentoo.org/392371 + +--- grass-6.4.1.orig/lib/ogsf/gsd_img_mpeg.c ++++ grass-6.4.1/lib/ogsf/gsd_img_mpeg.c +@@ -66,7 +66,7 @@ static AVStream *add_video_stream(AVForm + + c = st->codec; + c->codec_id = codec_id; +- c->codec_type = CODEC_TYPE_VIDEO; ++ c->codec_type = AVMEDIA_TYPE_VIDEO; + + /* put sample parameters */ + c->bit_rate = 400000; +@@ -215,7 +215,7 @@ static void write_video_frame(AVFormatCo + + av_init_packet(&pkt); + +- pkt.flags |= PKT_FLAG_KEY; ++ pkt.flags |= AV_PKT_FLAG_KEY; + pkt.stream_index = st->index; + pkt.data = (uint8_t *) picture; + pkt.size = sizeof(AVPicture); +@@ -236,7 +236,7 @@ static void write_video_frame(AVFormatCo + av_rescale_q(c->coded_frame->pts, c->time_base, + st->time_base); + if (c->coded_frame->key_frame) +- pkt.flags |= PKT_FLAG_KEY; ++ pkt.flags |= AV_PKT_FLAG_KEY; + pkt.stream_index = st->index; + pkt.data = video_outbuf; + pkt.size = out_size; +@@ -301,10 +301,10 @@ int gsd_init_mpeg(const char *filename) + av_register_all(); + + /* auto detect the output format from the name. default is mpeg. */ +- fmt = guess_format(NULL, filename, NULL); ++ fmt = av_guess_format(NULL, filename, NULL); + if (!fmt) { + G_warning(_("Unable to deduce output format from file extension: using MPEG")); +- fmt = guess_format("mpeg", NULL, NULL); ++ fmt = av_guess_format("mpeg", NULL, NULL); + } + if (!fmt) { + G_warning(_("Unable to find suitable output format")); +@@ -312,7 +312,7 @@ int gsd_init_mpeg(const char *filename) + } + + /* allocate the output media context */ +- oc = av_alloc_format_context(); ++ oc = av_malloc(sizeof(AVFormatContext)); + if (!oc) { + G_warning(_("Out of memory")); + return (-1); diff --git a/academic/grass/grass-6.4.2-configure-slack.patch b/academic/grass/grass-6.4.2-configure-slack.patch new file mode 100644 index 0000000000..d3f37e97e1 --- /dev/null +++ b/academic/grass/grass-6.4.2-configure-slack.patch @@ -0,0 +1,161 @@ +diff -u -r grass-6.4.2.orig/configure grass-6.4.2.patched/configure +--- grass-6.4.2.orig/configure 2012-02-06 10:16:07.000000000 +0000 ++++ grass-6.4.2.patched/configure 2013-02-25 20:13:08.277158035 +0000 +@@ -10445,7 +10445,7 @@ + + ac_save_cppflags="$CPPFLAGS" + CPPFLAGS="$FFMPEGINCPATH $CPPFLAGS" +-for ac_hdr in avcodec.h ++for ac_hdr in libavcodec/avcodec.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +@@ -10489,7 +10489,7 @@ + + ac_save_cppflags="$CPPFLAGS" + CPPFLAGS="$FFMPEGINCPATH $CPPFLAGS" +-for ac_hdr in avformat.h ++for ac_hdr in libavformat/avformat.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +@@ -10533,7 +10533,7 @@ + + ac_save_cppflags="$CPPFLAGS" + CPPFLAGS="$FFMPEGINCPATH $CPPFLAGS" +-for ac_hdr in swscale.h ++for ac_hdr in libswscale/swscale.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +@@ -10712,9 +10712,9 @@ + + + +-echo $ac_n "checking for avcodec_init in -lavcodec""... $ac_c" 1>&6 +-echo "configure:10717: checking for avcodec_init in -lavcodec" >&5 +-ac_lib_var=`echo avcodec'_'avcodec_init | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for avcodec_open2 in -lavcodec""... $ac_c" 1>&6 ++echo "configure:10717: checking for avcodec_open2 in -lavcodec" >&5 ++ac_lib_var=`echo avcodec'_'avcodec_open2 | sed 'y%./+-%__p_%'` + + ac_save_LIBS="$LIBS" + LIBS="-lavcodec $FFMPEGLIB $LIBS" +@@ -10724,10 +10724,10 @@ + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +-char avcodec_init(); ++char avcodec_open2(); + + int main() { +-avcodec_init() ++avcodec_open2() + ; return 0; } + EOF + if { (eval echo configure:10734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +@@ -10748,9 +10748,9 @@ + else + echo "$ac_t""no" 1>&6 + +-echo $ac_n "checking for avcodec_init in -lavcodec""... $ac_c" 1>&6 +-echo "configure:10753: checking for avcodec_init in -lavcodec" >&5 +-ac_lib_var=`echo avcodec'_'avcodec_init | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for avcodec_open2 in -lavcodec""... $ac_c" 1>&6 ++echo "configure:10753: checking for avcodec_open2 in -lavcodec" >&5 ++ac_lib_var=`echo avcodec'_'avcodec_open2 | sed 'y%./+-%__p_%'` + + ac_save_LIBS="$LIBS" + LIBS="-lavcodec $FFMPEGLIB $MATHLIB $LIBS" +@@ -10760,10 +10760,10 @@ + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +-char avcodec_init(); ++char avcodec_open2(); + + int main() { +-avcodec_init() ++avcodec_open2() + ; return 0; } + EOF + if { (eval echo configure:10770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +@@ -10810,9 +10810,9 @@ + + + +-echo $ac_n "checking for av_set_parameters in -lavformat""... $ac_c" 1>&6 +-echo "configure:10815: checking for av_set_parameters in -lavformat" >&5 +-ac_lib_var=`echo avformat'_'av_set_parameters | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for av_write_frame in -lavformat""... $ac_c" 1>&6 ++echo "configure:10815: checking for av_write_frame in -lavformat" >&5 ++ac_lib_var=`echo avformat'_'av_write_frame | sed 'y%./+-%__p_%'` + + ac_save_LIBS="$LIBS" + LIBS="-lavformat $FFMPEGLIB $LIBS" +@@ -10822,10 +10822,10 @@ + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +-char av_set_parameters(); ++char av_write_frame(); + + int main() { +-av_set_parameters() ++av_write_frame() + ; return 0; } + EOF + if { (eval echo configure:10832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +@@ -10846,9 +10846,9 @@ + else + echo "$ac_t""no" 1>&6 + +-echo $ac_n "checking for av_set_parameters in -lavformat""... $ac_c" 1>&6 +-echo "configure:10851: checking for av_set_parameters in -lavformat" >&5 +-ac_lib_var=`echo avformat'_'av_set_parameters | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for av_write_frame in -lavformat""... $ac_c" 1>&6 ++echo "configure:10851: checking for av_write_frame in -lavformat" >&5 ++ac_lib_var=`echo avformat'_'av_write_frame | sed 'y%./+-%__p_%'` + + ac_save_LIBS="$LIBS" + LIBS="-lavformat $FFMPEGLIB $MATHLIB $LIBS" +@@ -10858,10 +10858,10 @@ + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +-char av_set_parameters(); ++char av_write_frame(); + + int main() { +-av_set_parameters() ++av_write_frame() + ; return 0; } + EOF + if { (eval echo configure:10868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +diff -u -r grass-6.4.2.orig/configure.in grass-6.4.2.patched/configure.in +--- grass-6.4.2.orig/configure.in 2012-02-06 10:16:07.000000000 +0000 ++++ grass-6.4.2.patched/configure.in 2013-02-25 20:45:48.025962482 +0000 +@@ -1110,9 +1110,9 @@ + + LOC_CHECK_INC_PATH(ffmpeg, FFMPEG, FFMPEGINCPATH) + +-LOC_CHECK_INCLUDES(avcodec.h,FFMPEG,$FFMPEGINCPATH) +-LOC_CHECK_INCLUDES(avformat.h,FFMPEG,$FFMPEGINCPATH) +-LOC_CHECK_INCLUDES(swscale.h,FFMPEG,$FFMPEGINCPATH) ++LOC_CHECK_INCLUDES(libavcodec/avcodec.h,FFMPEG,$FFMPEGINCPATH) ++LOC_CHECK_INCLUDES(libavformat/avformat.h,FFMPEG,$FFMPEGINCPATH) ++LOC_CHECK_INCLUDES(libswscale/swscale.h,FFMPEG,$FFMPEGINCPATH) + + AC_DEFINE(HAVE_FFMPEG) + +@@ -1125,8 +1125,8 @@ + LOC_CHECK_LIB_PATH(ffmpeg, FFMPEG, FFMPEGLIBPATH) + + LOC_CHECK_LIBS(avutil, av_free, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB,,,,$MATHLIB) +-LOC_CHECK_LIBS(avcodec, avcodec_init, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB, $FFMPEGLIB,,,$MATHLIB) +-LOC_CHECK_LIBS(avformat, av_set_parameters, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB, $FFMPEGLIB,,,$MATHLIB) ++LOC_CHECK_LIBS(avcodec, avcodec_open2, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB, $FFMPEGLIB,,,$MATHLIB) ++LOC_CHECK_LIBS(avformat, av_write_frame, FFMPEG, $FFMPEGLIBPATH, FFMPEGLIB, $FFMPEGLIB,,,$MATHLIB) + + fi # $USE_FFMPEG + diff --git a/academic/grass/grass-6.4.2-ffmpeg-1.patch b/academic/grass/grass-6.4.2-ffmpeg-1.patch new file mode 100644 index 0000000000..ec26ae2515 --- /dev/null +++ b/academic/grass/grass-6.4.2-ffmpeg-1.patch @@ -0,0 +1,79 @@ +Fix build with ffmpeg-1. +Part of https://bugs.gentoo.org/show_bug.cgi?id=443264 + +Index: grass-6.4.2/lib/ogsf/gsd_img_mpeg.c +=================================================================== +--- grass-6.4.2.orig/lib/ogsf/gsd_img_mpeg.c ++++ grass-6.4.2/lib/ogsf/gsd_img_mpeg.c +@@ -26,7 +26,8 @@ + + /* FFMPEG stuff */ + #ifdef HAVE_FFMPEG +-#include ++#include ++#include + + /* 5 seconds stream duration */ + #define STREAM_DURATION 5.0 +@@ -58,7 +59,7 @@ static AVStream *add_video_stream(AVForm + AVCodecContext *c; + AVStream *st; + +- st = av_new_stream(oc, 0); ++ st = avformat_new_stream(oc, 0); + if (!st) { + G_warning(_("Unable to allocate stream")); + return NULL; +@@ -97,7 +98,7 @@ static AVStream *add_video_stream(AVForm + c->flags |= CODEC_FLAG_GLOBAL_HEADER; + + c->flags |= CODEC_FLAG_QSCALE; +- c->global_quality = st->quality = FF_QP2LAMBDA * 10; ++ c->global_quality = FF_QP2LAMBDA * 10; + + return st; + } +@@ -332,13 +333,7 @@ int gsd_init_mpeg(const char *filename) + add_video_stream(oc, fmt->video_codec, (r - l + 1), (t - b + 1)); + } + +- /* set the output parameters (must be done even if no parameters). */ +- if (av_set_parameters(oc, NULL) < 0) { +- G_warning(_("Invalid output format parameters")); +- return (-1); +- } +- +- dump_format(oc, 0, filename, 1); ++ av_dump_format(oc, 0, filename, 1); + + /* now that all the parameters are set, we can open the audio and + video codecs and allocate the necessary encode buffers */ +@@ -347,14 +342,17 @@ int gsd_init_mpeg(const char *filename) + + /* open the output file, if needed */ + if (!(fmt->flags & AVFMT_NOFILE)) { +- if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) { ++ if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { + G_warning(_("Unable to open <%s>"), filename); + return (-1); + } + } + + /* write the stream header, if any */ +- av_write_header(oc); ++ if (avformat_write_header(oc, NULL) < 0) { ++ G_warning(_("Failed to write header")); ++ return (-1); ++ } + + + #else +@@ -439,7 +437,7 @@ int gsd_close_mpeg(void) + #if (LIBAVFORMAT_VERSION_INT>>16) < 52 + url_fclose(&oc->pb); + #else +- url_fclose(oc->pb); ++ avio_close(oc->pb); + #endif + } + diff --git a/academic/grass/grass-6.4.2-libav-9.patch b/academic/grass/grass-6.4.2-libav-9.patch new file mode 100644 index 0000000000..7fbe3254f4 --- /dev/null +++ b/academic/grass/grass-6.4.2-libav-9.patch @@ -0,0 +1,11 @@ +--- grass-6.4.2.orig/lib/ogsf/gsd_img_mpeg.c 2013-01-18 02:11:37.570025278 +0100 ++++ grass-6.4.2/lib/ogsf/gsd_img_mpeg.c 2013-01-18 02:13:01.663022218 +0100 +@@ -159,7 +159,7 @@ + } + + /* open the codec */ +- if (avcodec_open(c, codec) < 0) { ++ if (avcodec_open2(c, codec, NULL) < 0) { + G_warning(_("Unable to open codec")); + return; + } diff --git a/academic/grass/grass.SlackBuild b/academic/grass/grass.SlackBuild index 5e35f15657..fffbf3cbc5 100644 --- a/academic/grass/grass.SlackBuild +++ b/academic/grass/grass.SlackBuild @@ -24,7 +24,7 @@ PRGNAM=grass VERSION=${VERSION:-6.4.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -78,12 +78,11 @@ while [[ "$1" != "" ]]; do in blas | \ lapack | \ - geos | \ sqlite ) WITHLIST[$((withnum++))]="--with-$1" shift ;; - mysql ) + mysql | mariadb ) WITHLIST[$((withnum++))]="--with-mysql" WITHLIST[$((withnum++))]="--with-mysql-includes=/usr/include/mysql" shift @@ -111,12 +110,15 @@ else fi # gcc-4.7 patch from grass svn, see http://trac.osgeo.org/grass/ticket/1533 -sed -i 's/mm.cpp/mm.cc/' $CWD/changeset_r50130.diff patch -p3 < $CWD/changeset_r50130.diff -# ffmpeg-0.8 patch from Gentoo, see https://bugs.gentoo.org/show_bug.cgi?id=392371#c9 -# it's good for ffmpeg-0.10 too ;-) -patch -p1 < $CWD/gentoo392371b.patch +# ffmpeg-0.11 patches, snarfed from Gentoo (thanks!) +patch -p1 < $CWD/grass-6.4.2-configure-slack.patch +patch -p1 < $CWD/grass-6.4.1-libav-0.8.patch +patch -p1 < $CWD/grass-6.4.2-libav-9.patch +patch -p1 < $CWD/grass-6.4.2-ffmpeg-1.patch + +# geos now always enabled: it's an indirect hard dep (via gdal), and makes grass nicer :-) CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS -fpermissive" \ LDFLAGS="-ldl -lncurses" \ @@ -131,6 +133,7 @@ LDFLAGS="-ldl -lncurses" \ --with-proj-share=/usr/share/proj \ --with-cairo \ --with-wxwidgets \ + --with-geos \ --enable-largefile \ "${WITHLIST[@]}" \ $BITNESS \ diff --git a/academic/grass/grass.info b/academic/grass/grass.info index 316ac1f1f4..ce9b87295e 100644 --- a/academic/grass/grass.info +++ b/academic/grass/grass.info @@ -5,6 +5,6 @@ DOWNLOAD="http://grass.osgeo.org/grass64/source/grass-6.4.2.tar.gz" MD5SUM="d3398d6b1e3a2ef19cfb6e39a5ae9919" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="blas gdal numpy wxPython" +REQUIRES="gdal geos numpy proj wxPython %README%" MAINTAINER="David Spencer" EMAIL="baildon.research@googlemail.com" diff --git a/academic/grass/slack-desc b/academic/grass/slack-desc index 659b9400e6..584194d0d7 100644 --- a/academic/grass/slack-desc +++ b/academic/grass/slack-desc @@ -1,9 +1,9 @@ # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also -# customary to leave one space after the ':'. +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| grass: grass (Geographic Resources Analysis Support System) -- cgit v1.2.3