Question

I have written an open source (GPL) application for Linux and OSX and now wish to distribute it. Is it normal to distribute the source code along with the binaries by default, or just provide a link to where it can be obtained?

If I include the source files, where is the normal location for writing them on the users system for Linux and OSX (I thought /usr/local/src but on my Ubuntu machine, supposedly chock-full of open source apps, this directory is empty).

Was it helpful?

Solution

It is usual to distribute the sources and binaries separately. Binaries would normally be distributed in distro-specific package formats whilst sources would be a simple .tar.gz containing a project folder. The user could unpack it to /usr/local/src if they wanted but it should build anywhere. It's not up to your program to drop its sources in any particular location.

I thought /usr/local/src but on my Ubuntu machine, supposedly chock-full of open source apps, this directory is empty

It will be empty if you are only using the Ubuntu repos. The OS is in charge of /usr and will drop any sources you install into /usr/src. But /usr/local is left for you to play with; that's where you install stuff that the distro doesn't provide.

OTHER TIPS

About /usr/local/src

/usr/local and any subdirectories are always going to be empty on your machine unless YOU have specifically put something in there. It's a section of the filesystem that is reserved for user-installed software for that specific machine. Ubuntu (or any distribution) is not ever supposed to touch it.

Your distro will have separate places for its own source code, if any. Most Ubuntu installations won't need source code anyway (though you can download it if you want to), but if they do it'll go somewhere like /usr/src. But if you want to place your own source code somewhere and don't want your distro to mess with it, then just:

  • If it's just for developing/compiling in your own user account, you can just put it somewhere in your home directory.
  • If it's a piece of software you'll installing on the system, /usr/local/src is the suggested spot and your distro won't mess with it there.

FHS is the standard which says where in the filesystems things go, and includes distinctions such as the ones I've discussed above.

Your software should be able to be compiled no matter which directory it's in, because as you can see, it can depend.

It's worth looking at a few projects on Sourceforge (http://www.sf.net). As menioned by @bobince it's normal to distribute binaries and source separately. It's certainly kind to users not to require compilation so they can download and run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top