From owner-freebsd-ports Mon Mar 18 04:53:11 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id EAA20137 for ports-outgoing; Mon, 18 Mar 1996 04:53:11 -0800 (PST) Received: from burka.carrier.kiev.ua (burka.carrier.kiev.ua [193.125.68.131]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id EAA20130 for ; Mon, 18 Mar 1996 04:52:30 -0800 (PST) Received: from sivka.carrier.kiev.ua (root@sivka.carrier.kiev.ua [193.125.68.130]) by burka.carrier.kiev.ua (Sendmail 8.who.cares/5) with ESMTP id OAA08043 for ; Mon, 18 Mar 1996 14:52:56 +0200 Received: from elvisti.kiev.ua (uucp@localhost) by sivka.carrier.kiev.ua (Sendmail 8.who.cares/5) with UUCP id OAA04668 for ports@freebsd.org; Mon, 18 Mar 1996 14:04:16 +0200 Received: from office.elvisti.kiev.ua (office.elvisti.kiev.ua [193.125.28.33]) by spider2.elvisti.kiev.ua (8.6.12/8.ElVisti) with ESMTP id OAA16608 for ; Mon, 18 Mar 1996 14:33:55 +0200 Received: (from stesin@localhost) by office.elvisti.kiev.ua (8.6.12/8.ElVisti) id OAA08060; Mon, 18 Mar 1996 14:33:54 +0200 From: "Andrew V. Stesin" Message-Id: <199603181233.OAA08060@office.elvisti.kiev.ua> Subject: Re: HOWTO make a FreeBSD port To: andreas@knobel.gun.de (Andreas Klemm) Date: Mon, 18 Mar 1996 14:33:53 +0200 (EET) Cc: doc@freebsd.org, ports@freebsd.org In-Reply-To: <199603171911.UAA09099@knobel.gun.de> from "Andreas Klemm" at Mar 17, 96 08:11:08 pm X-Mailer: ELM [version 2.4 PL24alpha5] Content-Type: text Sender: owner-ports@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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.