From a8177635cb462aecd2aebe4ada8fc118fdddef2c Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Thu, 17 Jun 2021 22:18:15 -0400 Subject: [PATCH] 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 (39cc096ecec3eccff05f8c040ede0fb1df4c2c13) 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. --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 35dede64a..c3583cdd7 100644 --- a/Makefile +++ b/Makefile @@ -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)