replace the ugly hacks with clean patches for package openal

This commit is contained in:
Volker Grabsch 2010-11-28 22:28:35 +01:00
parent 0c78444409
commit 1f1ff5d8f1
4 changed files with 143 additions and 109 deletions

View File

@ -1,109 +0,0 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
Contains ad hoc patches for cross building.
From 0ea58dd9662da43ee86682a35608f913f522aadb Mon Sep 17 00:00:00 2001
From: mingw-cross-env
Date: Fri, 1 Oct 2010 18:44:51 +0200
Subject: [PATCH] cross building workarounds
diff --git a/Alc/ALc.c b/Alc/ALc.c
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -239,34 +239,8 @@
///////////////////////////////////////////////////////
// ALC Related helper functions
-#ifdef _WIN32
-static void alc_init(void);
-static void alc_deinit(void);
-
-BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
-{
- (void)lpReserved;
-
- // Perform actions based on the reason for calling.
- switch(ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hModule);
- alc_init();
- break;
-
- case DLL_PROCESS_DETACH:
- alc_deinit();
- break;
- }
- return TRUE;
-}
-#else
-#ifdef HAVE_GCC_DESTRUCTOR
static void alc_init(void) __attribute__((constructor));
static void alc_deinit(void) __attribute__((destructor));
-#endif
-#endif
static void alc_init(void)
{
diff --git a/include/AL/al.h b/include/AL/al.h
index c409701..f4cf45b 100644
--- a/include/AL/al.h
+++ b/include/AL/al.h
@@ -5,6 +5,10 @@
extern "C" {
#endif
+#if 1
+ #define AL_API
+ #define AL_APIENTRY
+#else
#if defined(_WIN32) && !defined(_XBOX)
#if defined(AL_BUILD_LIBRARY)
#define AL_API __declspec(dllexport)
@@ -18,6 +22,7 @@ extern "C" {
#define AL_API extern
#endif
#endif
+#endif
#if defined(_WIN32)
#define AL_APIENTRY __cdecl
diff --git a/include/AL/alc.h b/include/AL/alc.h
index 4e84af4..67f8797 100644
--- a/include/AL/alc.h
+++ b/include/AL/alc.h
@@ -5,6 +5,10 @@
extern "C" {
#endif
+#if 1
+ #define ALC_API
+ #define ALC_APIENTRY
+#else
#if defined(_WIN32) && !defined(_XBOX)
#if defined(AL_BUILD_LIBRARY)
#define ALC_API __declspec(dllexport)
@@ -18,6 +22,7 @@ extern "C" {
#define ALC_API extern
#endif
#endif
+#endif
#if defined(_WIN32)
#define ALC_APIENTRY __cdecl
diff --git a/openal.pc.in b/openal.pc.in
index aaf95bb..d78376f 100644
--- a/openal.pc.in
+++ b/openal.pc.in
@@ -7,5 +7,5 @@ Name: OpenAL
Description: OpenAL is a cross-platform 3D audio API
Requires: @PKG_CONFIG_REQUIRES@
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -l@LIBNAME@ @PKG_CONFIG_LIBS@
+Libs: -L${libdir} -l@LIBNAME@ @PKG_CONFIG_LIBS@ -lwinmm
Cflags: -I${includedir}
--
1.7.1

View File

@ -0,0 +1,75 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been taken from:
http://opensource.creative.com/pipermail/openal-devel/2010-November/005759.html
diff -r 37cec05f2c93 CMakeLists.txt
--- a/CMakeLists.txt Sun Nov 28 20:53:45 2010 +0100
+++ b/CMakeLists.txt Sun Nov 28 22:12:22 2010 +0100
@@ -428,6 +428,14 @@
SET(includedir "\${prefix}/include")
SET(PACKAGE_VERSION "${LIB_VERSION}")
+# Library type (static/shared)
+IF(NOT LIBTYPE)
+ SET(LIBTYPE SHARED)
+ENDIF()
+IF(LIBTYPE STREQUAL "STATIC")
+ SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
+ENDIF()
+
# End configuration
CONFIGURE_FILE(
"${OpenAL_SOURCE_DIR}/config.h.in"
@@ -438,9 +446,6 @@
@ONLY)
# Build a library
-IF(NOT LIBTYPE)
- SET(LIBTYPE SHARED)
-ENDIF()
ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY
COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES
@@ -477,6 +482,7 @@
IF(EXAMPLES)
ADD_EXECUTABLE(openal-info examples/openal-info.c)
+ ADD_DEFINITIONS(${PKG_CONFIG_CFLAGS})
TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
INSTALL(TARGETS openal-info
RUNTIME DESTINATION bin
diff -r 37cec05f2c93 include/AL/al.h
--- a/include/AL/al.h Sun Nov 28 20:53:45 2010 +0100
+++ b/include/AL/al.h Sun Nov 28 22:12:22 2010 +0100
@@ -5,7 +5,7 @@
extern "C" {
#endif
-#if defined(_WIN32) && !defined(_XBOX)
+#if defined(_WIN32) && !defined(_XBOX) && !defined(AL_LIBTYPE_STATIC)
#if defined(AL_BUILD_LIBRARY)
#define AL_API __declspec(dllexport)
#else
diff -r 37cec05f2c93 include/AL/alc.h
--- a/include/AL/alc.h Sun Nov 28 20:53:45 2010 +0100
+++ b/include/AL/alc.h Sun Nov 28 22:12:22 2010 +0100
@@ -5,7 +5,7 @@
extern "C" {
#endif
-#if defined(_WIN32) && !defined(_XBOX)
+#if defined(_WIN32) && !defined(_XBOX) && !defined(AL_LIBTYPE_STATIC)
#if defined(AL_BUILD_LIBRARY)
#define ALC_API __declspec(dllexport)
#else
diff -r 37cec05f2c93 openal.pc.in
--- a/openal.pc.in Sun Nov 28 20:53:45 2010 +0100
+++ b/openal.pc.in Sun Nov 28 22:12:22 2010 +0100
@@ -8,4 +8,4 @@
Requires: @PKG_CONFIG_REQUIRES@
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -l@LIBNAME@ @PKG_CONFIG_LIBS@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@

View File

@ -0,0 +1,51 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been taken from:
http://opensource.creative.com/pipermail/openal-devel/2010-November/005759.html
diff -r 37cec05f2c93 Alc/ALc.c
--- a/Alc/ALc.c Sun Nov 28 20:53:45 2010 +0100
+++ b/Alc/ALc.c Sun Nov 28 21:19:52 2010 +0100
@@ -239,7 +239,10 @@
///////////////////////////////////////////////////////
// ALC Related helper functions
-#ifdef _WIN32
+#if defined(HAVE_GCC_DESTRUCTOR)
+static void alc_init(void) __attribute__((constructor));
+static void alc_deinit(void) __attribute__((destructor));
+#elif defined(_WIN32)
static void alc_init(void);
static void alc_deinit(void);
@@ -261,11 +264,6 @@
}
return TRUE;
}
-#else
-#ifdef HAVE_GCC_DESTRUCTOR
-static void alc_init(void) __attribute__((constructor));
-static void alc_deinit(void) __attribute__((destructor));
-#endif
#endif
static void alc_init(void)
diff -r 37cec05f2c93 CMakeLists.txt
--- a/CMakeLists.txt Sun Nov 28 20:53:45 2010 +0100
+++ b/CMakeLists.txt Sun Nov 28 21:19:52 2010 +0100
@@ -123,11 +123,11 @@
"Flags used by the compiler during debug builds."
FORCE)
+ CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
+ int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
+
# Set visibility options if available
IF(NOT WIN32)
- CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
- int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
-
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_SWITCH)
IF(HAVE_VISIBILITY_SWITCH)
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));

View File

@ -0,0 +1,17 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been taken from:
http://opensource.creative.com/pipermail/openal-devel/2010-November/005759.html
diff -r 37cec05f2c93 CMakeLists.txt
--- a/CMakeLists.txt Sun Nov 28 20:53:45 2010 +0100
+++ b/CMakeLists.txt Sun Nov 28 21:24:44 2010 +0100
@@ -376,6 +376,7 @@
SET(BACKENDS "${BACKENDS} WinMM,")
SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
+ SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm)
ENDIF()
ENDIF()
ENDIF()