From e8e9c3380b4aec761f781927c2434b75db50aa90 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 28 Aug 2024 20:14:56 +0800 Subject: [PATCH] libedit: rename editline package (#5076) * ncurses: fix widec config * libedit: rename to editline * fix find ncurses (hack --- packages/{e/editline => l/libedit}/xmake.lua | 19 ++++++++++++++++--- packages/n/ncurses/xmake.lua | 12 ++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) rename packages/{e/editline => l/libedit}/xmake.lua (73%) diff --git a/packages/e/editline/xmake.lua b/packages/l/libedit/xmake.lua similarity index 73% rename from packages/e/editline/xmake.lua rename to packages/l/libedit/xmake.lua index c73a47471..2f180983c 100644 --- a/packages/e/editline/xmake.lua +++ b/packages/l/libedit/xmake.lua @@ -1,4 +1,4 @@ -package("editline") +package("libedit") set_homepage("http://thrysoee.dk/editline") set_description("Autotool- and libtoolized port of the NetBSD Editline library (libedit).") set_license("BSD-3-Clause") @@ -7,7 +7,11 @@ package("editline") add_versions("3.1", "5f0573349d77c4a48967191cdd6634dd7aa5f6398c6a57fe037cc02696d6099f") - add_configs("terminal_db", {description = "Select terminal library", default = "termcap", type = "string", values = {"termcap", "ncurses", "tinfo"}}) + add_configs("terminal_db", {description = "Select terminal library", default = "ncurses", type = "string", values = {"termcap", "ncurses", "tinfo"}}) + + if is_plat("linux") then + add_extsources("apt::libedit-dev") + end add_includedirs("include", "include/editline") @@ -29,7 +33,16 @@ package("editline") local configs = {"--disable-examples"} table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) - import("package.tools.autoconf").install(package, configs, {packagedeps = package:config("terminal_db")}) + + local terminal_db = package:config("terminal_db") + if terminal_db == "ncurses" then + local widec = package:dep("ncurses"):config("widec") + if widec then + -- hack + io.replace("configure", "-lncurses", "-lncursesw", {plain = true}) + end + end + import("package.tools.autoconf").install(package, configs, {packagedeps = terminal_db}) end) on_test(function (package) diff --git a/packages/n/ncurses/xmake.lua b/packages/n/ncurses/xmake.lua index 428ddceae..17983b0a0 100644 --- a/packages/n/ncurses/xmake.lua +++ b/packages/n/ncurses/xmake.lua @@ -43,15 +43,15 @@ package("ncurses") } table.insert(configs, "--with-debug=" .. (package:is_debug() and "yes" or "no")) - if package:config("widec") then - table.insert(configs, "--enable-widec") - end - if package:config("shared") then - table.insert(configs, "--with-shared") - end + table.insert(configs, "--with-shared=" .. (package:config("shared") and "yes" or "no")) + table.insert(configs, "--enable-widec=" .. (package:config("widec") and "yes" or "no")) import("package.tools.autoconf").install(package, configs, {arflags = {"-curvU"}}) end) on_test(function (package) assert(package:has_cfuncs("initscr", {includes = "curses.h"})) end) + + on_test(function (package) + assert(package:has_cfuncs("initscr", {includes = "curses.h"})) + end)