Fix Haiku compilation bug

Luc Schrijvers reported on the Tux Paint Maintainers mailing list an
failure to build magic tools for Tux Paint 0.9.26 rc1 (see the mailing
list for the details).  The issue appears to stem from an interesting
interaction between my commit from March
(39cc096ece) and the quotes around
beos_PLUGIN_LIBS on line 1361:

  beos_PLUGIN_LIBS:="$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS) $(MAGIC_SDL_CPPFLAGS)"

My commit had removed a leading argument from $(MAGIC_SDL_LIBS) (whose
value is irrelevant but it was "-L/usr/local/lib"), and the second
argument resolves to nothing on Haiku, so beos_PLUGIN_LIBS now resolves
to a string with a leading space, and it appears `cc` treats a string
argument with a leading space as a single token as opposed to a list of
arguments as it was apparently doing previously.  Pere confirms removing
the second argument that resolves to nothing allows binary to compile.

I suppose removing the quotes around beos_PLUGIN_LIBS is another (and
cleaner) possible solution, but the quotes appear to be intentional and
without a Haiku build environment to test the exact behavior this will
be the safer commit to make.
This commit is contained in:
Mark Kim 2021-06-17 22:18:15 -04:00
parent 795b574c7d
commit a8177635cb

View file

@ -1347,7 +1347,14 @@ obj:
######
MAGIC_SDL_CPPFLAGS:=$(shell $(PKG_CONFIG) $(SDL_PCNAME) --cflags)
MAGIC_SDL_LIBS:=$(LIBMINGW) $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
windows_MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
macos_MAGIC_SDL_LIBS:=-L/usr/local/lib $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
ios_MAGIC_SDL_LIBS:=$(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
beos_MAGIC_SDL_LIBS:=-L/usr/local/lib $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
linux_MAGIC_SDL_LIBS:=-L/usr/local/lib $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
MAGIC_SDL_LIBS:=$($(OS)_MAGIC_SDL_LIBS)
windows_MAGIC_ARCH_LINKS=-lintl $(PNG)
macos_MAGIC_ARCH_LINKS=-lintl $(PNG)
ios_MAGIC_ARCH_LINKS=-lintl -ljpeg $(PNG) $(shell $(PKG_CONFIG) --libs libtiff-4 libwebp libmpg123 ogg vorbisenc vorbisidec)