rxi / lite

A lightweight text editor written in Lua
MIT License
7.42k stars 353 forks source link

Add Makefile, update build instructions #257

Open deric opened 3 years ago

deric commented 3 years ago

I've added a simple Makefile but I'm struggling a bit project structure. E.g. when installing to /usr/local Lua files could be placed in /usr/local/share/lua/5.2/core.lua. It would be nicer to put also package name on path, so that Lite's files won't collide with some other Lua package, e.g. /usr/local/share/lua/5.2/lite/core.lua

Error: [string "local core..."]:8: module 'core' not found:
        no field package.preload['core']
        no file '/usr/local/bin/data/core/init.lua'
        no file '/usr/local/bin/data/core.lua'
        no file '/usr/local/share/lua/5.2/core.lua'
        no file '/usr/local/share/lua/5.2/core/init.lua'
        no file '/usr/local/lib/lua/5.2/core.lua'
        no file '/usr/local/lib/lua/5.2/core/init.lua'
        no file './core.lua'
        no file '/usr/local/lib/lua/5.2/core.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './core.so'

Also, fonts are currently hard-coded relatively to executable:

data/plugins/scale.lua:19:font_cache[style.code_font] = { EXEDIR .. "/data/fonts/monospace.ttf", 13.5 * SCALE }

but this would be for another PR. Is it ok to modify this path?

A Linux program structure might look like

/usr/local/bin/lite
/usr/local/share/lua/5.2/lite/core/...
/usr/local/share/lua/5.2/lite/fonts/...
/var/lib/lite/plugins/
/var/lib/lite/user/
~/.local/lite/plugins/
~/.local/lite/user/

Currently all files needs to be placed relatively to e.g. /usr/local/bin/lite file, in /usr/local/bin/lite/data/ directory which isn't nice.

andrew-manger commented 3 years ago

Hey, I am getting the error you included at the beginning of you post. How can I resolve this?

deric commented 3 years ago

@andrew-manger As the message say, lua files aren't on any of searched location. You've probably moved the main binary lite out out project's main directory.

andrew-manger commented 3 years ago

I didn't move anything. I built the program and then copied 'lite' to /bin/bash/ and it gave me this error. I'm trying to figure out how to fix it, not what I did wrong.

deric commented 3 years ago

That's pretty much the same, you can create a symlink to your build directory:

ln -s /home/yourdir/src/lite /usr/local/bin/lite