[FFmpeg-trac] #6377(build system:new): Prioritize 'sdl2-config'-check over 'check_pkg_config sdl2'-check.

FFmpeg trac at avcodec.org
Mon May 8 00:33:46 EEST 2017


#6377: Prioritize 'sdl2-config'-check over 'check_pkg_config sdl2'-check.
-------------------------------------+-------------------------------------
             Reporter:  CoRoNe       |                     Type:
               Status:  new          |  enhancement
            Component:  build        |                 Priority:  normal
  system                             |                  Version:  git-
             Keywords:  sdl2         |  master
  sdl2-config                        |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 When cross-compiling SDL2 it by default produces a pkg-config source file
 with the following library-list:
 {{{
 Libs: -L${libdir}  -lmingw32 -lSDL2main -lSDL2
 }}}
 For building FFPlay (for Windows) it needs at least:
 {{{
 Libs: -L${libdir}  -lmingw32 -lSDL2main -lSDL2 -limm32 -lole32 -loleaut32
 -lversion
 }}}
 However, there's already 'sdl2-config' with all the libraries setup right,
 but FFMpeg's 'configure'
 [https://github.com/FFmpeg/FFmpeg/blob/master/configure#L5941 gives
 priority to 'check_pkg_config sdl2' at the moment], and thus fails when
 the libraries aren't setup right for FFPlay to be built.

 I suggest turning the if-statement around; prioritizing the
 'sdl2-config'-check:
 {{{
 #!sh
 disabled sdl && disable sdl2
 if ! disabled sdl2; then
    SDL2_CONFIG="${cross_prefix}sdl2-config"
    if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 |
 SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 |
 SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
        check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2
    else
      if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 |
 SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 |
 SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
        check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2
      fi
    fi
    if test $target_os = "mingw32"; then
        sdl2_extralibs="$sdl2_extralibs -mconsole"
    fi
 fi
 enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs
 $sdl2_extralibs
 }}}
 I've successfully built FFPlay this way, and thus without having to patch
 'sdl2.pc'.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6377>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list