Date: Thu, 1 Aug 1996 18:48:49 -0400 (EDT) From: Chuck Robey <chuckr@glue.umd.edu> To: "David E. O'Brien" <obrien@Nuxi.cs.ucdavis.edu> Cc: FreeBSD Ports <FreeBSD-Ports@FreeBSD.ORG> Subject: Re: Sample Makefile Message-ID: <Pine.OSF.3.95.960801184620.22202G-100000@fiber.eng.umd.edu> In-Reply-To: <199608012228.PAA11091@relay.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 1 Aug 1996, David E. O'Brien wrote: > > OK, I've gone a long way on the sample Makefile, I think it's ready. If > > you want to take a look, it's in ~chuckr/Makeport, on freefall. > > Can't get to it from ftp. Could you post it? I didn't want to at first, it's 13K in size, but I guess I will. I've pasted it to the end of this file. If you comment on it, please don't repost the whole thing to the list, but I'd like any comments anyone might have. > > thanks, > -- David > ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@eng.umd.edu | communications topic, C programming, and Unix. 9120 Edmonston Ct #302 | Greenbelt, MD 20770 | I run Journey2 and n3lxx, both FreeBSD (301) 220-2114 | version 2.2 current -- and great FUN! ----------------------------+----------------------------------------------- -------------------cut here (and you'll ruin your monitor!)-------------- |--------------------------------------------------------------------------- | NOTE - This file is unneccesarily complicated by these comments. | Any comments that begins with "|" MUST NOT be in a final port. | They are just here for your enlightenment. | The comments beginning with "#" are either comments recommended for the | actual Makefile or "commented out" possible makefile components. |--------------------------------------------------------------------------- |--------------------------------------------------------------------------- | -->HEADER section | | This section isn't parsed, but we have a common format for the top 6 lines | that we'd appreciate you stay with. Use tabs for spacing, and make the | data line up neatly. |--------------------------------------------------------------------------- # New ports collection makefile for: hello # Version required: 1.3 # Date created: 31 July 1996 |--------------------------------------------------------------------------- | The line following, that begins with "Whom" is the person who did the | original port to FreeBSD, in particular, the person who wrote this Makefile. | Don't worry about the "$\Id" stuff ... it will be automatically filled | in by CVS when it is committed to our repository. Do not put in the | "\", as this is just here to stop RCS from expanding the Id string in | this sample Makefile. |--------------------------------------------------------------------------- # Whom: Satoshi Asami <asami@FreeBSD.ORG> # # $\Id$ |--------------------------------------------------------------------------- |--------------------------------------------------------------------------- | --> ID section, describes the package itself and main ftp site. | | DISTNAME is always first, followed by PKGNAME (if necessary), CATEGORIES, | and then MASTER_SITES, and optionally EXTRACT_SUFX or DISTFILES] | DISTNAME is the name of the port, with any required version stuff. | It should fix the template '<name>-<version.string.numbers>'. This is used | for setting the work directory name, so the package should unpack to this | name. The DISTNAME is also used to form the first part of the name of | the source package to ftp. | Set PKGNAME only if DISTNAME has uppercase letters, strings like "beta" | (abbreviate to "b"), "patchlevel" (abbreviate to "pl"), doesn't have | version information, or is simply not descriptive. PKGNAME will then | substitute for DISTNAME, giving our package names a more common format. | DISTNAME is intended to match the name the author gave to the port, and | (hopefully) the name of the directory that the source files unpack into. | Set CATEGORIES to the name of the subdirectory of ports that best suits | the port description. You may use more than one value here if it | makes better sense, like "devel x11". | Set MASTER_SITES to the ftp or http string required to fetch the source | files. Don't forget the trailing slash "/". | Set DISTFILES only if you have a conflict between the name of the file | to fetch and the name of the directory created when it is unpacked. | DISTFILES is set to the name of the file to fetch, while the sources | will still be unpacked into DISTNAME. |--------------------------------------------------------------------------- DISTNAME= hello PKGNAME= hello-1.3 CATEGORIES+= misc MASTER_SITES= ftp://prep.ai.mit.edu/pub/gnu/ |--------------------------------------------------------------------------- | Set EXTRACT_SUFX if it is different than the default ".tar.gz". Don't | forget the leading '.'. |--------------------------------------------------------------------------- EXTRACT_SUFX= .tar.Z |--------------------------------------------------------------------------- | PATCH section, used only if the source files require additional patch files | to be fetched and applied. Not needed for most ports. These aren't your | locally generated patches, these are the patches you have to fetch via ftp | and apply before you have the author's intended source file set. |--------------------------------------------------------------------------- PATCH_SITES= ftp://ftp.sra.co.jp/pub/X11/japanese/ PATCHFILES= xdvi-18.patch1.gz xdvi-18.patch2.gz |--------------------------------------------------------------------------- | MAINTAINER; *mandatory*! This is the person (preferably with commit | privileges) who a user can contact for questions and bug reports - this | person should be the porter or someone who can forward questions to the | original porter reasonably promptly. If you really do not want to have your | address here, set it to "ports@FreeBSD.ORG".] | The blank lines before _and_ after MAINAINER are wanted, too! |--------------------------------------------------------------------------- MAINTAINER= markm@FreeBSD.ORG |--------------------------------------------------------------------------- | -->DEPENDENCY section: | | A port must indicate if it relies on any other portion of FreeBSD ports | to work. A port can depend in several different ways: | FETCH_DEPENDS -- depends on this to fetch the port, | Set to "prog:dir", where prog is the name of the executeable (used to | catch the dependency installed in the user's PATH) and dir is the name | of the to do a "make all install" in to get the dependecny installed | if it is not found on the user's PATH. | BUILD_DEPENDS -- depends on this to build the port. | Set to "prog:dir", assign as for FETCH_DEPENDS. | RUN_DEPENDS -- depends on this to actually run the port. | Set to "prog:dir", assign as for FETCH_DEPENDS. | LIB_DEPENDS -- depends on this library, both to build and run. | Set to "lib:dir", where lib is the name of the library to be searched for, | and dir is the name of the directory to go to and do a "make all install" | in if the library is not found. If the library is found, then it won't | be rebuilt, else the port in "dir" will be built and installed. | DEPENDS -- catch-all -- other depends that may occur. |--------------------------------------------------------------------------- RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript LIB_DEPENDS= Xpm\\.4\\.:${PORTSDIR}/graphics/xpm |--------------------------------------------------------------------------- | -->DEFINITION section | | Various definitions are used in the Makefile, and must be used, so that | users can set their local definitions. As an example, use $(MAKE), not | make. These definitions include: | MAKE make tool name. | GMAKE name of Gnu make tool | PREFIX local ports install directory, default /usr/local (or X11BASE | if USE_X11 is defined). NOTE: don't ever use /usr/local | or /usr/X11R6 as explicit names, this prevents people from | using their local installation customizations. Instead, use $(PREFIX) or $(X11BASE). | X11BASE name of local X11 ports directory, default "/usr/X11R6". | SCRIPTDIR name of your port's scripts directory, default "scripts". | Used for default script (see CUSTOM TARGETS section). | Most ports don't have a scripts directory at all. | FILESDIR name of your port's files directory, default "files", normally | has the md5 file. This is a good place to put any custom | files your port needs. | PKGDIR Used for the package support file (PLIST) and the two | ports description files, COMMENT and DESCR. | PATCHDIR Has files patch-aa, patch-ab, etc. You create these files | for any custom source file patching, and they are automtically | called and applied in order. Patches are applied relative | to the WRKSRC directory, and should be made using the -c or | -u option to diff, so that the filenames to be patched are | visible. Normally, create one patch file for each source | file that is patched. The default is "patches". | XMKMF Name of the X11 xmkmf make tool, default "xmkmf". | EXTRACT_CMD Name of the archive extraction tool, default "tar". |--------------------------------------------------------------------------- |--------------------------------------------------------------------------- | PATCH Creation Notes: | | To make a patch file: | 1) Identify the file you want to change in the port's sources. | 2) Make a copy of this file in the same directory, appending '.orig' to | the filename. Call (for these notes) the file you modify MOD, with | the copy now MOD.orig. | 3) Edit your changes into the source file. | 4) cd to the WRKSRC directory, normally the top level directory created | when the source file is unpacked. | 5) do an ls on your port's patch directory, so that you know the name you | will use for this new patch. | 6) You may use either the -c (context diff) or -u (unified diff) format | when making patches. My example here uses -u. | 7) (Still from the WRKSRC directory) Issue the diff command: | diff -u MOD.orig MOD >PATCHDIR/PATCHNAME. | Make very certain you used a path in the naming of the MOD and MOD.orig | files that is relative to the WRKSRC directory. Don't actually use | PATCHDIR/PATCHNAME, substitute then name of the patch directory (normally | patches) and the name of the patch file you found in step 1, something | like patch-aa. In the diff command line, it's important that you follow | the order you see here (original file first, then patched file). | | Done. |--------------------------------------------------------------------------- |--------------------------------------------------------------------------- | -->MISC section | | For other standard bsd.port.mk variables that do not belong to any of | the above. They should be left out if not used, because default values | apply. | Set WRKDIR if you don't want to use the default ./work directory as | the temporary work directory. This directory, and everything under it, | is destroyed by "make clean". | Set WRKSRC if incompatible with $(WRKDIR)/$(DISTNAME). This is the directory | that the source is supposed to unpack to, and is used also to | (1) cd to before doing the "make" for the source's makefile, and | (2) cd to before applying any patches. All patches sould be made | relative to this directory location. | Set IS_INTERACTIVE to "yes" if the port requires online operation (the port | asks questions during the build). | Set HAS_CONFIGURE to "yes" if it uses a configure script. | Set USE_GMAKE if the port requires the use of Gnu Make. Don't use the | "gmake" command directly, use the $(GMAKE) variable so that the user | can set their Gnu make command as they want to. | Set USE_X11 to "yes" if the port uses X11 directly. This causes the | $(PREFIX) variable to be set to $(X11_BASE) (default /usr/X11R6). | Set USE_IMAKE to "yes" if the port requires a preliminary imake invocation. | Set ALL_TARGET if the source package's makefile wants a target other | than the default "all". | Set REQUIRES_MOTIF to "yes" if the port needs the Motif libs. |--------------------------------------------------------------------------- HAS_CONFIGURE= yes #USE_GMAKE= yes #USE_IMAKE= yes |--------------------------------------------------------------------------- | -->TARGET REMOVAL section | Targets can be disabled by the use of special targets as demonstrated below | for the NO_BUILD target. This may be done for NO_FETCH, NO_EXTRACT, | NO_PATCH, NO_CONFIGURE, NO_BUILD, and NO_INSTALL targets. |--------------------------------------------------------------------------- NO_BUILD= yes #[non-standard variables to be used in the rules below] #MY_FAVORITE_RESPONSE= "yeah, right" |--------------------------------------------------------------------------- | -->CUSTOM TARGETS section | This section is for the specification of custom targets. Both pre-() and | post-() targets are called automatically if specified here. Pre/post- | targets are supplied for fetch, extract, patch, configure, build, and | install. NOTE: scripts named pre-() or post(), if installed in the scripts | directory, are also located and automatically executed, at the indicated | points in the build process. This is ideal for some ports (like tcl/tk | stuff) that may come without any of their own makefiles. |--------------------------------------------------------------------------- pre-fetch: echo "go fetch something, yeah" #post-patch: #need to do something after patch, great #pre-install: #and then some more stuff before installing, wow |--------------------------------------------------------------------------- | If you still don't see how to do something, you can peruse other ports to | see how others have already solved similar problems, or please post porting | questions to "FreeBSD-Ports@FreeBSD.org" |--------------------------------------------------------------------------- |--------------------------------------------------------------------------- | The final line must be ".include <bsd.port.mk>" to cause make to read in | the ports main makefile. This is _must_ reading for any aspiring ports | creator (in /usr/share/mk/bsd.port.mk). We don't expect you to understand | it all but questions to FreeBSD-ports@FreeBSD.org about bsd.port.mk are | very welcome. |--------------------------------------------------------------------------- .include <bsd.port.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.95.960801184620.22202G-100000>