Control: tags -1 + patch

sdl12-compat_1.2.64-4 includes workarounds for all these build issues,
hopefully making this bug non-RC (I'll lower the severity if a test-build
is successful), but I would still prefer it if they were fixed in this
package.

I opened <https://salsa.debian.org/onlyjob/freespace2/-/merge_requests/3>
containing the attached patches.

On Tue, 27 Jun 2023 at 18:26:25 +0100, Simon McVittie wrote:
> The actual actual problem :-) is that freespace2 build-depends on
> libsdl-dev, a virtual package, and not on libsdl1.2-dev, a concrete
> implementation of that virtual package

Fixed in attached patch 0001

> It is still a good idea to have an explicit build-dependency on anything
> that the package explicitly uses, to avoid being broken by "action at
> a distance" in a dependency.

Fixed in attached patches 0002 and 0003

> > Then you need to make the inclusion of malloc.h unconditional in
> > code/windows_stub/stubs.cpp (or fix the build system s.t. it checks for
> > malloc.h and populates HAVE_MALLOC_H accordingly).
> 
> This appears to be because freespace2 checks #ifdef HAVE_MALLOC_H,
> but never actually checks for malloc.h, so it was accidentally relying
> on SDL's SDL_config.h to leak information about the headers that SDL
> uses internally.

Fixed in attached patch 0004
>From 33a63188556b2d09cf7b671e4ff9c0e90615f12d Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 29 Jun 2023 14:39:30 +0100
Subject: [PATCH 1/4] d/control: Explicitly depend on libsdl1.2-dev

libsdl-dev is a virtual package and currently has more than one
implementation in unstable, so this build-depdendency results in an
unpredictable one of the possible implementations being chosen.

Helps: #1012232
---
 debian/control | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 26cbdec..bad6e97 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Build-Depends: debhelper (>= 11~)
     ,liblua5.1-0-dev
     ,libopenal-dev
     ,libpng-dev
-    ,libsdl-dev
+    ,libsdl1.2-dev
     ,libtheora-dev
     ,libvorbis-dev
     ,zlib1g-dev
-- 
2.40.1

>From be03bbea18a4e80069a8b1f148762fa562c0e230 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 29 Jun 2023 14:44:43 +0100
Subject: [PATCH 2/4] d/control: Explicitly build-depend on pkgconf

configure.ac invokes PKG_PROG_PKG_CONFIG, so we should explicitly
build-depend on pkgconf rather than assuming that another
build-dependency will pull it in.

Helps: #1012232
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index bad6e97..1a19f30 100644
--- a/debian/control
+++ b/debian/control
@@ -13,6 +13,7 @@ Build-Depends: debhelper (>= 11~)
     ,libsdl1.2-dev
     ,libtheora-dev
     ,libvorbis-dev
+    ,pkgconf
     ,zlib1g-dev
 Homepage: http://scp.indiegames.us/
 Vcs-Browser: https://salsa.debian.org/onlyjob/freespace2
-- 
2.40.1

>From a478b3f53522b3b4c1c0eef084fc57a60e3e46df Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 29 Jun 2023 15:00:44 +0100
Subject: [PATCH 3/4] d/control: Explicitly build-depend on libgl1-mesa-dev,
 libgl-dev

code/graphics/gropengl.h includes <GL/gl.h> and <GL/glu.h>, so
freespace2 should build-depend on the relevant packages, instead of
assuming that another build-dependency will pull them in.

Helps: #1012232
---
 debian/control | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/debian/control b/debian/control
index 1a19f30..5577c8e 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,8 @@ Standards-Version: 4.1.5
 Maintainer: Dmitry Smirnov <only...@debian.org>
 Build-Depends: debhelper (>= 11~)
     ,antiword
+    ,libgl-dev,
+    ,libglu1-mesa-dev,
     ,libjansson-dev
     ,libjpeg-dev
     ,liblua5.1-0-dev
-- 
2.40.1

>From 00c5e94460be8a4003b5be158aba35b57f0e105f Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 29 Jun 2023 14:52:11 +0100
Subject: [PATCH 4/4] Add patch to check for malloc.h

libsdl1.2 traditionally defined HAVE_MALLOC_H in SDL_config.h on
platforms that have it, but that was never really an API guarantee, and
initial versions of sdl12-compat didn't define that macro.
sdl12-compat >= 1.2.64-4 in Debian, and 1.2.66 upstream, will work around
this, but it's better for freespace2 to take responsibility for checking
for all the headers that it needs.

Closes: #1012232
---
 debian/patches/build-Check-for-malloc.h.patch | 25 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/build-Check-for-malloc.h.patch

diff --git a/debian/patches/build-Check-for-malloc.h.patch b/debian/patches/build-Check-for-malloc.h.patch
new file mode 100644
index 0000000..7fd3214
--- /dev/null
+++ b/debian/patches/build-Check-for-malloc.h.patch
@@ -0,0 +1,25 @@
+From: Simon McVittie <s...@debian.org>
+Date: Thu, 29 Jun 2023 14:47:46 +0100
+Subject: build: Check for malloc.h
+
+windows_stub/stubs.cpp checks whether the macro HAVE_MALLOC_H is defined,
+but there's no guarantee that one of freespace2's dependencies will define
+that symbol, so freespace2 should check for it in its own build system.
+
+Bug-Debian: https://bugs.debian.org/1012232
+---
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/configure.ac b/configure.ac
+index d850f85..af54a1e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -311,6 +311,7 @@ AM_CONDITIONAL(FS2_DEBUG,      test "$fs2_debug"      = "yes")
+ AM_CONDITIONAL([am__fastdepOBJC],  test "$fs2_os_osx"  = "yes")
+ 
+ AC_CHECK_HEADER(stdlib.h)
++AC_CHECK_HEADERS_ONCE([malloc.h])
+ 
+ dnl From licq: Copyright (c) 2000 Dirk Mueller
+ dnl Check if the type socklen_t is defined anywhere
diff --git a/debian/patches/series b/debian/patches/series
index ee23b5e..43b6205 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 i386-baseline.patch
+build-Check-for-malloc.h.patch
-- 
2.40.1

Reply via email to