From 86e36a8ac7458f5cdab2317e86e4ac94273a2a6b Mon Sep 17 00:00:00 2001 From: SFGrenade <25555417+SFGrenade@users.noreply.github.com> Date: Mon, 5 Feb 2024 04:36:29 +0100 Subject: [PATCH] add more versions for libsdl* (#3225) * add more versions for libsdl* mostly github version * use new cmake variable for sdl_image unify on_test * only add new libsdl version, not other parts yet * enable libsdl_image github versions * enabled libsdl_mixer github versions * enabled libsdl_net github versions * enabled libsdl_ttf github versions * only build_shared_libs for libsdl_image * optional wavpack support * add config for wavpack - todo: maybe add xmake configs for all of these * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * add inbetween versions for libsdl_image add 2.22.0 for libsdl_ttf * Update windows.yml --------- Co-authored-by: ruki --- .github/workflows/windows.yml | 2 ++ packages/l/libsdl/xmake.lua | 2 ++ packages/l/libsdl_image/xmake.lua | 14 +++++++++++++- packages/l/libsdl_mixer/xmake.lua | 31 +++++++++++++++++++++++-------- packages/l/libsdl_net/xmake.lua | 10 +++++++++- packages/l/libsdl_ttf/xmake.lua | 30 ++++++++++++++++-------------- 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e0d7f3532..127cbc1dd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -35,6 +35,8 @@ jobs: - name: Tests run: | + git clone https://github.com/xmake-io/xmake.git -b master xmakesrc + $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmakesrc/xmake) if ("${{ matrix.os }}" -eq "windows-2019") { xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --runtimes=${{ matrix.runtimes }} --vs_sdkver=10.0.19041.0 --linkjobs=2 } else { diff --git a/packages/l/libsdl/xmake.lua b/packages/l/libsdl/xmake.lua index 7cabca8db..4941a60a3 100644 --- a/packages/l/libsdl/xmake.lua +++ b/packages/l/libsdl/xmake.lua @@ -36,6 +36,7 @@ package("libsdl") add_versions("archive:2.28.3", "2308d4e4cd5852b3b81934dcc94603454834c14bef49de1cb1230c37ea6dc15c") add_versions("archive:2.28.4", "b53b9b42e731a33552d0a533316a88009b423c16a8a3a418df9ffe498c37da3d") add_versions("archive:2.28.5", "97bd14ee0ec67494d2b93f1a4f7da2bf891103c57090d96fdcc2b019d885c76a") + add_versions("archive:2.30.0", "80b0c02b6018630cd40639ac9fc8e5c1d8eec14d8fe3e6dfa76343e3ba8b78d9") add_versions("github:2.0.8", "release-2.0.8") add_versions("github:2.0.12", "release-2.0.12") add_versions("github:2.0.14", "release-2.0.14") @@ -57,6 +58,7 @@ package("libsdl") add_versions("github:2.28.3", "release-2.28.3") add_versions("github:2.28.4", "release-2.28.4") add_versions("github:2.28.5", "release-2.28.5") + add_versions("github:2.30.0", "release-2.30.0") add_deps("cmake") diff --git a/packages/l/libsdl_image/xmake.lua b/packages/l/libsdl_image/xmake.lua index 3a0a1e685..7f9a4083f 100644 --- a/packages/l/libsdl_image/xmake.lua +++ b/packages/l/libsdl_image/xmake.lua @@ -16,6 +16,10 @@ package("libsdl_image") add_versions("2.6.0", "2252cdfd5be73cefaf727edc39c2ef3b7682e797acbd3126df117e925d46aaf6") add_versions("2.6.1", "cbfea63a46715c63a1db9e41617e550749a95ffd33ef9bd5ba6e58b2bdca6ed3") add_versions("2.6.2", "efe3c229853d0d40c35e5a34c3f532d5d9728f0abc623bc62c962bcef8754205") + add_versions("2.6.3", "b448a8ca5b7927d9bd1577d393f4d6c59581f87ee525652a27e699941db37b7c") + add_versions("2.8.0", "fed33c3fe9f8d38ab4460bdd100c4495be40f8afdac1d44bfcd2b0259b74a123") + add_versions("2.8.1", "0c5afef0ac4bc951a46c6790e576c9b3e7ed2c5ab1d2bbfa5e7e9300718f67d2") + add_versions("2.8.2", "2196ad6665b68fc453a659e172d67fbf18d548277aa07344dfd2deed9d9b84bd") if is_plat("macosx", "iphoneos") then add_frameworks("CoreFoundation", "CoreGraphics", "ImageIO", "CoreServices") @@ -61,5 +65,13 @@ package("libsdl_image") end) on_test(function (package) - assert(package:has_cfuncs("IMG_Init", {includes = {"SDL2/SDL_main.h", "SDL2/SDL_image.h"}})) + assert(package:check_cxxsnippets({test = [[ + #include + #include + int main(int argc, char** argv) { + IMG_Init(IMG_INIT_PNG); + IMG_Quit(); + return 0; + } + ]]}, {configs = {defines = "SDL_MAIN_HANDLED"}})); end) diff --git a/packages/l/libsdl_mixer/xmake.lua b/packages/l/libsdl_mixer/xmake.lua index bff16c531..97b6f15cb 100644 --- a/packages/l/libsdl_mixer/xmake.lua +++ b/packages/l/libsdl_mixer/xmake.lua @@ -9,6 +9,7 @@ package("libsdl_mixer") add_versions("2.6.0", "aca0ffc96a4bf2a56a16536a269de28e341ce38a46a25180bc1ef75e19b08a3a") add_versions("2.6.1", "788c748c1d3a87126511e60995b03526ed4e31e2ba053dffd9dcc8abde97b950") add_versions("2.6.2", "61549615a67e731805ca1df553e005be966a625c1d20fb085bf99edeef6e0469") + add_versions("2.8.0", "02df784cc68723419dd266530ee6964f810a6f02a27b03ecc85689c2e5e442ce") if is_plat("mingw") and is_subhost("msys") then add_extsources("pacman::SDL2_mixer") @@ -35,12 +36,18 @@ package("libsdl_mixer") end) on_install(function (package) - local configs = {"-DSDL2MIXER_SAMPLES=OFF", - "-DSDL2MIXER_FLAC=OFF", - "-DSDL2MIXER_OPUS=OFF", - "-DSDL2MIXER_MOD=OFF", - "-DSDL2MIXER_MIDI=OFF", - "-DSDL2MIXER_CMD=OFF"} + local configs = { + "-DSDL2MIXER_CMD=OFF", + "-DSDL2MIXER_FLAC=OFF", + "-DSDL2MIXER_GME=OFF", + "-DSDL2MIXER_MIDI=OFF", + "-DSDL2MIXER_MOD=OFF", + "-DSDL2MIXER_MP3=ON", -- was on by not being here + "-DSDL2MIXER_OPUS=OFF", + "-DSDL2MIXER_SAMPLES=OFF", + "-DSDL2MIXER_WAVE=ON", -- was on by not being here + "-DSDL2MIXER_WAVPACK=OFF", + } table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) local libsdl = package:dep("libsdl") @@ -51,7 +58,7 @@ package("libsdl_mixer") for _, dir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do if os.isfile(path.join(dir, "SDL_version.h")) then table.insert(configs, "-DSDL2_INCLUDE_DIR=" .. dir) - break + break end end for _, libfile in ipairs(fetchinfo.libfiles) do @@ -65,5 +72,13 @@ package("libsdl_mixer") end) on_test(function (package) - assert(package:has_cfuncs("Mix_Init", {includes = {"SDL2/SDL_main.h", "SDL2/SDL_mixer.h"}})) + assert(package:check_cxxsnippets({test = [[ + #include + #include + int main(int argc, char** argv) { + Mix_Init(MIX_INIT_OGG); + Mix_Quit(); + return 0; + } + ]]}, {configs = {defines = "SDL_MAIN_HANDLED"}})); end) diff --git a/packages/l/libsdl_net/xmake.lua b/packages/l/libsdl_net/xmake.lua index 6258ec4e9..e366e45df 100644 --- a/packages/l/libsdl_net/xmake.lua +++ b/packages/l/libsdl_net/xmake.lua @@ -62,5 +62,13 @@ package("libsdl_net") end) on_test(function (package) - assert(package:has_cfuncs("SDLNet_Init", {includes = {"SDL2/SDL_main.h", "SDL2/SDL_net.h"}, configs = {cxflags = "-sUSE_SDL=0"}})) + assert(package:check_cxxsnippets({test = [[ + #include + #include + int main(int argc, char** argv) { + SDLNet_Init(); + SDLNet_Quit(); + return 0; + } + ]]}, {configs = {defines = "SDL_MAIN_HANDLED"}})); end) diff --git a/packages/l/libsdl_ttf/xmake.lua b/packages/l/libsdl_ttf/xmake.lua index 14b77119b..aa26ec783 100644 --- a/packages/l/libsdl_ttf/xmake.lua +++ b/packages/l/libsdl_ttf/xmake.lua @@ -11,19 +11,13 @@ package("libsdl_ttf") add_extsources("brew::sdl2_ttf") end - if is_plat("windows", "mingw") then - add_urls("https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$(version).zip", - "https://github.com/libsdl-org/SDL_ttf/releases/download/release-$(version)/SDL2_ttf-$(version).zip") - add_versions("2.20.0", "04e94fc5ecac3475ab35c1d5cf52650df691867e7e4befcc861bf982a747111a") - add_versions("2.20.1", "18d81ab399c8e39adababe8918691830ba6e0d6448e5baa141ee0ddf87ede2dc") - add_versions("2.20.2", "aa6256bfcffd8381a75b3a2a2384ac12109b5b148e72722a19b0ede54c4051dc") - else - add_urls("https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$(version).tar.gz", - "https://github.com/libsdl-org/SDL_ttf/releases/download/release-$(version)/SDL2_ttf-$(version).tar.gz") - add_versions("2.20.0", "874680232b72839555a558b48d71666b562e280f379e673b6f0c7445ea3b9b8a") - add_versions("2.20.1", "78cdad51f3cc3ada6932b1bb6e914b33798ab970a1e817763f22ddbfd97d0c57") - add_versions("2.20.2", "9dc71ed93487521b107a2c4a9ca6bf43fb62f6bddd5c26b055e6b91418a22053") - end + add_urls("https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$(version).zip", + "https://github.com/libsdl-org/SDL_ttf/releases/download/release-$(version)/SDL2_ttf-$(version).zip") + + add_versions("2.20.0", "04e94fc5ecac3475ab35c1d5cf52650df691867e7e4befcc861bf982a747111a") + add_versions("2.20.1", "18d81ab399c8e39adababe8918691830ba6e0d6448e5baa141ee0ddf87ede2dc") + add_versions("2.20.2", "aa6256bfcffd8381a75b3a2a2384ac12109b5b148e72722a19b0ede54c4051dc") + add_versions("2.22.0", "5766070145111cb047807fa3f91c2c6b81bc1008d63817e100417959b42a2484") add_patches(">=2.20.0 <=2.20.1", path.join(os.scriptdir(), "patches", "2.20.1", "cmakelists.patch"), "fe04ada62d9ed70029c0efb3c04bfec22fc7596bd6b73a567beb964e61ebd82c") @@ -101,5 +95,13 @@ package("libsdl_ttf") end) on_test(function (package) - assert(package:has_cfuncs("TTF_Init", {includes = {"SDL2/SDL_main.h", "SDL2/SDL_ttf.h"}})) + assert(package:check_cxxsnippets({test = [[ + #include + #include + int main(int argc, char** argv) { + TTF_Init(); + TTF_Quit(); + return 0; + } + ]]}, {configs = {defines = "SDL_MAIN_HANDLED"}})); end)