mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 20:03:02 +08:00
[sdl1] Enable mingw (#25095)
* Portfile CMake style * Fix mingw * Add polyfill for missing 'which' * Add patch for relocatable sdl-config Fixes mingw on Windows builds. * Update versions * CR requests * Remove man3 * Update versions
This commit is contained in:
parent
0a74827c24
commit
7a199e7786
@ -7,13 +7,13 @@ vcpkg_from_github(
|
|||||||
PATCHES
|
PATCHES
|
||||||
export-symbols-only-in-shared-build.patch
|
export-symbols-only-in-shared-build.patch
|
||||||
fix-linux-build.patch
|
fix-linux-build.patch
|
||||||
|
sdl-config.patch
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(${SOURCE_PATH}/include/SDL_config.h.default ${SOURCE_PATH}/include/SDL_config.h COPYONLY)
|
configure_file("${SOURCE_PATH}/include/SDL_config.h.default" "${SOURCE_PATH}/include/SDL_config.h" COPYONLY)
|
||||||
|
|
||||||
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||||
if (VCPKG_TARGET_IS_WINDOWS)
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/SDL1_2017.sln" DESTINATION "${SOURCE_PATH}/VisualC/")
|
||||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDL1_2017.sln DESTINATION ${SOURCE_PATH}/VisualC/ )
|
|
||||||
|
|
||||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||||
set(LIB_TYPE StaticLibrary)
|
set(LIB_TYPE StaticLibrary)
|
||||||
@ -21,7 +21,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
|
|||||||
set(LIB_TYPE DynamicLibrary)
|
set(LIB_TYPE DynamicLibrary)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
||||||
set(CRT_TYPE_DBG MultiThreadedDebugDLL)
|
set(CRT_TYPE_DBG MultiThreadedDebugDLL)
|
||||||
set(CRT_TYPE_REL MultiThreadedDLL)
|
set(CRT_TYPE_REL MultiThreadedDLL)
|
||||||
else()
|
else()
|
||||||
@ -29,14 +29,14 @@ if (VCPKG_TARGET_IS_WINDOWS)
|
|||||||
set(CRT_TYPE_REL MultiThreaded)
|
set(CRT_TYPE_REL MultiThreaded)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(${CURRENT_PORT_DIR}/SDL.vcxproj.in ${SOURCE_PATH}/VisualC/SDL/SDL.vcxproj @ONLY)
|
configure_file("${CURRENT_PORT_DIR}/SDL.vcxproj.in" "${SOURCE_PATH}/VisualC/SDL/SDL.vcxproj" @ONLY)
|
||||||
configure_file(${CURRENT_PORT_DIR}/SDLmain.vcxproj.in ${SOURCE_PATH}/VisualC/SDLmain/SDLmain.vcxproj @ONLY)
|
configure_file("${CURRENT_PORT_DIR}/SDLmain.vcxproj.in" "${SOURCE_PATH}/VisualC/SDLmain/SDLmain.vcxproj" @ONLY)
|
||||||
|
|
||||||
# This text file gets copied as a library, and included as one in the package
|
# This text file gets copied as a library, and included as one in the package
|
||||||
file(REMOVE_RECURSE ${SOURCE_PATH}/src/hermes/COPYING.LIB)
|
file(REMOVE_RECURSE "${SOURCE_PATH}/src/hermes/COPYING.LIB")
|
||||||
|
|
||||||
vcpkg_install_msbuild(
|
vcpkg_install_msbuild(
|
||||||
SOURCE_PATH ${SOURCE_PATH}
|
SOURCE_PATH "${SOURCE_PATH}"
|
||||||
PROJECT_SUBPATH VisualC/SDL1_2017.sln
|
PROJECT_SUBPATH VisualC/SDL1_2017.sln
|
||||||
INCLUDES_SUBPATH include
|
INCLUDES_SUBPATH include
|
||||||
LICENSE_SUBPATH COPYING
|
LICENSE_SUBPATH COPYING
|
||||||
@ -44,47 +44,44 @@ if (VCPKG_TARGET_IS_WINDOWS)
|
|||||||
)
|
)
|
||||||
|
|
||||||
#Take all the fils into include/SDL to sovle conflict with SDL2 port
|
#Take all the fils into include/SDL to sovle conflict with SDL2 port
|
||||||
file(GLOB files ${CURRENT_PACKAGES_DIR}/include/*)
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/doxyfile")
|
||||||
foreach(file ${files})
|
file(RENAME "${CURRENT_PACKAGES_DIR}/include" "${CURRENT_PACKAGES_DIR}/include.tmp")
|
||||||
file(COPY ${file} DESTINATION ${CURRENT_PACKAGES_DIR}/include/SDL)
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
|
||||||
file(REMOVE ${file})
|
file(RENAME "${CURRENT_PACKAGES_DIR}/include.tmp" "${CURRENT_PACKAGES_DIR}/include/SDL")
|
||||||
endforeach()
|
|
||||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/SDL/doxyfile)
|
|
||||||
|
|
||||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link")
|
||||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
|
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/SDLmain.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/SDLmain.lib")
|
||||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/SDLmain.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/SDLmain.lib)
|
if(NOT DEFINED VCPKG_BUILD_TYPE)
|
||||||
endif()
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link")
|
||||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/SDLmain.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDLmaind.lib")
|
||||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
|
|
||||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/SDLmain.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDLmaind.lib)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message("libgles2-mesa-dev must be installed before sdl1 can build. Install it with \"apt install libgles2-mesa-dev\".")
|
if(VCPKG_TARGET_IS_LINUX)
|
||||||
|
message("libgles2-mesa-dev must be installed before sdl1 can build. Install it with \"apt install libgles2-mesa-dev\".")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(WHICH_COMMAND NAMES which)
|
||||||
|
if(NOT WHICH_COMMAND)
|
||||||
|
set(polyfill_scripts "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-bin")
|
||||||
|
file(REMOVE_RECURSE "${polyfill_scripts}")
|
||||||
|
file(MAKE_DIRECTORY "${polyfill_scripts}")
|
||||||
|
vcpkg_host_path_list(APPEND ENV{PATH} "${polyfill_scripts}")
|
||||||
|
# sdl's autoreconf.sh needs `which`, but our msys root doesn't have it.
|
||||||
|
file(WRITE "${polyfill_scripts}/which" "#!/bin/sh\nif test -f \"/usr/bin/\$1\"; then echo \"/usr/bin/\$1\"; else false; fi\n")
|
||||||
|
file(CHMOD "${polyfill_scripts}/which" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||||
|
endif()
|
||||||
|
|
||||||
vcpkg_configure_make(
|
vcpkg_configure_make(
|
||||||
SOURCE_PATH ${SOURCE_PATH}
|
SOURCE_PATH "${SOURCE_PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
vcpkg_install_make()
|
vcpkg_install_make()
|
||||||
vcpkg_fixup_pkgconfig(IGNORE_FLAGS -Wl,-rpath,${CURRENT_PACKAGES_DIR}/lib/pkgconfig/../../lib
|
vcpkg_fixup_pkgconfig()
|
||||||
-Wl,-rpath,${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/../../lib
|
|
||||||
SYSTEM_LIBRARIES pthread)
|
|
||||||
|
|
||||||
file(GLOB SDL1_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*")
|
file(REMOVE_RECURSE
|
||||||
foreach (SDL1_TOOL ${SDL1_TOOLS})
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||||
file(COPY ${SDL1_TOOL} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
"${CURRENT_PACKAGES_DIR}/share/${PORT}/man3"
|
||||||
file(REMOVE ${SDL1_TOOL})
|
)
|
||||||
endforeach()
|
|
||||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
|
||||||
|
|
||||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
|
||||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
||||||
|
|
||||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/sdl1/bin/sdl-config")
|
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/sdl1/bin/sdl-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../..")
|
endif()
|
||||||
endif()
|
|
||||||
if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/sdl1/debug/bin/sdl-config")
|
|
||||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/sdl1/debug/bin/sdl-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../..")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
13
ports/sdl1/sdl-config.patch
Normal file
13
ports/sdl1/sdl-config.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/sdl-config.in b/sdl-config.in
|
||||||
|
index e0fcc0c..de602d8 100644
|
||||||
|
--- a/sdl-config.in
|
||||||
|
+++ b/sdl-config.in
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
-prefix=@prefix@
|
||||||
|
+DIRNAME=$(dirname $0)
|
||||||
|
+prefix=$(CDPATH= cd -- "${DIRNAME%/tools/sdl1/*}" && pwd -P)
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
exec_prefix_set=no
|
||||||
|
libdir=@libdir@
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "sdl1",
|
"name": "sdl1",
|
||||||
"version": "1.2.15",
|
"version": "1.2.15",
|
||||||
"port-version": 16,
|
"port-version": 17,
|
||||||
"description": "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.",
|
"description": "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.",
|
||||||
"homepage": "https://www.libsdl.org",
|
"homepage": "https://www.libsdl.org",
|
||||||
"license": "LGPL-2.1+",
|
"license": "LGPL-2.1-or-later",
|
||||||
"supports": "!osx & !uwp"
|
"supports": "!osx & !uwp"
|
||||||
}
|
}
|
||||||
|
@ -6410,7 +6410,7 @@
|
|||||||
},
|
},
|
||||||
"sdl1": {
|
"sdl1": {
|
||||||
"baseline": "1.2.15",
|
"baseline": "1.2.15",
|
||||||
"port-version": 16
|
"port-version": 17
|
||||||
},
|
},
|
||||||
"sdl1-net": {
|
"sdl1-net": {
|
||||||
"baseline": "1.2.8",
|
"baseline": "1.2.8",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"git-tree": "45b686784ad1b01e7cfa7988bc3f95bf9aff6b6a",
|
||||||
|
"version": "1.2.15",
|
||||||
|
"port-version": 17
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git-tree": "5ffe0bac6645cd0fe0c98a0c33cf86a6bc2ddcfc",
|
"git-tree": "5ffe0bac6645cd0fe0c98a0c33cf86a6bc2ddcfc",
|
||||||
"version": "1.2.15",
|
"version": "1.2.15",
|
||||||
|
Loading…
Reference in New Issue
Block a user