From 7e8ec72933c835d8427beb7991e4cb72283ff7e5 Mon Sep 17 00:00:00 2001 From: Layla Marchant Date: Sat, 26 Dec 2020 18:05:10 -0500 Subject: [PATCH] Added SF_UNHARDEN option for Windows builds. The linker supplied by MXE currently doesn't support the -x option, so this adds a way to skip that and uses that in win32build.sh. --- configure.ac | 7 ++++++- win32build.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7885d94..949f371 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,6 @@ AC_PROG_CC AC_PROG_INSTALL STARFIGHTER_CPPFLAGS="-DVERSION=\\\"$PACKAGE_VERSION\\\"" -STARFIGHTER_LDADD="-Wl,-z,now" # Detect MacOS AC_CANONICAL_HOST @@ -59,6 +58,7 @@ PKG_CHECK_MODULES([PANGO], [pango], [ ]) AC_ARG_VAR([SF_WARN], [Set to 1 to enable compiler warnings]) +AC_ARG_VAR([SF_UNHARDEN], [Set to 1 to disable hardening flags (for compatibility)]) AC_ARG_VAR([SF_SCREEN_WIDTH], [The width of the game window in pixels]) AC_ARG_VAR([SF_SCREEN_HEIGHT], [The height of the game window in pixels]) AC_ARG_VAR([SF_NOFONT], [Set to 1 to manually force the compiler not to include font/Unicode support]) @@ -67,6 +67,11 @@ AC_ARG_VAR([SF_RUN_IN_PLACE], [Set to 1 to compile Starfighter to run in-place ( AS_IF([test -n "$SF_WARN"], [ STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -Wall -Wformat-truncation=0" ]) +AS_IF([test -n "$SF_UNHARDEN"], [ + echo "Building without hardening flags" +], [ + STARFIGHTER_LDADD="-Wl,-z,now" +]) AS_IF([test -n "$SF_SCREEN_WIDTH"], [ STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DSCREEN_WIDTH=$SF_SCREEN_WIDTH" echo "Using default screen width of $SF_SCREEN_WIDTH" diff --git a/win32build.sh b/win32build.sh index 9a3a2f8..328f2f1 100755 --- a/win32build.sh +++ b/win32build.sh @@ -7,6 +7,6 @@ # Helper script to cross-compile for Windows with MXE. # Note: Before running, be sure to add the MXE usr/bin location to PATH. -./configure --host=i686-w64-mingw32.static SF_RUN_IN_PLACE=1 SF_NOWARN=1 +./configure --host=i686-w64-mingw32.static SF_RUN_IN_PLACE=1 SF_UNHARDEN=1 make mv src/starfighter.exe .