# Where should I place source code that I wish to compile?

Here's the scenario; I've downloaded a tarball. I've extracted all the source contained inside to my home folder "/home/zolomon/SourceCode". But where should I place the SourceCode directory with its content when I wish to compile it? Does it matter? Will it, in most cases, install and place files in the correct place automatically when I install it?

In this case I'm talking about RubyGems.

-
Do you realise that you can just install the rubygems package? –  dv3500ea Nov 19 '10 at 11:38
Not if I wish to install rails 3 (but that's another matter!)? –  Zolomon Nov 19 '10 at 11:50
I confirm that Rails 3 won't work with Ubuntu's current gem packages. It doesn't address your question directly but I suggest you use rvm. I just did a clean install of Ruby/Rails3 with it and it worked fine on Ubuntu 10.04. rvm.beginrescueend.com –  Olivier Lalonde Nov 20 '10 at 11:57

Yes you can place the source code anywhere.During the installation it places all the files in correct location.In your case you have your source code in /home/zolomon/SourceCode so you can compile it from there..Thats not a problem..

-

Files under the directory /usr/local/ are not under the control of the Debian package management system. Therefore, it is good practice to place the source code for your program in /usr/local/src/. For example, you might extract the files for a package named "foo.tar" into the directory /usr/local/src/foo. After you compile them, place the binaries in /usr/local/bin/, the libraries in /usr/local/lib/, and the configuration files in /usr/local/etc/.

If your programs and/or files really must be placed in some other directory, you could still store them in /usr/local/, and build the appropriate symbolic links from the required location to its location in /usr/local/, e.g., you could make the link

 ln -s /usr/local/bin/foo /usr/bin/foo


In any case, if you obtain a package whose copyright allows redistribution, you should consider making a Debian package of it, and uploading it for the Debian system. Guidelines for becoming a package developer are included in the Debian Policy manual.

-
I never liked that option because it requires me to use root for all file creation, modification, etc. –  levesque Nov 19 '10 at 12:32
Great answer, thanks! Though, I need to read up on what files are classified as binaries, libraries and configurations in Ubuntu - I just realized I have no idea which is which! –  Zolomon Nov 19 '10 at 12:34
I think that advice is misguided or outdated. Generally, source code should just live in your home directory. The /usr/src/ and /usr/local/src/ directories are mostly from a bygone age. –  Colin Watson Nov 19 '10 at 15:55