Control: tags -1 + patch On Sun, 23 Feb 2020 at 19:06:42 +0000, Simon McVittie wrote: > - Some weirdness in src/draw.cpp where it includes <SDL2/SDL_image.h> > but doesn't link to -lSDL2_image, which I currently don't fully understand > (perhaps src/draw.cpp really only needs the base SDL2 library, and not > SDL2_image?)
This seems to be related to the build system not passing the $(CXXFLAGS) to all $(CXX) invocations. See attached patch, also available at <https://salsa.debian.org/games-team/pekka-kana-2/merge_requests/1>. I don't really understand why libsdl2 merge request 3 avoids this, but for some reason it does. I've also attached/included a patch to make the build show what it's doing, which is called for by Policy §4.9; I found that change very useful to debug this. The V=1 convention is fairly common; the implementation using $(Q) is adapted from ioquake3. > - Fix pekka-kana-2 to stop making these assumptions, and instead use SDL > with the recommended patterns: > - PKG_CONFIG ?= pkg-config > (so that cross-compilation uses the correct cross-pkg-config) > - add $(${PKG_CONFIG} --cflags sdl2) to all C/C++ compiler command-lines > - add $(${PKG_CONFIG} --libs sdl2) to linker command-line > - add $(${PKG_CONFIG} --cflags SDL2_mixer) to all C/C++ compiler > command-lines > - add $(${PKG_CONFIG} --libs SDL2_mixer) to linker command-line > - include SDL.h (where required) with #include <SDL.h> > - include SDL_mixer.h (where required) with #include <SDL_mixer.h> > - if SDL2_image is required, do the same as for SDL2_mixer > - if SDL2_image is not required, use #include <SDL.h> instead My merge request does not implement all this, only the bare minimum to get this package compiling again. smcv
>From ec430cb81da6c9a5e1f51bfe2633f27576d8af24 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Sun, 23 Feb 2020 19:57:11 +0000 Subject: [PATCH 1/2] Consistently pass $(CXXFLAGS) to all $(CXX) invocations This fixes a build failure. Closes: #952049 --- debian/changelog | 8 ++++ ...Pass-CXXFLAGS-to-all-CXX-invocations.patch | 41 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 50 insertions(+) create mode 100644 debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 4836128..ba920cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +pekka-kana-2 (1.2.5-2) UNRELEASED; urgency=medium + + * d/p/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch: + Consistently pass $(CXXFLAGS) to all $(CXX) invocations, fixing a + build failure (Closes: #952049) + + -- Simon McVittie <s...@debian.org> Sun, 23 Feb 2020 19:55:35 +0000 + pekka-kana-2 (1.2.5-1) unstable; urgency=medium * New upstream release. FTCBFS bug fix. (Closes: #933080) diff --git a/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch b/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch new file mode 100644 index 0000000..e349bdd --- /dev/null +++ b/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch @@ -0,0 +1,41 @@ +From: Simon McVittie <s...@debian.org> +Date: Sun, 23 Feb 2020 19:53:13 +0000 +Subject: build: Pass $(CXXFLAGS) to all $(CXX) invocations + +When it generates dependencies, the C preprocessor needs to see the +same -I flags as for the actual compilation. Otherwise, +"#if SDL_VERSION_ATLEAST(2,0,0)" is a syntax error. + +Some compiler flags are also significant at link-time, so for +consistency, also pass the CXXFLAGS to the compiler driver while +linking. + +Signed-off-by: Simon McVittie <s...@debian.org> +Bug-Debian: https://bugs.debian.org/952049 +Forwarded: no +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index c2bc035..7134b33 100644 +--- a/Makefile ++++ b/Makefile +@@ -45,7 +45,7 @@ pk2: makedirs $(PK2_BIN) + # Rules for generate the binaries using the object files + $(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ) + @echo -Linking Pekka Kana 2 +- @$(CXX) $^ $(LDFLAGS) -o $@ ++ @$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@ + + # Rules for generate any *.o file + -include $(DEPENDENCIES) +@@ -53,7 +53,7 @@ $(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ) + build/%.o : src/%.cpp + @echo -Some dependence of $@ was changed, updating + @$(CXX) $(CXXFLAGS) -I$(SRC_DIR) -o $@ -c $< +- @$(CXX) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d ++ @$(CXX) $(CXXFLAGS) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d + + makedirs: + @mkdir -p $(BIN_DIR) >/dev/null diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..c14b890 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +build-Pass-CXXFLAGS-to-all-CXX-invocations.patch -- 2.25.1
>From b5ec6a6a2dda44cd7de15a21e82479bd3f84fc27 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Sun, 23 Feb 2020 20:00:10 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Show=20compiler=20command-lines=20during=20?= =?UTF-8?q?build=20(Policy=20=C2=A74.9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 3 + ...sible-to-show-compiler-command-lines.patch | 56 +++++++++++++++++++ debian/patches/series | 1 + debian/rules | 3 + 4 files changed, 63 insertions(+) create mode 100644 debian/patches/build-Make-it-possible-to-show-compiler-command-lines.patch diff --git a/debian/changelog b/debian/changelog index ba920cd..ac30e98 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ pekka-kana-2 (1.2.5-2) UNRELEASED; urgency=medium * d/p/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch: Consistently pass $(CXXFLAGS) to all $(CXX) invocations, fixing a build failure (Closes: #952049) + * d/p/build-Make-it-possible-to-show-compiler-command-lines.patch, + d/rules: + Show compiler command-lines during build (Policy §4.9) -- Simon McVittie <s...@debian.org> Sun, 23 Feb 2020 19:55:35 +0000 diff --git a/debian/patches/build-Make-it-possible-to-show-compiler-command-lines.patch b/debian/patches/build-Make-it-possible-to-show-compiler-command-lines.patch new file mode 100644 index 0000000..b4e00e2 --- /dev/null +++ b/debian/patches/build-Make-it-possible-to-show-compiler-command-lines.patch @@ -0,0 +1,56 @@ +From: Simon McVittie <s...@debian.org> +Date: Sun, 23 Feb 2020 19:55:26 +0000 +Subject: build: Make it possible to show compiler command-lines + +When debugging build failures in distribution-wide QA, it's important +for developers to be able to tell what the compiler command-line was. +Implement the conventional "make V=1". + +Signed-off-by: Simon McVittie <s...@debian.org> +--- + Makefile | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 7134b33..653c3a9 100644 +--- a/Makefile ++++ b/Makefile +@@ -42,25 +42,31 @@ DEPENDENCIES := $(addsuffix .d, $(DEPENDENCIES)) + + pk2: makedirs $(PK2_BIN) + ++ifeq ($(V),1) ++Q= ++else ++Q=@ ++endif ++ + # Rules for generate the binaries using the object files + $(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ) + @echo -Linking Pekka Kana 2 +- @$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@ ++ $(Q)$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@ + + # Rules for generate any *.o file + -include $(DEPENDENCIES) + + build/%.o : src/%.cpp + @echo -Some dependence of $@ was changed, updating +- @$(CXX) $(CXXFLAGS) -I$(SRC_DIR) -o $@ -c $< +- @$(CXX) $(CXXFLAGS) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d ++ $(Q)$(CXX) $(CXXFLAGS) -I$(SRC_DIR) -o $@ -c $< ++ $(Q)$(CXX) $(CXXFLAGS) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d + + makedirs: +- @mkdir -p $(BIN_DIR) >/dev/null +- @mkdir -p $(BUILD_DIR) >/dev/null ++ $(Q)mkdir -p $(BIN_DIR) >/dev/null ++ $(Q)mkdir -p $(BUILD_DIR) >/dev/null + + clean: +- @rm -rf $(BIN_DIR) +- @rm -rf $(BUILD_DIR) ++ $(Q)rm -rf $(BIN_DIR) ++ $(Q)rm -rf $(BUILD_DIR) + + .PHONY: pk2 clean makedirs diff --git a/debian/patches/series b/debian/patches/series index c14b890..66dfc9b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ build-Pass-CXXFLAGS-to-all-CXX-invocations.patch +build-Make-it-possible-to-show-compiler-command-lines.patch diff --git a/debian/rules b/debian/rules index b114ce6..75e74a4 100755 --- a/debian/rules +++ b/debian/rules @@ -5,3 +5,6 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ + +override_dh_auto_build: + dh_auto_build -- V=1 -- 2.25.1