From nobody Wed Jul 06 17:36:38 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 44A091D1335B; Wed, 6 Jul 2022 17:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LdRYM146Vz3LjD; Wed, 6 Jul 2022 17:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657128999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QF0cyeOwCDHl0HvBJd+6C2Q8KRQVY1SetqKBFz6xC/M=; b=qBL5qyD0L+MAP4kdmm1flajjZGd3JyjR+BAkgyd4OjesndvuMEq5pUmaB/4gJyezKpb0Jc UEjvYcGG1l/CW6s06hWdfG3SRQrcLRSjnNZcQI6Ye4vsi64YiAhtHs9rih+Ye/UdLo313L f9rFkfuwR6+/UdvXZJFXaHBFiWujv6jZH0TGguMqQySygvUjdfs3ZEItqdYNw5UxKA57im C+9R0oGXXHAnlpmtSWaqrqwzgSA533+rL9Z0v8CFrGjyfDigMTAb5eE7qtbLLvC12mRztk wuZL+Jf9rAOLOwpPnBIrvOSDmjpPYeBiH+C+RfCNFBqtLrd9y84T7s/rwdnWdw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00A781ECBF; Wed, 6 Jul 2022 17:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 266Hacre024648; Wed, 6 Jul 2022 17:36:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 266HacVJ024647; Wed, 6 Jul 2022 17:36:38 GMT (envelope-from git) Date: Wed, 6 Jul 2022 17:36:38 GMT Message-Id: <202207061736.266HacVJ024647@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Alexey Dokuchaev Subject: git: a4aac455499f - main - editors/lite: text editor written mostly in Lua (new port added) List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: danfe X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4aac455499f337ffbc145f7abe2a58fce71cb4c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657128999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QF0cyeOwCDHl0HvBJd+6C2Q8KRQVY1SetqKBFz6xC/M=; b=PE07Gp7yD89wyxyaUKHCU5wX+E2+YSPihdJeUH/WRs8+6jOfIy+Z5JK0bgHbqJ5Rs6/fnA WMKiwRhVoR+eq1hRly10GKCUNbc1mrMB7sxs4XjSH4z4LS9HVdRpAn0yfa3NfmdFC7QP+K j3Rlni81MhCO69nsC7uUYm2TkQoY0EYwJrVYEN1m0ypGsSmQP+QsaU94JdMpMBV1meSZdv eghtSWTmhua0hj4L5h8wwhPGfZu4f5xKcLHmAy9L1qz0LbElgwq3BNPGR1MVNWm34w0UUQ C0rHxGRj0mHGIqJNUA61ize6GhPJNPBXWP7c9AJVXhSh7CKP8AAoADPqSDB2mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657128999; a=rsa-sha256; cv=none; b=AOME0ZDiETKrWmlUmMjypbOep6Vkph7a1wEo2Ev9nk3JtuusSFc3qLB+AL0Mj3EGmKXZtc WAcLWjbPm+YfxQp3hAAT2JhHNRrmbm4Ld4USWMhQcTOUzMedV607lK4la+S9/TIMXmA8OM hRhIhfs/cfS7iT+hDhU+MlEAiIiNGJVZNlrjgTfLUoFbJ4qxoDl8D26K3Wt9V+IEx3ood0 gcunTmeyU083SmYHjPZH092csFcEstSZC/+K2Wd/sQwlvbpk7mIOEACOyJzT6Vgt4ct8kM hIr9tI8Q1cd9YJHgbWf6/vCkoKzJL2J0MZw9mRVWufAq9vG9Exgkry14ndBp8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by danfe: URL: https://cgit.FreeBSD.org/ports/commit/?id=a4aac455499f337ffbc145f7abe2a58fce71cb4c commit a4aac455499f337ffbc145f7abe2a58fce71cb4c Author: Alexey Dokuchaev AuthorDate: 2022-07-06 17:35:14 +0000 Commit: Alexey Dokuchaev CommitDate: 2022-07-06 17:35:14 +0000 editors/lite: text editor written mostly in Lua (new port added) It aims to provide something practical, pretty, small, and fast, implemented as simply as possible; easy to modify and extend via plugins, or to use without doing either. WWW: https://github.com/rxi/lite --- editors/Makefile | 1 + editors/lite/Makefile | 46 ++++++++++++++++++++ editors/lite/distinfo | 3 ++ editors/lite/files/makefile | 25 +++++++++++ .../lite/files/patch-data_core_commands_core.lua | 11 +++++ editors/lite/files/patch-data_core_init.lua | 49 ++++++++++++++++++++++ editors/lite/files/patch-data_core_style.lua | 17 ++++++++ editors/lite/files/patch-src_main.c | 34 +++++++++++++++ editors/lite/pkg-descr | 6 +++ editors/lite/pkg-plist | 48 +++++++++++++++++++++ 10 files changed, 240 insertions(+) diff --git a/editors/Makefile b/editors/Makefile index 283e9163216c..7d6e629ecb85 100644 --- a/editors/Makefile +++ b/editors/Makefile @@ -193,6 +193,7 @@ SUBDIR += linux-sublime-text4 SUBDIR += linux-sublime3 SUBDIR += linux-wps-office + SUBDIR += lite SUBDIR += madedit SUBDIR += marker SUBDIR += mg diff --git a/editors/lite/Makefile b/editors/lite/Makefile new file mode 100644 index 000000000000..b5fe9d81aa3d --- /dev/null +++ b/editors/lite/Makefile @@ -0,0 +1,46 @@ +# Created by: Alexey Dokuchaev + +PORTNAME= lite +PORTVERSION= 1.11 +CATEGORIES= editors +PKGNAMESUFFIX= -editor # PORTNAME alone is too vague + +MAINTAINER= danfe@FreeBSD.org +COMMENT= Lightweight text editor written mostly in Lua + +LICENSE= MIT + +USES= gmake lua pkgconfig sdl +USE_SDL= sdl2 + +USE_GITHUB= yes +GH_ACCOUNT= rxi +GH_TAGNAME= 38bd9b3 + +BUILD_WRKSRC= ${WRKSRC}/src +MAKEFILE= ${FILESDIR}/makefile + +PORTDOCS= usage.md + +OPTIONS_DEFINE= DOCS + +post-extract: +# Prevent accidental build/use of bundled code/headers + @${RM} -r ${BUILD_WRKSRC}/lib/lua52 ${WRKSRC}/winlib + +post-patch: + @${REINPLACE_CMD} -e '/^#include/s,lib/lua52/,,' \ + ${BUILD_WRKSRC}/api/api.h + @${REINPLACE_CMD} -e 's,%%DATADIR%%,${DATADIR},' \ + ${BUILD_WRKSRC}/main.c + +do-install: + ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${PORTNAME} \ + ${STAGEDIR}${PREFIX}/bin + ${CP} -a ${WRKSRC}/data ${STAGEDIR}${DATADIR} + +do-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/doc/* ${STAGEDIR}${DOCSDIR} + +.include diff --git a/editors/lite/distinfo b/editors/lite/distinfo new file mode 100644 index 000000000000..f7e67df7767a --- /dev/null +++ b/editors/lite/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1610208177 +SHA256 (rxi-lite-1.11-38bd9b3_GH0.tar.gz) = 63b0f22eb90f38564736f56d4d0f51f7219fcb7fe6398018e3435a62badd10d9 +SIZE (rxi-lite-1.11-38bd9b3_GH0.tar.gz) = 10707650 diff --git a/editors/lite/files/makefile b/editors/lite/files/makefile new file mode 100644 index 000000000000..5274d363e360 --- /dev/null +++ b/editors/lite/files/makefile @@ -0,0 +1,25 @@ +CFLAGS+= -Wall -Wextra +CPPFLAGS+= -DLUA_USE_POSIX -I. \ + $(shell pkg-config --cflags lua-$(LUA_VER) sdl2) +LIBS= $(shell pkg-config --libs lua-$(LUA_VER) sdl2) + +lite_OBJS= api/api.o \ + api/renderer.o \ + api/renderer_font.o \ + api/system.o \ + lib/stb/stb_truetype.o \ + main.o \ + rencache.o \ + renderer.o + +CCACHE?= $(shell command -v ccache) + +%.o: %.c + $(CCACHE) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< + +lite: $(lite_OBJS) + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +all: lite + +.PHONY: all install diff --git a/editors/lite/files/patch-data_core_commands_core.lua b/editors/lite/files/patch-data_core_commands_core.lua new file mode 100644 index 000000000000..5be8d1f4ead5 --- /dev/null +++ b/editors/lite/files/patch-data_core_commands_core.lua @@ -0,0 +1,11 @@ +--- data/core/commands/core.lua.orig 2021-01-09 16:02:57 UTC ++++ data/core/commands/core.lua +@@ -85,7 +85,7 @@ command.add(nil, { + end, + + ["core:open-user-module"] = function() +- core.root_view:open_doc(core.open_doc(EXEDIR .. "/data/user/init.lua")) ++ core.root_view:open_doc(core.open_doc(DATADIR .. "/user/init.lua")) + end, + + ["core:open-project-module"] = function() diff --git a/editors/lite/files/patch-data_core_init.lua b/editors/lite/files/patch-data_core_init.lua new file mode 100644 index 000000000000..7d13910080af --- /dev/null +++ b/editors/lite/files/patch-data_core_init.lua @@ -0,0 +1,49 @@ +--- data/core/init.lua.orig 2021-01-09 16:02:57 UTC ++++ data/core/init.lua +@@ -82,7 +82,7 @@ function core.init() + CommandView = require "core.commandview" + Doc = require "core.doc" + +- local project_dir = EXEDIR ++ local project_dir = os.getenv("HOME") or EXEDIR + local files = {} + for i = 2, #ARGS do + local info = system.get_file_info(ARGS[i]) or {} +@@ -131,16 +131,16 @@ local function delete_temp_files() + local temp_file_counter = 0 + + local function delete_temp_files() +- for _, filename in ipairs(system.list_dir(EXEDIR)) do ++ for _, filename in ipairs(system.list_dir("/tmp")) do + if filename:find(temp_file_prefix, 1, true) == 1 then +- os.remove(EXEDIR .. PATHSEP .. filename) ++ os.remove("/tmp" .. PATHSEP .. filename) + end + end + end + + function core.temp_filename(ext) + temp_file_counter = temp_file_counter + 1 +- return EXEDIR .. PATHSEP .. temp_file_prefix ++ return "/tmp" .. PATHSEP .. temp_file_prefix + .. string.format("%06x", temp_file_counter) .. (ext or "") + end + +@@ -174,7 +174,7 @@ function core.load_plugins() + + function core.load_plugins() + local no_errors = true +- local files = system.list_dir(EXEDIR .. "/data/plugins") ++ local files = system.list_dir(DATADIR .. "/plugins") + for _, filename in ipairs(files) do + local modname = "plugins." .. filename:gsub(".lua$", "") + local ok = core.try(require, modname) +@@ -464,7 +464,7 @@ function core.on_error(err) + + function core.on_error(err) + -- write error to file +- local fp = io.open(EXEDIR .. "/error.txt", "wb") ++ local fp = io.open("/tmp/lite-error.txt", "wb") + fp:write("Error: " .. tostring(err) .. "\n") + fp:write(debug.traceback(nil, 4)) + fp:close() diff --git a/editors/lite/files/patch-data_core_style.lua b/editors/lite/files/patch-data_core_style.lua new file mode 100644 index 000000000000..5107bf8479ef --- /dev/null +++ b/editors/lite/files/patch-data_core_style.lua @@ -0,0 +1,17 @@ +--- data/core/style.lua.orig 2021-01-09 16:02:57 UTC ++++ data/core/style.lua +@@ -7,10 +7,10 @@ style.tab_width = common.round(170 * SCALE) + style.caret_width = common.round(2 * SCALE) + style.tab_width = common.round(170 * SCALE) + +-style.font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 14 * SCALE) +-style.big_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 34 * SCALE) +-style.icon_font = renderer.font.load(EXEDIR .. "/data/fonts/icons.ttf", 14 * SCALE) +-style.code_font = renderer.font.load(EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE) ++style.font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 14 * SCALE) ++style.big_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", 34 * SCALE) ++style.icon_font = renderer.font.load(DATADIR .. "/fonts/icons.ttf", 14 * SCALE) ++style.code_font = renderer.font.load(DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE) + + style.background = { common.color "#2e2e32" } + style.background2 = { common.color "#252529" } diff --git a/editors/lite/files/patch-src_main.c b/editors/lite/files/patch-src_main.c new file mode 100644 index 000000000000..1041196a88a6 --- /dev/null +++ b/editors/lite/files/patch-src_main.c @@ -0,0 +1,34 @@ +--- src/main.c.orig 2021-01-09 16:02:57 UTC ++++ src/main.c +@@ -9,6 +9,8 @@ + #include + #elif __APPLE__ + #include ++#elif __FreeBSD__ ++ #include + #endif + + +@@ -38,6 +40,10 @@ static void get_exe_filename(char *buf, int sz) { + #elif __APPLE__ + unsigned size = sz; + _NSGetExecutablePath(buf, &size); ++#elif __FreeBSD__ ++ size_t len = sz; ++ const int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; ++ sysctl(mib, 4, buf, &len, NULL, 0); + #else + strcpy(buf, "./lite"); + #endif +@@ -123,8 +129,9 @@ int main(int argc, char **argv) { + " SCALE = tonumber(os.getenv(\"LITE_SCALE\")) or SCALE\n" + " PATHSEP = package.config:sub(1, 1)\n" + " EXEDIR = EXEFILE:match(\"^(.+)[/\\\\].*$\")\n" +- " package.path = EXEDIR .. '/data/?.lua;' .. package.path\n" +- " package.path = EXEDIR .. '/data/?/init.lua;' .. package.path\n" ++ " DATADIR = '%%DATADIR%%'\n" ++ " package.path = DATADIR .. '/?.lua;' .. package.path\n" ++ " package.path = DATADIR .. '/?/init.lua;' .. package.path\n" + " core = require('core')\n" + " core.init()\n" + " core.run()\n" diff --git a/editors/lite/pkg-descr b/editors/lite/pkg-descr new file mode 100644 index 000000000000..7f5c781f0471 --- /dev/null +++ b/editors/lite/pkg-descr @@ -0,0 +1,6 @@ +lite is a lightweight text editor written mostly in Lua. It aims to +provide something practical, pretty, small, and fast, implemented as +simply as possible; easy to modify and extend via plugins, or to use +without doing either. + +WWW: https://github.com/rxi/lite diff --git a/editors/lite/pkg-plist b/editors/lite/pkg-plist new file mode 100644 index 000000000000..e3028f0a1938 --- /dev/null +++ b/editors/lite/pkg-plist @@ -0,0 +1,48 @@ +bin/lite +%%DATADIR%%/core/command.lua +%%DATADIR%%/core/commands/command.lua +%%DATADIR%%/core/commands/core.lua +%%DATADIR%%/core/commands/doc.lua +%%DATADIR%%/core/commands/findreplace.lua +%%DATADIR%%/core/commands/root.lua +%%DATADIR%%/core/commandview.lua +%%DATADIR%%/core/common.lua +%%DATADIR%%/core/config.lua +%%DATADIR%%/core/doc/highlighter.lua +%%DATADIR%%/core/doc/init.lua +%%DATADIR%%/core/doc/search.lua +%%DATADIR%%/core/doc/translate.lua +%%DATADIR%%/core/docview.lua +%%DATADIR%%/core/init.lua +%%DATADIR%%/core/keymap.lua +%%DATADIR%%/core/logview.lua +%%DATADIR%%/core/object.lua +%%DATADIR%%/core/rootview.lua +%%DATADIR%%/core/statusview.lua +%%DATADIR%%/core/strict.lua +%%DATADIR%%/core/style.lua +%%DATADIR%%/core/syntax.lua +%%DATADIR%%/core/tokenizer.lua +%%DATADIR%%/core/view.lua +%%DATADIR%%/fonts/font.ttf +%%DATADIR%%/fonts/icons.ttf +%%DATADIR%%/fonts/monospace.ttf +%%DATADIR%%/plugins/autocomplete.lua +%%DATADIR%%/plugins/autoreload.lua +%%DATADIR%%/plugins/language_c.lua +%%DATADIR%%/plugins/language_css.lua +%%DATADIR%%/plugins/language_js.lua +%%DATADIR%%/plugins/language_lua.lua +%%DATADIR%%/plugins/language_md.lua +%%DATADIR%%/plugins/language_python.lua +%%DATADIR%%/plugins/language_xml.lua +%%DATADIR%%/plugins/macro.lua +%%DATADIR%%/plugins/projectsearch.lua +%%DATADIR%%/plugins/quote.lua +%%DATADIR%%/plugins/reflow.lua +%%DATADIR%%/plugins/tabularize.lua +%%DATADIR%%/plugins/treeview.lua +%%DATADIR%%/plugins/trimwhitespace.lua +%%DATADIR%%/user/colors/fall.lua +%%DATADIR%%/user/colors/summer.lua +%%DATADIR%%/user/init.lua