Different Linux distributions have different approaches to software packages, but I can tell you a bit from my experience creating packages for Ubuntu (long time ago).
Most distros provide their own tools to create both source code and binary packages. Most packages are compressed archives of the binary files of the package plus some metadata about other packages that are runtime dependencies for the software to run. In the case of a Clojure-based package, you want to create a package comprised of your own code and, hopefully, you’ll be able to express that you want to depend on the Clojure Jar and some minimum version of the JDK without having to bundle their binaries in the same package, but as dependencies. This has the advantage of avoiding the download/install of multiple versions of the same JDK, getting security updates for your dependencies and so on.
The details of which tools need to be installed and how you create the medatada files that indicate your package depends on vary with each distro, for Gentoo a good starting point is this page of their wiki: https://wiki.gentoo.org/wiki/Java_Developer_Guide … you’ll want to learn about how to create a basic package for a command line Java program that prints
Hello world and introduce the steps for Clojure later (eg. maybe extend the commands from the guide to introduce the step that will call
On the other hand, you may want to reach a larger set of Linux distros by creating a large package with all the dependencies included. This would be a ~200 megabyte package, but you are in control of everything. Some names to start looking for this option are Flatpak and Ubuntu Snaps.
For my Debian/Ubuntu example of a Java package, check this repo. The build system uses Apache Ant with recipes on the build.xml file. The package metadata is derived from the files control for dependencies and rules for the installation steps.
Edit: You can see the details of the files used to create the Clojure package for Gentoo here. You’ll need to create an
.ebuild file similar to this one: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/clojure/clojure-1.10.0.ebuild?id=5ff47c259ceb0f625d61cf590a76a3f532221b75