From 160dedcc8bad127a35150f54d94005b30f18fff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E9=A3=8E=E9=80=8D=E9=81=A5=E6=B8=B8?= Date: Sun, 30 Jul 2023 21:50:32 -0700 Subject: [PATCH 1/7] Add win_flex and win_bison searching on windows --- xmake/modules/detect/tools/find_bison.lua | 5 +++++ xmake/modules/detect/tools/find_flex.lua | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/xmake/modules/detect/tools/find_bison.lua b/xmake/modules/detect/tools/find_bison.lua index 6fafe1dc7f..a32253f205 100644 --- a/xmake/modules/detect/tools/find_bison.lua +++ b/xmake/modules/detect/tools/find_bison.lua @@ -43,6 +43,11 @@ function main(opt) -- find program local program = find_program(opt.program or "bison", opt) + -- try win_bison if bison is not found on windows + if not program and not opt.program and os.host() == "windows" then + program = find_program("win_bison", opt) + end + -- find program version local version = nil if program and opt and opt.version then diff --git a/xmake/modules/detect/tools/find_flex.lua b/xmake/modules/detect/tools/find_flex.lua index 3d127f9ab5..6276000c1f 100644 --- a/xmake/modules/detect/tools/find_flex.lua +++ b/xmake/modules/detect/tools/find_flex.lua @@ -43,6 +43,11 @@ function main(opt) -- find program local program = find_program(opt.program or "flex", opt) + -- try win_flex if flex is not found on windows + if not program and not opt.program and os.host() == "windows" then + program = find_program("win_flex", opt) + end + -- find program version local version = nil if program and opt and opt.version then From 8b55297049276c3bd500f994586dba6428ddf753 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 09:27:04 +0800 Subject: [PATCH 2/7] Update find_bison.lua --- xmake/modules/detect/tools/find_bison.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/modules/detect/tools/find_bison.lua b/xmake/modules/detect/tools/find_bison.lua index a32253f205..fb3f0170fd 100644 --- a/xmake/modules/detect/tools/find_bison.lua +++ b/xmake/modules/detect/tools/find_bison.lua @@ -44,8 +44,8 @@ function main(opt) local program = find_program(opt.program or "bison", opt) -- try win_bison if bison is not found on windows - if not program and not opt.program and os.host() == "windows" then - program = find_program("win_bison", opt) + if not program and is_host("windows") then + program = find_program("win_bison.exe", opt) end -- find program version From fba1d1faa2fcb01b786c2c02274237e90575634c Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 09:27:38 +0800 Subject: [PATCH 3/7] Update find_flex.lua --- xmake/modules/detect/tools/find_flex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/detect/tools/find_flex.lua b/xmake/modules/detect/tools/find_flex.lua index 6276000c1f..3d3a7c6896 100644 --- a/xmake/modules/detect/tools/find_flex.lua +++ b/xmake/modules/detect/tools/find_flex.lua @@ -44,7 +44,7 @@ function main(opt) local program = find_program(opt.program or "flex", opt) -- try win_flex if flex is not found on windows - if not program and not opt.program and os.host() == "windows" then + if not program and is_host("windows") then program = find_program("win_flex", opt) end From c74acf158920e9244cf04d6c989a28776af8ab75 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 09:28:03 +0800 Subject: [PATCH 4/7] Update find_bison.lua --- xmake/modules/detect/tools/find_bison.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/xmake/modules/detect/tools/find_bison.lua b/xmake/modules/detect/tools/find_bison.lua index fb3f0170fd..56eda7dfea 100644 --- a/xmake/modules/detect/tools/find_bison.lua +++ b/xmake/modules/detect/tools/find_bison.lua @@ -36,16 +36,12 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options opt = opt or {} - - -- find program local program = find_program(opt.program or "bison", opt) -- try win_bison if bison is not found on windows if not program and is_host("windows") then - program = find_program("win_bison.exe", opt) + program = find_program("win_bison", opt) end -- find program version @@ -53,7 +49,5 @@ function main(opt) if program and opt and opt.version then version = find_programver(program, opt) end - - -- ok? return program, version end From e888f3f32af2306eb3b8d3b934be196e11430c22 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 09:28:35 +0800 Subject: [PATCH 5/7] Update find_flex.lua --- xmake/modules/detect/tools/find_flex.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xmake/modules/detect/tools/find_flex.lua b/xmake/modules/detect/tools/find_flex.lua index 3d3a7c6896..12ee4365a1 100644 --- a/xmake/modules/detect/tools/find_flex.lua +++ b/xmake/modules/detect/tools/find_flex.lua @@ -36,11 +36,7 @@ import("lib.detect.find_programver") -- @endcode -- function main(opt) - - -- init options opt = opt or {} - - -- find program local program = find_program(opt.program or "flex", opt) -- try win_flex if flex is not found on windows @@ -53,7 +49,5 @@ function main(opt) if program and opt and opt.version then version = find_programver(program, opt) end - - -- ok? return program, version end From cb552e88c55f64f8beccfb1b2612998eb6dbde7c Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 12:14:05 +0800 Subject: [PATCH 6/7] Update find_bison.lua --- xmake/modules/detect/tools/find_bison.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xmake/modules/detect/tools/find_bison.lua b/xmake/modules/detect/tools/find_bison.lua index 56eda7dfea..fcea715743 100644 --- a/xmake/modules/detect/tools/find_bison.lua +++ b/xmake/modules/detect/tools/find_bison.lua @@ -38,13 +38,9 @@ import("lib.detect.find_programver") function main(opt) opt = opt or {} local program = find_program(opt.program or "bison", opt) - - -- try win_bison if bison is not found on windows - if not program and is_host("windows") then + if not program and not opt.program and is_host("windows") then program = find_program("win_bison", opt) end - - -- find program version local version = nil if program and opt and opt.version then version = find_programver(program, opt) From 0ad563bb85cc3875a4ebdf5c742696d00a25e451 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 1 Aug 2023 12:14:31 +0800 Subject: [PATCH 7/7] Update find_flex.lua --- xmake/modules/detect/tools/find_flex.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xmake/modules/detect/tools/find_flex.lua b/xmake/modules/detect/tools/find_flex.lua index 12ee4365a1..640e606d05 100644 --- a/xmake/modules/detect/tools/find_flex.lua +++ b/xmake/modules/detect/tools/find_flex.lua @@ -38,13 +38,9 @@ import("lib.detect.find_programver") function main(opt) opt = opt or {} local program = find_program(opt.program or "flex", opt) - - -- try win_flex if flex is not found on windows - if not program and is_host("windows") then + if not program and not opt.program and is_host("windows") then program = find_program("win_flex", opt) end - - -- find program version local version = nil if program and opt and opt.version then version = find_programver(program, opt)