public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/duel3] rawhide: Fix annocheck hardening failures: pass '%{build_ldflags}' to the linker
@ 2026-07-15 18:09 Michal Schorm
  0 siblings, 0 replies; only message in thread
From: Michal Schorm @ 2026-07-15 18:09 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/duel3
            Branch : rawhide
            Commit : c2acae62266ab1e520d3c745aa351d9514b3ada0
            Author : Michal Schorm <mschorm@redhat.com>
            Date   : 2026-07-15T00:44:42+02:00
            Stats  : +30/-2 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/duel3/c/c2acae62266ab1e520d3c745aa351d9514b3ada0?branch=rawhide

            Log:
            Fix annocheck hardening failures: pass '%{build_ldflags}' to the linker

The binary '/usr/bin/duel3' failed annocheck 'bind-now' and 'pie' tests
because '%{build_ldflags}' (which provides '-Wl,-z,now' and '-Wl,-pie')
was not being passed to the linker.

The upstream Makefile used 'LDFLAGS' for library flags ('-ldumb',
'-laldmb', etc.), preventing RPM build flags from being passed via
'LDFLAGS' without overriding the required libraries.

Add 'Duel3_20060225-ldflags.patch' to separate library flags into a new
'LIBS' variable and pass '%{build_ldflags}' via 'LDFLAGS' in the spec.

Co-Authored-By: Claude AI <noreply@anthropic.com>

---
diff --git a/Duel3_20060225-ldflags.patch b/Duel3_20060225-ldflags.patch
new file mode 100644
index 0000000..dd0a80a
--- /dev/null
+++ b/Duel3_20060225-ldflags.patch
@@ -0,0 +1,21 @@
+Separate library flags from LDFLAGS so that RPM build flags
+(including '-Wl,-z,now' and '-Wl,-pie') can be passed via LDFLAGS
+without overriding the required library linkage.
+
+--- Duel3_20060225_src/Source/Makefile.ldflags	2006-02-25 00:00:00.000000000 +0100
++++ Duel3_20060225_src/Source/Makefile	2006-02-25 00:00:00.000000000 +0100
+@@ -3,13 +3,13 @@
+ BINDIR = $(PREFIX)/bin/
+ DATADIR = $(PREFIX)/share/$(TARGET)
+ CFLAGS  = -g -Wall -O2 -Wno-non-virtual-dtor
+-LDFLAGS = `allegro-config --libs` -ldumb -laldmb -lalleggl -lGL -lGLU
++LIBS = `allegro-config --libs` -ldumb -laldmb -lalleggl -lGL -lGLU
+ DEFINES = -DDATADIR=\"$(DATADIR)/\"
+ OBJS  = main.o Standards.o CCamera.o CVector2.o BRect.o SObject.o Model.o Weapon.o Animation.o PObject.o Ship.o Proj.o Arena.o Player.o Game.o Widget.o ShipArray.o Starfield.o CVector3.o particle.o particlesystem.o particlegenerator.o asteroid.o Controller.o SfxSingleton.o GameMode.o AsteroidsGameMode.o NewMenu.o Button.o CheckBox.o ShipSelector.o MissileAvoid.o AIPlayer.o Turret.o MissileAvoid2p.o GameSettingsSingleton.o ScoreKeeper.o AsteroidsGameMode2p.o Powerup.o unix.o
+
+ $(TARGET): $(OBJS)
+-	g++ $(LDFLAGS) -o $@ $^
++	g++ $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ %.o: %.cpp
+ 	g++ $(CFLAGS) $(DEFINES) -o $@ -c $<

diff --git a/duel3.spec b/duel3.spec
index 5b2dacb..085a9e3 100644
--- a/duel3.spec
+++ b/duel3.spec
@@ -1,7 +1,7 @@
 %global snapshot 20060225
 Name:           duel3
 Version:        0.1
-Release:        0.45.%{snapshot}%{?dist}
+Release:        0.46.%{snapshot}%{?dist}
 Summary:        One on one spaceship duel in a 2D arena
 License:        BSD-3-Clause
 # Upstream has vanished
@@ -15,6 +15,7 @@ Patch0:         Duel3_20060225-fixes.patch
 Patch1:         Duel3_20060225-windowed-mode.patch
 Patch2:         Duel3_20060225-fix-buf-oflow.patch
 Patch3:         Duel3_20060225-extra-fix-buf-oflow.patch
+Patch4:         Duel3_20060225-ldflags.patch
 BuildRequires:  gcc-c++
 BuildRequires:  alleggl-devel dumb-devel libGLU-devel desktop-file-utils
 BuildRequires: make
@@ -49,6 +50,7 @@ cp %{SOURCE4} .
 %patch -P1 -p1
 %patch -P2 -p1
 %patch -P3 -p1
+%patch -P4 -p1
 sed -i 's/\r//' Source/readme.txt license.txt music-credits.txt
 iconv -f iso8859-1 -t utf-8 music-credits.txt > temp
 mv temp music-credits.txt
@@ -57,7 +59,8 @@ mv temp music-credits.txt
 %build
 pushd Source
 make %{?_smp_mflags} PREFIX=%{_prefix} \
-  CFLAGS="-std=c++14 $RPM_OPT_FLAGS -fsigned-char -Wno-deprecated-declarations -Wno-non-virtual-dtor"
+  CFLAGS="-std=c++14 $RPM_OPT_FLAGS -fsigned-char -Wno-deprecated-declarations -Wno-non-virtual-dtor" \
+  LDFLAGS="%{build_ldflags}"
 popd
 
 
@@ -87,6 +90,10 @@ install -p -m 644 %{SOURCE3} \
 
 
 %changelog
+* Wed Jul 15 2026 Michal Schorm <mschorm@redhat.com> - 0.1-0.46.20060225
+- Fix annocheck hardening failures: pass '%{build_ldflags}' to the linker
+- Add 'Duel3_20060225-ldflags.patch' to separate library flags from 'LDFLAGS'
+
 * Tue Jul 14 2026 Michal Schorm <mschorm@redhat.com> - 0.1-0.45.20060225
 - Fix SPDX license tag: replace 'LicenseRef-Callaway-BSD' with 'BSD-3-Clause'
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-15 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-15 18:09 [rpms/duel3] rawhide: Fix annocheck hardening failures: pass '%{build_ldflags}' to the linker Michal Schorm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox