Linux Cheat Sheet for Mac and Windows ProgrammersThis page is intended for programmers who are relatively new to Unix, who have access to a Linux machine and want to get going quickly doing mozilla builds or applying or generating patches.
If you want more information on the linux mozilla build system, or are setting up your own linux build machine, be sure to read the official Unix Build Instructions.
- How do I log in to a linux box from another machine?
- How do I start a new build?
- How do I rebuild part of the tree?
- How do I apply a patch?
- How do I read something off a floppy?
- How do I generate a patch?
- How do I debug?
- How do I find out how to do other things
How do I log in to a linux box from another machine?Use telnet on your preferred platform to log in to a remote linux (or other Unix) machine. You'll have to provide the machine's hostname (if it uses dhcp instead of a static IP, this will be something byzantine and different every time the machine is rebooted).
Of course, if the machine belongs to someone else, please check with the owner first before using it.
Once you're in, you can use "cd" (change directory; chdir also
works, if you want to type more) to go to wherever the build tree is.
When you log in, you're initially in your home directory.
In machines inside large companies (for example, Netscape does this),
this may be NFS mounted from a remote server
(to find out, say "df ." and see if there's a hostname:
in the "Filesystem" column).
If your home directory is NFS mounted, you probably don't
want to build there;
but the build will go a lot faster if you build on a local disk.
How do I start a new build?
First, decide where the build will go.
Make sure first that there's enough space.
A fully built debug tree currently takes about 1.6Gb.
df -k will show you the disk space available on all
filesystems mounted on the machine.
Many Linux Mozilla developers here set up a /builds directory to put
build trees; df -k /builds will tell you whether that exists
and how much spaces is there.
(The -k prints the result in kilobytes rather than disk blocks;
on some systems, these are the same.)
When you log in, you're initially in your home directory. In machines inside large companies (for example, Netscape does this), this may be NFS mounted from a remote server (to find out, say "df ." and see if there's a hostname: in the "Filesystem" column). If your home directory is NFS mounted, you probably don't want to build there; but the build will go a lot faster if you build on a local disk.
|Make a new directory where the build will live.|| |
|cd to that directory|
|Set your cvsroot. This depends on your default shell. Try both if you're not sure, one of them will work.|
setenv CVSROOT :pserver:firstname.lastname@example.org:/cvsroot(csh/tcsh), or, if you're using sh/bash,
set CVSROOT=:pserver:email@example.com:/cvsroot; export CVSROOT
cvs co mozilla/client.mk
|Change into the mozilla directory|
|Pull and build everything|
make -f client.mk
|... Wait an hour or two ...|
|Cd to where the binary lives|
How do I rebuild part of the tree?Change directory to the right place (e.g. cd layout/base/src), and type "make".
If you want to update in that directory first, cvs update will do it.
To rebuild a whole tree without pulling it, cd back to the mozilla level and type
make -f client.mk buildTo pull everything and rebuild, cd to the mozilla level and type
make -f client.mk
How do I apply a patch?
- Save the patch somewhere where the machine can get to it. You can use mozilla or 4.x to read mail and save it that way, ftp it from somewhere using command-line ftp or a gui client, or move it on a floppy. I recommend saving it in /tmp, e.g. /tmp/my.diff or my.patch (the extension doesn't matter, use something you'll remember). It's okay if it has mail headers and stuff before the meat of the patch.
- cd to the directory in the source tree where the patch was made.
patch < /tmp/my.patch(or whatever you named the patch). If it's a patch spanning multiple directories, you might need:
setenv POSIXLY_CORRECT 1 ; patch -p0 < mypatch.diffs
How do I read something off a floppy?Good question. Some systems set up an automounted floppy, so you can insert the floppy then type:
mount /mnt/floppyor perhaps
mount /floppyIf these give you an error, contact whoever administers the machine, and ask them to replace the fd0 line in /etc/fstab with something like:
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
How do I generate a patch?In a directory at or above the level where the changed files live, run cvs diff:
cvs diff -u [list of changed files]You can add a -N to the diff arguments if you want it to include new files in the patch as well.