diff mbox

[FFmpeg-devel] build: prevent SDL2 from polluting global cflags and extralibs

Message ID 20171008201621.9992-1-jamrial@gmail.com
State Accepted
Commit fde3bb16f90ac456709c7305b9e230e8327d8625
Headers show

Commit Message

James Almer Oct. 8, 2017, 8:16 p.m. UTC
Remove the SDL_main define from the global cflags but not from the
ffplay cflags, and the -mwindows linker option from extralibs instead
of overriding it with the addition of -mconsole.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 configure           | 4 ++--
 ffbuild/library.mak | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

wm4 Oct. 9, 2017, 11:27 a.m. UTC | #1
On Sun,  8 Oct 2017 17:16:21 -0300
James Almer <jamrial@gmail.com> wrote:

> Remove the SDL_main define from the global cflags but not from the
> ffplay cflags, and the -mwindows linker option from extralibs instead
> of overriding it with the addition of -mconsole.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  configure           | 4 ++--
>  ffbuild/library.mak | 1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 77c9a18c3c..0fdf4bcbe3 100755
> --- a/configure
> +++ b/configure
> @@ -6107,10 +6107,10 @@ if enabled sdl2; then
>              enable sdl2
>      fi
>      if test $target_os = "mingw32"; then
> -        sdl2_extralibs="$sdl2_extralibs -mconsole"
> +        sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
>      fi
>  fi
> -enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
> +enabled sdl2 && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags) && add_extralibs $sdl2_extralibs
>  
>  if enabled decklink; then
>      case $target_os in
> diff --git a/ffbuild/library.mak b/ffbuild/library.mak
> index ee19c3c797..4191edcf9c 100644
> --- a/ffbuild/library.mak
> +++ b/ffbuild/library.mak
> @@ -16,7 +16,6 @@ all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
>  
>  LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
>  $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i):   CPPFLAGS += -DHAVE_AV_CONFIG_H
> -$(TESTOBJS) $(TESTOBJS:.o=.i): CFLAGS += -Umain
>  
>  $(SUBDIR)$(LIBNAME): $(OBJS)
>  	$(RM) $@

LGTM, though I'd argue dropping SDL instead.
James Almer Oct. 10, 2017, 12:43 a.m. UTC | #2
On 10/9/2017 8:27 AM, wm4 wrote:
> On Sun,  8 Oct 2017 17:16:21 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
>> Remove the SDL_main define from the global cflags but not from the
>> ffplay cflags, and the -mwindows linker option from extralibs instead
>> of overriding it with the addition of -mconsole.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  configure           | 4 ++--
>>  ffbuild/library.mak | 1 -
>>  2 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 77c9a18c3c..0fdf4bcbe3 100755
>> --- a/configure
>> +++ b/configure
>> @@ -6107,10 +6107,10 @@ if enabled sdl2; then
>>              enable sdl2
>>      fi
>>      if test $target_os = "mingw32"; then
>> -        sdl2_extralibs="$sdl2_extralibs -mconsole"
>> +        sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
>>      fi
>>  fi
>> -enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
>> +enabled sdl2 && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags) && add_extralibs $sdl2_extralibs
>>  
>>  if enabled decklink; then
>>      case $target_os in
>> diff --git a/ffbuild/library.mak b/ffbuild/library.mak
>> index ee19c3c797..4191edcf9c 100644
>> --- a/ffbuild/library.mak
>> +++ b/ffbuild/library.mak
>> @@ -16,7 +16,6 @@ all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
>>  
>>  LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
>>  $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i):   CPPFLAGS += -DHAVE_AV_CONFIG_H
>> -$(TESTOBJS) $(TESTOBJS:.o=.i): CFLAGS += -Umain
>>  
>>  $(SUBDIR)$(LIBNAME): $(OBJS)
>>  	$(RM) $@
> 
> LGTM, though I'd argue dropping SDL instead.

Pushed, thanks.
diff mbox

Patch

diff --git a/configure b/configure
index 77c9a18c3c..0fdf4bcbe3 100755
--- a/configure
+++ b/configure
@@ -6107,10 +6107,10 @@  if enabled sdl2; then
             enable sdl2
     fi
     if test $target_os = "mingw32"; then
-        sdl2_extralibs="$sdl2_extralibs -mconsole"
+        sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
     fi
 fi
-enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
+enabled sdl2 && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflags) && add_extralibs $sdl2_extralibs
 
 if enabled decklink; then
     case $target_os in
diff --git a/ffbuild/library.mak b/ffbuild/library.mak
index ee19c3c797..4191edcf9c 100644
--- a/ffbuild/library.mak
+++ b/ffbuild/library.mak
@@ -16,7 +16,6 @@  all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc
 
 LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
 $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i):   CPPFLAGS += -DHAVE_AV_CONFIG_H
-$(TESTOBJS) $(TESTOBJS:.o=.i): CFLAGS += -Umain
 
 $(SUBDIR)$(LIBNAME): $(OBJS)
 	$(RM) $@