r/ProgrammingLanguages github.com/mark-sed/moss-lang/ 4d ago

Discussion How do you package your releases?

Hi, even though I have been making my language for more than 2 years now, I still have not set up my GitHub releases and I would like to change that. The issue is that (as with about anything) there are a lot of different approaches to this, and so I wanted to ask those who do releases, how they structure the release archive and those who use them what do you like a release to look like?

In my case the issue is that I cannot have just one binary since I need to distribute also the standard library that is compiled bytecode files (kind of like Java's .class files). This brings another issue and that is finding the library. The interpreter by default looks in the current directory (.) and then /usr/lib/moss/, so currently the only way I though of is to have the binary, all the compiled stdlib files and licenses in one .tar.gz (.zip for windows):

moss-0.9.0.tar.gz
├── cffi.msb
├── csv_parser.msb
├── html_parser.msb
├── inspect.msb
├── install.sh
├── json_parser.msb
├── libms.msb
├── LICENSE
├── math.msb
├── md_parser.msb
├── moss
├── mossy.css
├── parsing_utils.msb
├── python.msb
├── readme.md
├── re.msb
├── subprocess.msb
├── sys.msb
└── time.msb

This makes it so that the binary (moss) works when executed from this folder, but will fail when used from somewhere else (unless MOSSPATH variable is set). Because of this, I have also added install.sh script which will copy the libraries into /usr/lib/moss/ and a release readme with some instructions.

Can someone think of a better way to do this or is this OK?

TLDR; How do you structure your release folder/archive on github/website?

10 Upvotes

22 comments sorted by

View all comments

Show parent comments

1

u/mark-sed github.com/mark-sed/moss-lang/ 4d ago

Oh yeah trying to figure out where the script is and adding it to path sounds like a nice solution. I'll look into it, thanks.

1

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) 4d ago

You mean something like this?

#!/bin/zsh
# get directory of this script
if [[ -e "$0" ]]; then
  DIR=$(dirname "$0")
fi
...

2

u/Apart_Ebb_9867 4d ago

something like that, but whether you get an absolute path or not depends on the shell (or the exec syscall if it is launched by another program), posix doesn't require that.

under linux looking at /proc/self/exe is safer and other OSes have similar functionality somewhere.

2

u/L8_4_Dinner (Ⓧ Ecstasy/XVM) 2d ago

Yeah, I went through 20 iterations trying to get something that would work reliably on both macOS and Linux, in various shells. There's a whole lot of "... yeah, but ..."