*BSD News Article 58807


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.cis.okstate.edu!news.ksu.ksu.edu!news.mid.net!sbctri.tri.sbc.com!newspump.wustl.edu!news.ecn.bgu.edu!vixen.cso.uiuc.edu!newsfeed.internetmci.com!news.mathworks.com!uunet!in1.uu.net!news.gtn.com!knobel.gun.de!usenet
From: andreas@knobel.gun.de (Andreas Klemm)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: contool 3.3A patched for FreeBSD
Date: 4 Jan 1996 10:21:51 GMT
Lines: 137
Message-ID: <4cg9nv$1ih@knobel.gun.de>
References: <nc20Gf3@quack.kfu.com>
NNTP-Posting-Host: knobel.gun.de
X-Newsreader: knews 0.9.3

In article <nc20Gf3@quack.kfu.com>,
	nsayer@quack.kfu.com (Nick Sayer) writes:
>I have suitably patched Contool 3.3A for FreeBSD. I would not mind
>turning it into a 'port', and after confering with the author
>he expressed no objections to a package (provided a copyright notice is
>included in the long description file so it gets printed by pkg_info).

What is contool ?

>I have a Makefile and a patch. I tried reading the instructions in the
>handbook for turning these into a port, but it didn't make much sense to me.
>I've not used the 'ports' before. I've only installed packages (I am a
>lazy turd).

Well, I first had some problems, too, understanding the
ports mechanism. My advice: get the Makefile of a port,
which has a similar kind of setup and installation ...
This Makefile isn't large.

# you choose a Distribution and a Package name
DISTNAME=	knews-0.9.3
PKGNAME=	knews-0.9.3

# here you choose to which category of the ports section
# the software belongs to
CATEGORIES+=	x11
CATEGORIES+=	news

# Here you say, on what ftp site the package is available
# if the sources are not on your local source repository
# /usr/ports/distfiles, then it will be fetched via ncftp
# from that location automatically
MASTER_SITES+=	ftp://sunsite.unc.edu/pub/Linux/X11/xapps/networked/
MASTER_SITES+=	ftp://ftp.cc.gatech.edu/ac88/linux/X11/xapps/networked/
...

# The one who maintaines the port, YOU ?! ;-) You full e-mail
# address would be fine :-) Joerg belongs to the core team
# so he has an extra bonus (joerg@FreeBSD.org)
MAINTAINER=	joerg

# This is for example package specific ... Is it an X11
# program, that creates a Makefile from imake ....
# look into another pots collection Makefile, too get an
# idea, what other packages need
USE_IMAKE=	yes

# special make flags ...
MAKE_FLAGS=	BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man1 \
		XAPPLOADDIR=${PREFIX}/lib/X11/app-defaults  -f

# a flag that tells the port mechanism, if this port needs
# user interaction, if you do mass compilation in the ports
# section, then there is a switch, that skips packages which
# needs interaction
IS_INTERACTIVE=	no

# and this included Makefile does the rest for you
include <bsd.port.mk>
--------------------------------
When typing make, the source will be ftp'd into /usr/ports/distfiles
and will be unpacked into a sub-directory: work

So you have for example:

	/usr/ports/news/knews/work/knews-0.9.3

If there are patches in 
	/usr/ports/news/knews/patches/patch-aa
	/usr/ports/news/knews/patches/patch-ab
					....

They will be applied to the sources ....

After that the package will be compiled.

A make install installs the package to it's default
locations. If the default location has to be modified,
to match FreeBSD's standard of being in /usr/local, then
you would add patches to reach that goal into the
patches directory of that port

	/usr/ports/news/knews/patches/

Please note: a make clean erases the work subdir ... !!!
So should make context diffs befor doing a make erase ....

So a typical situation is (when collecting / creating the
needed diffs:

	# make
	if there is an error, fix it in the source, make
	a context diff, place it in the patches dir ...
	# cd work/packagename
	# diff -c work/packagename/file.c.orig \
		work/packagename/file.c \
		> patches/patch-ac
	# make clean; make
	fix some more bugs
	# diff -c work/packagename/anotherfile.c.orig \
		work/packagename/anotherfile.c \
		> patches/patch-ad
	# make clean; make

If you did everything well, then it would be nice to 
add three files into the pkg directory, that describe
the package and it's contents ... Look for examples, there
are many !!!

And then you created a nice port, that you can send to
	asami@cs.berkeley.edu (Satoshi Asami)

>If someone else wants to do all the work, the patch is at
>http://www.kfu.com/~nsayer/contool_patch.txt. The Makefile is simply what
>you get after doing the 'obvious' things to the Makefile.dist that comes
>with contool. :-)

Nick, would be nice, if you would again try to make it yourself.
It is really a great feeling, when finishing a port, since it
works so clever and wonderful, you'll "feel like a new man" ;-)

I hope, my little help is enough, to show you the simple basics.
Maybe the documentation about that is a bit too academic, one
should add an easy example how to port a package foobar or such.

My first steps were really hard, too until I saw, how (relatively)
easy the machanism is !!!

	Andreas ///

-- 
andreas@knobel.gun.de       /\/\___  Wiechers & Partner Datentechnik GmbH
   Andreas Klemm        ___/\/\/       - Support Unix - aklemm@wup.de -
                             \/
       ftp://sunsite.unc.edu/pub/Linux/system/Printing/aps-491.tgz
apsfilter - magic print filter 4lpd  >>> knobel is powered by FreeBSD <<<