Fix for multilib support

This commit is contained in:
Neal Gompa 2021-06-03 08:35:19 -04:00
parent d7eca86997
commit ad275627df
3 changed files with 153 additions and 1 deletions

79
SDL_config.h Normal file
View File

@ -0,0 +1,79 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
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.
*/
/*
* This SDL_config.h is a wrapper include file for the original SDL_config.h,
* which has been renamed to SDL_config-<arch>.h. There are conflicts for the
* original SDL_config.h on multilib systems, which result from arch-specific
* configuration options. Please do not use the arch-specific file directly.
*
* Copyright (C) 2021 Neal Gompa
* Neal Gompa <ngompa13@gmail.com>
*/
#ifdef SDL_config_wrapper_h
#error "SDL_config_wrapper_h should not be defined!"
#endif
#define SDL_config_wrapper_h
#if defined(__i386__)
#include "SDL_config-i386.h"
#elif defined(__ia64__)
#include "SDL_config-ia64.h"
#elif defined(__powerpc64__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#include "SDL_config-ppc64.h"
#else
#include "SDL_config-ppc64le.h"
#endif
#elif defined(__powerpc__)
#include "SDL_config-ppc.h"
#elif defined(__s390x__)
#include "SDL_config-s390x.h"
#elif defined(__s390__)
#include "SDL_config-s390.h"
#elif defined(__x86_64__)
#include "SDL_config-x86_64.h"
#elif defined(__arm__)
#include "SDL_config-arm.h"
#elif defined(__alpha__)
#include "SDL_config-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "SDL_config-sparc64.h"
#elif defined(__sparc__)
#include "SDL_config-sparc.h"
#elif defined(__aarch64__)
#include "SDL_config-aarch64.h"
#elif defined(__mips64) && defined(__MIPSEL__)
#include "SDL_config-mips64el.h"
#elif defined(__mips64)
#include "SDL_config-mips64.h"
#elif defined(__mips) && defined(__MIPSEL__)
#include "SDL_config-mipsel.h"
#elif defined(__mips)
#include "SDL_config-mips.h"
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#include "SDL_config-riscv64.h"
#else
#error "The sdl12-compat-devel package is not usable with the architecture."
#endif
#undef SDL_config_wrapper_h

View File

@ -0,0 +1,56 @@
From d5e9e51860f4e90f7ba0bb53b1c26740dc1ee7eb Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Thu, 3 Jun 2021 08:31:58 -0400
Subject: [PATCH] Remove libdir definition from sdl-config for multilib support
If we export the library directory, then the contents of sdl-config
wind up differing across architectures, which will make sdl12-compat
not multilib-safe.
Thus, strip out the libdir stuff so that this isn't a problem.
---
CMakeLists.txt | 1 -
sdl-config.in | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6256c3a..9163f9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,7 +182,6 @@ if(SDL12DEVEL)
set(SDL_STATIC_LIBS "-lm -ldl -lpthread")
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
- set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
set(bindir "\${exec_prefix}/bin")
set(includedir "\${prefix}/include")
configure_file("${CMAKE_SOURCE_DIR}/sdl-config.in" "${CMAKE_BINARY_DIR}/sdl-config" @ONLY)
diff --git a/sdl-config.in b/sdl-config.in
index f7895c2..e55633e 100755
--- a/sdl-config.in
+++ b/sdl-config.in
@@ -10,7 +10,6 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
-libdir=@libdir@
@ENABLE_STATIC_FALSE@usage="\
@ENABLE_STATIC_FALSE@Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
@@ -52,11 +51,11 @@ while test $# -gt 0; do
echo -I@includedir@/SDL2 @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo @SDL_RLD_FLAGS@ @SDL_LIBS@
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
-@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@ echo @SDL_LIBS@ @SDL_STATIC_LIBS@
@ENABLE_STATIC_TRUE@ ;;
*)
echo "${usage}" 1>&2
--
2.31.1

View File

@ -4,12 +4,21 @@
Name: sdl12-compat
Version: 0.0.1~git.%{commitdate}.%{shortcommit}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: SDL 1.2 runtime compatibility library using SDL 2.0
License: zlib
URL: https://github.com/libsdl-org/sdl12-compat
Source0: %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
# Multilib aware-header stub
Source1: SDL_config.h
# Backports from upstream (0001~0500)
# Proposed patches (0501~1000)
# Fedora specific patches (1001+)
Patch1001: sdl12-compat-sdlconfig-multilib.patch
BuildRequires: cmake
BuildRequires: gcc
@ -68,6 +77,11 @@ this layer.
%install
%cmake_install
# Rename SDL_config.h to SDL_config-<arch>.h to avoid file conflicts on
# multilib systems and install SDL_config.h wrapper
mv %{buildroot}/%{_includedir}/SDL/SDL_config.h %{buildroot}/%{_includedir}/SDL/SDL_config-%{_arch}.h
install -m644 %{SOURCE1} %{buildroot}/%{_includedir}/SDL/SDL_config.h
%files
%license LICENSE.txt
@ -82,6 +96,9 @@ this layer.
%changelog
* Thu Jun 03 2021 Neal Gompa <ngompa13@gmail.com> - 0.0.1~git.20210602.cc5826a-3
- Fix for multilib support
* Thu Jun 03 2021 Neal Gompa <ngompa13@gmail.com> - 0.0.1~git.20210602.cc5826a-2
- Add missing SDL2 dependency and fix Obsoletes