1DOLLY 72TOOLCHAIN neovim-build3REQUIRES HOST runtime@04REQUIRES HOST display@05REQUIRES HOST input@06REQUIRES HOST download@07REQUIRES HOST dso@08REQUIRES HOST http@09REQUIRES HOST upload@01011# Reusable Neovim build artifacts.12FROM /v0.1.2/demos/cmake/Dollyfile-cmake-build 7c1a8aa0eb6e27afe59c40294c79d4c556f031f85f2cbcd01f85e9fd328feed113# Neovim supports PUC Lua 5.1. Build the upstream interpreter and C library;14# -rdynamic lets source-built Lua C modules share that interpreter's API.15REQUIRES HEADER libc16REQUIRES TOOL cc17REQUIRES TOOL ar18REQUIRES TOOL make19REQUIRES TOOL gzip20REQUIRES TOOL tar21REQUIRES TOOL mkdir22REQUIRES TOOL cp23REQUIRES TOOL rm24REQUIRES TOOL sed2526SOURCE /v0.1.2/dist/static/neovim/lua-5.1.5.tar.gz 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 /tmp/lua/source.tar.gz27SLOP gzip -dc /tmp/lua/source.tar.gz > /tmp/lua/source.tar28SLOP tar -xf /tmp/lua/source.tar -C /tmp/lua29SLOP sed 's@"/usr/local/"@"/usr/"@' /tmp/lua/lua-5.1.5/src/luaconf.h > /tmp/lua/luaconf.h30SLOP cp /tmp/lua/luaconf.h /tmp/lua/lua-5.1.5/src/luaconf.h31SLOP make -C /tmp/lua/lua-5.1.5/src \32  CC=cc \33  'CFLAGS=-O0 -std=gnu99 -DLUA_USE_POSIX -DLUA_USE_DLOPEN' \34  MYLDFLAGS=-rdynamic \35  'AR=ar rcs' \36  RANLIB=: \37  lua38SLOP cp /tmp/lua/lua-5.1.5/src/lua /usr/bin/lua39SLOP cp /tmp/lua/lua-5.1.5/src/liblua.a /usr/lib/liblua.a40SLOP mkdir -p /usr/include/lua5.1 /usr/share/licenses/lua41SLOP cp /tmp/lua/lua-5.1.5/src/lua.h /tmp/lua/lua-5.1.5/src/luaconf.h \42  /tmp/lua/lua-5.1.5/src/lauxlib.h /tmp/lua/lua-5.1.5/src/lualib.h /usr/include/lua5.143SLOP cp /tmp/lua/lua-5.1.5/COPYRIGHT /usr/share/licenses/lua/COPYRIGHT4445FILE /tmp/lua/extension.c46    #include <lua.h>47    #include <lauxlib.h>48    int luaopen_dolly_lua_check(lua_State* state) { lua_pushinteger(state, 42); return 1; }49SLOP cc -O0 -shared -I/usr/include/lua5.1 /tmp/lua/extension.c -o /tmp/lua/extension.so50SLOP lua -e 'assert(_VERSION == "Lua 5.1"); assert(assert(package.loadlib("/tmp/lua/extension.so", "luaopen_dolly_lua_check"))() == 42); local f = assert(io.open("/tmp/lua/data", "w")); f:write("shared files"); f:close(); assert(os.execute("test -s /tmp/lua/data") == 0)'5152EXPORTS TOOL lua53EXPORTS HEADER lua /usr/include/lua5.154EXPORTS LIB lua /usr/lib/liblua.a55FILE /usr/share/licenses/lua/COPYRIGHT5657SLOP rm -rf /tmp/lua58REQUIRES HEADER lua59REQUIRES TOOL lua6061SOURCE /v0.1.2/dist/static/neovim/lpeg.tar e8a9fd286cf0ba6b9eff1ac12680eca887e409236b34a556a5cf6e55957f83f6 /tmp/lpeg/source.tar62SLOP tar -xf /tmp/lpeg/source.tar -C /63SLOP make -C /tmp/lpeg/source CC=cc LUADIR=/usr/include/lua5.1 \64  COPT=-O0 DLLFLAGS=-shared lpeg.so65SLOP ar rcs /usr/lib/liblpeg.a /tmp/lpeg/source/lpvm.o /tmp/lpeg/source/lpcap.o \66  /tmp/lpeg/source/lptree.o /tmp/lpeg/source/lpcode.o /tmp/lpeg/source/lpprint.o /tmp/lpeg/source/lpcset.o67SLOP mkdir -p /usr/lib/lua/5.1 /usr/share/lua/5.168SLOP cp /tmp/lpeg/source/lpeg.so /usr/lib/lua/5.1/lpeg.so69SLOP cp /tmp/lpeg/source/re.lua /usr/share/lua/5.1/re.lua70SLOP lua -e 'local lpeg = require("lpeg"); assert(lpeg.match(lpeg.P("Dolly"), "Dolly") == 6); assert(require("re").match("hello", "%a+") == 6)'7172EXPORTS LIB lpeg /usr/lib/liblpeg.a73EXPORTS LIB lua-lpeg /usr/lib/lua/5.1/lpeg.so74EXPORTS FOLDER lua-re /usr/share/lua/5.175FILE /usr/share/licenses/lpeg/lpeg.html7677SLOP rm -rf /tmp/lpeg78REQUIRES HEADER uv79REQUIRES LIB uv80REQUIRES LIB lua81REQUIRES TOOL cmake8283SOURCE /v0.1.2/dist/static/neovim/luv.tar 576f4f861cabfd1d7313d56124e1473f724f3da09060df4dc93d59936d3b4004 /tmp/luv/source.tar84SLOP tar -xf /tmp/luv/source.tar -C /85SLOP cmake -S /tmp/luv/source -B /tmp/luv/build \86  -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS=-O0 \87  -DWITH_LUA_ENGINE=Lua -DLUA_BUILD_TYPE=System \88  -DLUA_INCLUDE_DIR=/usr/include/lua5.1 -DLUA_LIBRARY=/usr/lib/liblua.a -DLUA_MATH_LIBRARY:STRING=m \89  -DWITH_SHARED_LIBUV=ON -DBUILD_STATIC_LIBS=ON -DBUILD_MODULE=ON -DBUILD_SHARED_LIBS=OFF90SLOP cmake --build /tmp/luv/build91SLOP cmake --install /tmp/luv/build9293FILE /tmp/luv/check.lua94    local uv = require("luv")95    local fired = false96    local timer = assert(uv.new_timer())97    timer:start(1, 0, function() fired = true; timer:close() end)98    uv.run()99    assert(fired)100    local fd = assert(uv.fs_open("/tmp/luv/check.txt", "w", 438))101    assert(uv.fs_write(fd, "Dolly", 0) == 5)102    assert(uv.fs_close(fd))103    assert(uv.fs_stat("/tmp/luv/check.txt").size == 5)104SLOP lua /tmp/luv/check.lua105106EXPORTS HEADER luv /usr/include/luv107EXPORTS LIB luv /usr/lib/libluv.a108EXPORTS LIB lua-luv /usr/lib/lua/5.1/luv.so109FILE /usr/share/licenses/luv/LICENSE.txt110FILE /usr/share/licenses/lua-compat53/LICENSE111SLOP rm -rf /tmp/luv112REQUIRES TOOL uname113114SOURCE /v0.1.2/dist/static/neovim/utf8proc.tar c9fdc1bf18b4d5ceb006b2847f6ead4642bfd82a7f102652cac4c13105b0e12a /tmp/utf8proc/source.tar115SLOP tar -xf /tmp/utf8proc/source.tar -C /116SLOP make -C /tmp/utf8proc/source CC=cc CFLAGS=-O0 libutf8proc.a117SLOP cp /tmp/utf8proc/source/libutf8proc.a /usr/lib/libutf8proc.a118SLOP cp /tmp/utf8proc/source/utf8proc.h /usr/include/utf8proc.h119120FILE /tmp/utf8proc/check.c121    #include <utf8proc.h>122    #include <assert.h>123    #include <stdlib.h>124    #include <string.h>125    int main(void) {126      assert(utf8proc_charwidth(0x65e5) == 2);127      unsigned char *text = utf8proc_NFC((const unsigned char *)"e\xcc\x81");128      assert(text && strcmp((const char *)text, "\xc3\xa9") == 0);129      free(text);130      return 0;131    }132SLOP cc -O0 /tmp/utf8proc/check.c -lutf8proc -o /tmp/utf8proc/check133SLOP /tmp/utf8proc/check134135EXPORTS HEADER utf8proc /usr/include/utf8proc.h136EXPORTS LIB utf8proc /usr/lib/libutf8proc.a137FILE /usr/share/licenses/utf8proc/LICENSE138SLOP rm -rf /tmp/utf8proc139SOURCE /v0.1.2/dist/static/neovim/treesitter.tar c31944873f3cd13235f2e9148b474f329b6bf183823baea50eacdb125fc46f9c /tmp/treesitter/source.tar140SLOP tar -xf /tmp/treesitter/source.tar -C /141SLOP make -C /tmp/treesitter/source CC=cc CFLAGS=-O0 libtree-sitter.a142SLOP cp /tmp/treesitter/source/libtree-sitter.a /usr/lib/libtree-sitter.a143SLOP cp -R /tmp/treesitter/source/lib/include/tree_sitter /usr/include144SLOP cp /tmp/treesitter/source/lib/src/unicode/LICENSE /usr/share/licenses/treesitter/Unicode-LICENSE145146FILE /tmp/treesitter/check.c147    #include <tree_sitter/api.h>148    #include <assert.h>149    int main(void) {150      TSParser *parser = ts_parser_new();151      assert(parser && ts_parser_language(parser) == 0);152      ts_parser_reset(parser);153      ts_parser_delete(parser);154      return 0;155    }156SLOP cc -O0 /tmp/treesitter/check.c -ltree-sitter -o /tmp/treesitter/check157SLOP /tmp/treesitter/check158159EXPORTS HEADER treesitter /usr/include/tree_sitter160EXPORTS LIB treesitter /usr/lib/libtree-sitter.a161FILE /usr/share/licenses/treesitter/LICENSE162FILE /usr/share/licenses/treesitter/Unicode-LICENSE163SLOP rm -rf /tmp/treesitter164# Upstream generators and the editor itself execute inside Dolly.165REQUIRES HEADER luv166REQUIRES HEADER treesitter167REQUIRES HEADER utf8proc168REQUIRES LIB luv169REQUIRES LIB lpeg170REQUIRES LIB lua-lpeg171REQUIRES LIB lua-luv172REQUIRES LIB treesitter173REQUIRES LIB utf8proc174REQUIRES TOOL sh175REQUIRES TOOL sleep176REQUIRES TOOL timeout177178SOURCE /v0.1.2/dist/static/neovim/neovim.tar.gz 037fc672b70c6bc962e9ecf08b847f5d4f4d2e526678c00dd8382aa156db3c82 /tmp/neovim/source.tar.gz179SLOP gzip -dc /tmp/neovim/source.tar.gz | tar -xf - -C /180SLOP cmake -S /tmp/neovim/source -B /tmp/neovim/build \181  -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib \182  -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS_DEBUG=-O0 \183  -DPREFER_LUA=ON -DENABLE_LTO=OFF -DENABLE_LIBINTL=OFF \184  -DENABLE_UNIBILIUM=OFF -DENABLE_WASMTIME=OFF \185  -DLUA_INCLUDE_DIR=/usr/include/lua5.1 -DLUA_LIBRARY=/usr/lib/liblua.a -DLUA_MATH_LIBRARY:STRING=m186SLOP cmake --build /tmp/neovim/build --target nvim187SLOP cmake --install /tmp/neovim/build188189FILE /tmp/neovim/check.lua190    vim.api.nvim_buf_set_lines(0, 0, -1, false, {"Dolly", "日本語"})191    vim.cmd("write /tmp/neovim/check.txt")192    vim.cmd("bdelete!")193    vim.cmd("edit /tmp/neovim/check.txt")194    assert(vim.deep_equal(vim.api.nvim_buf_get_lines(0, 0, -1, false), {"Dolly", "日本語"}))195    local result = vim.fn.system({"/bin/slop", "-c", "printf SLOP-CHILD"})196    assert(result == "SLOP-CHILD" and vim.v.shell_error == 0,197      "Slop child status " .. vim.v.shell_error .. ": " .. vim.inspect(result))198    local stopped, output = false, ""199    local job = vim.fn.jobstart({"/bin/slop", "-c", "printf FIRST; read answer; printf SECOND; sleep 30"}, {200      on_stdout = function(_, data) output = output .. table.concat(data, "\n") end,201      on_exit = function() stopped = true end,202    })203    assert(job > 0)204    assert(vim.wait(3000, function() return output:find("FIRST", 1, true) end))205    assert(vim.fn.chansend(job, "go\n") > 0)206    assert(vim.wait(3000, function() return output:find("SECOND", 1, true) end))207    assert(vim.fn.jobstop(job) == 1)208    assert(vim.wait(3000, function() return stopped end))209    vim.cmd("quit!")210SLOP timeout 60 nvim --clean --headless -l /tmp/neovim/check.lua211212EXPORTS TOOL nvim213EXPORTS FOLDER nvim-runtime /usr/share/nvim214EXPORTS FOLDER nvim-libraries /usr/lib/nvim215FILE /usr/share/licenses/neovim/LICENSE.txt216FILE /usr/share/licenses/neovim/mpack217FILE /usr/share/licenses/neovim/vterm218SLOP rm -rf /tmp/neovim219REQUIRES TOOL nvim220221# Neovim's pinned grammars and its own CMake build recipes, all built in Dolly.222SOURCE /v0.1.2/dist/static/neovim/parsers.tar 18656076f67f0cb39a68cbe1c6f628c35faf23e2ec207f914e97874a9cf323f7 /tmp/neovim-parsers/source.tar223SLOP tar -xf /tmp/neovim-parsers/source.tar -C /224FILE /tmp/neovim-parsers/build.slop225    set -ex226    for language in c lua vim vimdoc query markdown; do227      cmake -S /tmp/neovim-parsers/$language -B /tmp/neovim-parsers/$language/build \228        -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS=-O0 -DPARSERLANG=$language229      cmake --build /tmp/neovim-parsers/$language/build230      cmake --install /tmp/neovim-parsers/$language/build231    done232SLOP slop /tmp/neovim-parsers/build.slop233234FILE /tmp/neovim-parsers/check.lua235    for language, source in pairs({236      c = "int main(void) { return 0; }",237      lua = "return 42",238      vim = "echo 'Dolly'\n",239      vimdoc = "Dolly\n\n",240      query = "(identifier) @name",241      markdown = "# Dolly\n",242      markdown_inline = "**Dolly**",243    }) do244      local parser = vim.treesitter.get_string_parser(source, language)245      local tree = assert(parser:parse()[1])246      assert(not tree:root():has_error(), language .. ": " .. tree:root():sexpr())247    end248    vim.cmd("quit!")249SLOP timeout 30 nvim --clean --headless -l /tmp/neovim-parsers/check.lua250251EXPORTS FOLDER nvim-parsers /usr/lib/nvim/parser252EXPORTS FOLDER nvim-parser-licenses /usr/share/licenses/neovim-parsers253SLOP rm -rf /tmp/neovim-parsers254255ENTRY /bin/foreground -i /bin/slop256