Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 1996 14:33:53 +0200 (EET)
From:      "Andrew V. Stesin" <stesin@elvisti.kiev.ua>
To:        andreas@knobel.gun.de (Andreas Klemm)
Cc:        doc@freebsd.org, ports@freebsd.org
Subject:   Re: HOWTO make a FreeBSD port
Message-ID:  <199603181233.OAA08060@office.elvisti.kiev.ua>
In-Reply-To: <199603171911.UAA09099@knobel.gun.de> from "Andreas Klemm" at Mar 17, 96 08:11:08 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Andreas,

your real-life example is really nice.  A short addition to it proposed.

Q. How do I create a PLIST file for FreeBSD port of
   an OverBloatedFOO package, which has a very complex
   directory structure and too _many_ files to count them by hand?

A. First of all, there is already a tool for doing such a things, called
   mtree.  It has all kinds of smart in it and probably may be tuned
   for PLIST generation. (Those wizards who use it will write how
   can this be done ;)

   As I'm not familiar with mtree yet, I wrote the attached /bin/sh
   script, called it 'mkpkglist' and put it into my $PATH. That's
   how you can use it:

   1.  Specify a "fake" PREFIX in the port's Makefile, say /var/tmp/pkgtest.
       Your port _must_ be tuned so that it will cleanly
       install itself under whatever PREFIX value is -- as far
       as I know, that's a strong requirement to all FreeBSD ports.
   2.  Remake all the port with that fake PREFIX and do 'make reinstall'.
       Test the port -- does it work in a correct way from that
       directory?  Say, it does.  Ok, go on.  (You'd probably like
       to clean the unnessesary files created while testing, if there
       were some).
   3.  Launch the script:

   		mkpkglist /var/tmp/pkgtest > PLIST.draft

       So nice, the draft PLIST is here!  Note, it doesn't have
       any mention of your fake PREFIX inside it, so you don't need
       to change anything in it after PREFIX is set back to /usr/local
       or whatever.
   4.  But, in case you need to do something specific in the PLIST
       for your package, say make yourself sure that correct permissions
       will be set on some binaries during the installation, or
       some symbolic/hard links will be established (and removed when
       pkg_delete will run), edit your draft PLIST by hands.
       Drop the result of this effort into pkg subdir of your port,
       under a name 'PLIST'.  Now you can remove the whole
       subtree used as a fake PREFIX for test install -- you
       don't need it anymore.
   5.  Than set PREFIX back to a meaningful value and test the
       whole process once more.  Than say: 'make package' -- and your'e Ok
       now (I hope so -- Mr. Satoshi Asami may have another opinion :)

======================== cut here ==========================
:
#
#	This simple script helps to create PLISTs for a new packages.
#	Probably better tools are present somewhere, too; but for now...
#

[ $# -eq 1 -a -d $1 ] || {
	echo Usage: $0 prefix_dir \> draft_PLIST >&2
	exit 1
}

find -d $1 | sed "s!$1/!!" | while read x
do
	[ "$x" = $1 ] && continue
	[ -d $1/$x ] && {
		#
		#  We preserve the directories which are always here;
		#
		case $x in
		    bin|sbin|etc|lib|libexec|include|info)
			continue
			;;
		    man|man/man[0-9l]|man/cat[0-9l])
			continue
			;;
		    share|share/nls|share/nls/*|share/man|share/man/*)
			continue
			;;
		    *)
		        #
		        #  pkg_delete will clean everything else.
		        #
			echo "@dirrm $x"
			;;
		esac
	} || {
		echo $x
		#
		# If it's a library, launch ranlib(1) on it.
		#
		expr $x : 'lib.*\.a$' > /dev/null && echo '@exec ranlib %D/%F'
	}
done

exit 0
======================== cut here ==========================

-- 

	With best regards -- Andrew Stesin.

	+380 (44) 2760188	+380 (44) 2713457	+380 (44) 2713560

	"You may delegate authority, but not responsibility."
					Frank's Management Rule #1.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603181233.OAA08060>