From f8a625260089222358d15edf9ef8fe714caeccd1 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 6 Nov 2024 16:23:01 +0800 Subject: [PATCH] flex: fix msys --- packages/f/flex/xmake.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/f/flex/xmake.lua b/packages/f/flex/xmake.lua index 3c35a411d..415cc8835 100644 --- a/packages/f/flex/xmake.lua +++ b/packages/f/flex/xmake.lua @@ -1,5 +1,5 @@ package("flex") - set_kind("binary") + set_kind("library") set_homepage("https://github.com/westes/flex/") set_license("BSD-2-Clause") @@ -15,11 +15,7 @@ package("flex") add_urls("https://github.com/westes/flex/releases/download/v$(version)/flex-$(version).tar.gz") end - if is_subhost("msys") then - add_deps("pacman::flex") - end - - on_load("macosx", "linux", "bsd", "windows", function (package) + on_load("macosx", "linux", "bsd", "windows", "@msys", function (package) if package:is_plat("windows") then package:add("deps", "winflexbison", {private = true}) elseif package:is_plat("linux") then @@ -35,6 +31,13 @@ package("flex") end) on_install("@msys", function (package) + os.vrun("pacman -Sy --noconfirm --needed --disable-download-timeout flex") + -- https://github.com/msys2/MSYS2-packages/issues/1911 + if package:is_library() then + local msys_dir = os.getenv("MINGW_PREFIX") + local header = path.join(path.directory(msys_dir), "usr/include/FlexLexer.h") + os.vcp(header, package:installdir("include")) + end end) on_install("windows", function (package)