Date: Fri, 26 Jul 1996 21:25:48 -0700 (MST) From: Don Yuniskis <dgy@rtd.com> To: durang@u.washington.edu (Ken Marsh) Cc: questions@freebsd.org Subject: Re: distfile, makefile, etc Message-ID: <199607270425.VAA15671@seagull.rtd.com> In-Reply-To: <Pine.A32.3.92a.960726203840.9827M-100000@homer27.u.washington.edu> from "Ken Marsh" at Jul 26, 96 08:42:08 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> This makefile/distfile is still an alien concept to me. I would like to > install elm on my system. I understand that I must compile it myself, and > that a makefile is some kind of compilation control. I've gathered this > from the docs on make and man pages. OK. The "ports" collection (/cdrom/ports) and the "packages" are related. Each "package" was built from the sources in the corresponding "port". Some "ports" don't have "packages" -- because they need to be customized for a particular site, or perhaps the licensing says "you can't distibute this in form XYZ...". Likewise, some of the sources for a "port" may not be on the CD or may only be available from a particular ftp site (again, usually because of licensing restrictions). And, some packages may not be built from their corresponding port (e.g., packages that need particular libraries like Motif...) A makefile is a set of instructions telling make(1) just what it needs to do in order to build a particular piece of software (e.g., compile this, then this, then glue them together, then shove the result over here, etc.). The "distfile"s are the bits and pieces (sources usually bundled up as gzipped tar balls) which are needed for a particular port. *Most* of the ports have the required distfiles in /cdrom/distfile (but some are not... for the above reasons) > I have figured out how to extract binarys, and installed X using the > cat|tar combo. > > Does anyone know of a website or other documentation that really spells > out the process of compiling something like elm on a FreeBSD system? Move into the appropriate directory (e.g., cd /usr/ports/mail/elm). Then, invoke make(1) (e.g., make). :> Make will look through the Makefile in that directory and decide how to build the port. This will typically involve locating the "sources" for the port in the "distfiles" -- if they aren't available, it will tell you and then automatically attempt to ftp to the appropriate ftp site and *get* them for you. (N.B. to do *only* this step in the process, you could invoke "make fetch"). It also looks at the checksums of the files to make sure they look good. Then, it will extract the files from the "distfile"(s) that it located. Typically, this is gunzip | tar (i.e. tar xz) but it could be any number of mechanisms depending on the format of the distfile and the instructions in the Makefile (e.g., zip, cpio, compress, etc.). These files are extracted into a subdirectory of the directory you are in -- typically "work" (e.g., /usr/ports/mail/elm/work) or "work/src". (N.B. to do the fetch and extract, you can invoke "make extract". If you've already done the fetch, make will realize this and will skip ahead to the extract step). Next, the port is "patched" to work with FreeBSD. This is where most of the work of those "porters" shows up -- they look at the original sources and figure what must be tweeked to make everything work with FreeBSD. The patches, if any, are in the "patch" subdirectory for your port (e.g., /usr/ports/mail/elm/patches) as a series of one or more diff(1) files. (N.B. Invoking "make patch" will bring you to this level after verifying that all of the other prerequisite steps -- fetch, extract -- have been completed). Then, the port is configured for FreeBSD and, possibly, your site. This typically involves querying your system to determine where particular include files are located, etc. For something like elm, it may need to determine the name of your host. Some of these configuration programs are interactive and require you to answer questions regarding your system or the options you might want to set up. (N.B. The "make configure" step will bring you to this point) Now, all of the sources are in a state whereby they can be compiled, etc. This occurs when you do a "make build" -- which is the default when you say just "make". This verifies that all of the preceding steps have been satisfied -- if not, it automatically does them all for you in sequence. Then, it "builds" the port -- compiling, assembling, and whatever else might be required to produce the final code for you. When this is done, you typically have all the programs you wanted for that port available somewhere under the work (or work/src, etc.) subdirectory. A last step, "make install" takes the programs, man pages, other files and puts them in their proper homes in your system (typically under /usr/local) so that they can be used normally. It might also tweek some other system files for you to automate as much of the setup as possible (e.g., registering a new shell in /etc/shells) So, if you're really confident, you can just start off by typing "make install" -- and skipping all of these other steps -- and watch make(1) go through each step, in turn, until it has built and installed the port for you! When you're done, "make clean" will remove all intermediate traces of this process. Typically, this involves erasing the work subdirectory and all it's contents -- since they've already been *installed* in their appropriate homes! Of course, there are lots of other little nits in this procedure, but, that's the 25 cent tour... (Note some of the Makefiles are broke in the ports collection. Often "make configure" ends up doing a "make build", too.) --don
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607270425.VAA15671>