Skip to content

Commit

Permalink
Update to SDL 2.24.0 and add separate macOS UB2 dylib
Browse files Browse the repository at this point in the history
Update mingw and macOS SDL libraries to 2.24.0. (MSVC .lib files and
Xcode project haven't been updated.)

There is now a separate SDL dylib for macOS Universal Binary 1 and 2
because SDL 2.24.0 dropped support for macOS 10.6 (which is last to
support x86). Documentation says SDL 2.24.0 also dropped macOS 10.7
and 10.8 too. So UB2 is now 10.9 or later while 10.5 to 10.8 live in
UB1.

Compiled using osxcross with macOS 11.3 SDK. Ran "strip -x" on Windows
and macOS libraries. Ad-hoc signed dylib using PyOxidizer rcodesign to
fix digest checksums after strip.
  • Loading branch information
zturtleman committed Feb 19, 2023
1 parent 70d07d9 commit 02a12f2
Show file tree
Hide file tree
Showing 193 changed files with 52,408 additions and 1,777 deletions.
47 changes: 38 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,31 @@ ifeq ($(PLATFORM),darwin)

# Default minimum Mac OS X version
ifeq ($(MACOSX_VERSION_MIN),)
MACOSX_VERSION_MIN=10.7
MACOSX_VERSION_MIN=10.9
ifneq ($(findstring $(ARCH),ppc ppc64),)
MACOSX_VERSION_MIN=10.5
endif
ifeq ($(ARCH),x86)
MACOSX_VERSION_MIN=10.6
endif
ifeq ($(ARCH),x86_64)
# trying to find default SDK version is hard
# macOS 10.15 requires -sdk macosx but 10.11 doesn't support it
# macOS 10.6 doesn't have -show-sdk-version
DEFAULT_SDK=$(shell xcrun -sdk macosx -show-sdk-version 2> /dev/null)
ifeq ($(DEFAULT_SDK),)
DEFAULT_SDK=$(shell xcrun -show-sdk-version 2> /dev/null)
endif
ifeq ($(DEFAULT_SDK),)
$(error Error: Unable to determine macOS SDK version. On macOS 10.6 to 10.8 run: make MACOSX_VERSION_MIN=10.6 On macOS 10.9 or later run: make MACOSX_VERSION_MIN=10.9 );
endif

ifneq ($(findstring $(DEFAULT_SDK),10.6 10.7 10.8),)
MACOSX_VERSION_MIN=10.6
else
MACOSX_VERSION_MIN=10.9
endif
endif
ifeq ($(ARCH),arm64)
MACOSX_VERSION_MIN=11.0
endif
Expand Down Expand Up @@ -561,20 +582,28 @@ ifeq ($(PLATFORM),darwin)
RENDERER_LIBS += -framework OpenGL

ifeq ($(USE_LOCAL_HEADERS),1)
# libSDL2-2.0.0.dylib for PPC is SDL 2.0.1 + changes to compile
ifneq ($(findstring $(ARCH),ppc ppc64),)
BASE_CFLAGS += -I$(SDLHDIR)/include-macppc
else
ifeq ($(shell test $(MAC_OS_X_VERSION_MIN_REQUIRED) -ge 1090; echo $$?),0)
# Universal Binary 2 - for running on macOS 10.9 or later
# x86_64 (10.9 or later), arm64 (11.0 or later)
MACLIBSDIR=$(LIBSDIR)/macosx-ub2
BASE_CFLAGS += -I$(SDLHDIR)/include
else
# Universal Binary - for running on Mac OS X 10.5 or later
MACLIBSDIR=$(LIBSDIR)/macosx-ub
ifneq ($(findstring $(ARCH),ppc ppc64),)
BASE_CFLAGS += -I$(SDLHDIR)/include-macppc
else
BASE_CFLAGS += -I$(SDLHDIR)/include-2.0.16
endif
endif

# We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDL2main.a
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
CLIENT_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
RENDERER_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
LIBSDLMAINSRC=$(MACLIBSDIR)/libSDL2main.a
CLIENT_LIBS += $(MACLIBSDIR)/libSDL2-2.0.0.dylib
RENDERER_LIBS += $(MACLIBSDIR)/libSDL2-2.0.0.dylib
CLIENT_EXTRA_FILES += $(MACLIBSDIR)/libSDL2-2.0.0.dylib
else
BASE_CFLAGS += -I/Library/Frameworks/SDL2.framework/Headers
CLIENT_LIBS += -framework SDL2
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ For Windows,
1. Please refer to the excellent instructions here:
https://ioquake3.org/help/building-ioquake3/

For macOS, building a Universal Binary (x86_64, x86, ppc)
For macOS, building a Universal Binary (macOS 10.5 to 10.8, x86_64, x86, ppc)
1. Install MacOSX SDK packages from XCode. For maximum compatibility,
install MacOSX10.5.sdk and MacOSX10.6.sdk.
2. Change to the directory containing this README file.
3. Run './make-macosx-ub.sh'
4. Copy the resulting ioquake3.app in /build/release-darwin-universal
to your /Applications/ioquake3 folder.

For Mac OS X, building a Universal Binary 2 (arm64, x86_64)
For macOS, building a Universal Binary 2 (macOS 10.9+, arm64, x86_64)
1. Install MacOSX SDK packages from XCode. Building for arm64 requires
MacOSX11.sdk or later.
2. Change to the directory containing this README file.
Expand Down
138 changes: 138 additions & 0 deletions code/SDL2/include-2.0.16/SDL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

/**
* \file SDL.h
*
* Main include header for the SDL library
*/


#ifndef SDL_h_
#define SDL_h_

#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "SDL_atomic.h"
#include "SDL_audio.h"
#include "SDL_clipboard.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_filesystem.h"
#include "SDL_gamecontroller.h"
#include "SDL_haptic.h"
#include "SDL_hints.h"
#include "SDL_joystick.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_metal.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_sensor.h"
#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_version.h"
#include "SDL_video.h"
#include "SDL_locale.h"
#include "SDL_misc.h"

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* As of version 0.5, SDL is loaded dynamically into the application */

/**
* \name SDL_INIT_*
*
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*/
/* @{ */
#define SDL_INIT_TIMER 0x00000001u
#define SDL_INIT_AUDIO 0x00000010u
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */

/**
* This function initializes the subsystems specified by \c flags
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);

/**
* This function initializes specific SDL subsystems
*
* Subsystem initialization is ref-counted, you must call
* SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly
* shutdown a subsystem manually (or call SDL_Quit() to force shutdown).
* If a subsystem is already loaded then this call will
* increase the ref-count and return.
*/
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);

/**
* This function cleans up specific SDL subsystems
*/
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);

/**
* This function returns a mask of the specified subsystems which have
* previously been initialized.
*
* If \c flags is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);

/**
* This function cleans up all initialized subsystems. You should
* call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif /* SDL_h_ */

/* vi: set ts=4 sw=4 expandtab: */
Loading

0 comments on commit 02a12f2

Please sign in to comment.