OK, far too general a question, but roughly...
First you figure out which package supplies the software you want to alter (ubuntu is made up of hundreds of separate software packages and there's a number of different ways to figure out which one supplies each installed program/file) then:
apt-get source <packagename>
This will download the source code and unpack it in a subfolder under the current location.
E.g. if I want to change the behaviour of the Rhythmbox music player:
apt-get source rhythmbox
Edit the source code as you please. How to build and run, debug etc. really depends on the program... language, build system, type of software etc. Mostly, linux software projects all use makefiles. There should also be a variety of README files in the root of each source tree explaining how to handle that particular project.
Once you are happy with your changes, to build a replacement package that you can install, you create a new version and run a command (supplied by installing the devscripts package) to build the installable "deb" files. You will find a "debian" folder in the root of the package source code. Edit the file debian/changelog
creating a new entry with a new version number and describing your changes. Now run the command debuild
to build a new package.
You can use the PPA system in Ubuntu's Launchpad to create your own software repositories and upload your changed source packages there (using debuild -S
then dput
to upload the .changes file) to be built automatically for all supported architectures and installable by anybody that wants to add your repository to their list.
There's a lot more to it of course, but that is a typical (and "traditional") workflow. I vaguely recall a project called Ground Control that was trying to make it all more point-and-clicky.
I'll try to add some details in the question.
– MasterMastic Nov 07 '12 at 02:56