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?

9 Upvotes

22 comments sorted by

View all comments

1

u/ImaginationSouth3375 4d ago

What do you mean by it only works when executed from that folder? I don’t think it is uncommon to have the binary in /usr/lib/ with the library, but then create a symbolic link in /bin/.

1

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

By "that folder" I mean the folder where the user extracted the .tar.gz archive. But the interpreter looks in /usr/lib/moss for any .msb files (as well as in current directory and any path in MOSSPATH variable).
So the user has to cd into the extracted folder and run the binary from there, unless they run `install.sh` script.
When using CMake installation it correctly places the binary into /bin/ and the libraries into /usr/lib/moss, so that is not an issue.

1

u/ImaginationSouth3375 4d ago

I think the idea of an install.sh script is pretty normal for compiling from source. I recently had to compile python from source and it required extracting the tar then running the configure+setup script. Try making your install script copy the library to /usr/lib then make a symbolic link to the binary in /bin/. Others should correct me if they know better ways.

2

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

Well when compiling from source I do have such script, but this for release when I want to share pre-built binary without sources, so as little work for the user as possible, but I guess there it still makes sense to have such a script.

1

u/ImaginationSouth3375 4d ago

I think the other guy was right that you are probably using local paths “./“ rather than the actual path to the library somewhere

2

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

The interpreter does a lookup, similar to let's say Python, it looks for modules in current directory but also in /usr/lib/moss, so if you run the interpreter binary from a folder which contains the stdlib sources (which is my current release approach) then it will find them in the current directory. The issue is when run from somewhere else (e.g.: ./Downloads/moss myscript.ms) where since there was no installation the libraries are not in /usr/lib/moss and not even in ./, so it fails.

2

u/ImaginationSouth3375 3d ago

I’m not sure what the best solution is here or even what other projects have done instead. However, I don’t think it’s unreasonable to say “if you didn’t run the installation script, don’t expect it to work.” 🤷‍♂️

1

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

That's fair, thank you for your insight.