From d1153fd1f0a2e3fe87e5510907f6c20173cb5dab Mon Sep 17 00:00:00 2001 From: rillig Date: Thu, 1 Jun 2006 08:39:03 +0000 Subject: Added a chapter "creating a pkgsrc package" that serves as an introduction to the developer's guide. --- doc/guide/files/Makefile | 3 +- doc/guide/files/chapters.ent | 3 +- doc/guide/files/creating.xml | 103 +++++++++++++++++++++++++++++++++++++++++++ doc/guide/files/pkgsrc.xml | 10 ++++- 4 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 doc/guide/files/creating.xml (limited to 'doc') diff --git a/doc/guide/files/Makefile b/doc/guide/files/Makefile index 4cfaaab13aa..fdf034afe51 100644 --- a/doc/guide/files/Makefile +++ b/doc/guide/files/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2006/05/24 07:55:59 mishka Exp $ +# $NetBSD: Makefile,v 1.9 2006/06/01 08:39:03 rillig Exp $ WEB_PREFIX?= ${.CURDIR}/../htdocs @@ -8,6 +8,7 @@ SRCS= pkgsrc.xml SRCS+= binary.xml SRCS+= build.xml SRCS+= buildlink.xml +SRCS+= creating.xml SRCS+= components.xml SRCS+= configuring.xml SRCS+= debug.xml diff --git a/doc/guide/files/chapters.ent b/doc/guide/files/chapters.ent index 6a9c76a0b15..b3dcfd499cb 100644 --- a/doc/guide/files/chapters.ent +++ b/doc/guide/files/chapters.ent @@ -1,7 +1,7 @@ @@ -15,6 +15,7 @@ + diff --git a/doc/guide/files/creating.xml b/doc/guide/files/creating.xml new file mode 100644 index 00000000000..5606728d8ec --- /dev/null +++ b/doc/guide/files/creating.xml @@ -0,0 +1,103 @@ + + + +Creating a new pkgsrc package from scratch + + When you find a package that is not yet in pkgsrc, you + most likely have a URL from where you can download the source + code. Starting with this URL, creating a package involves only a + few steps. + + + + First, install the packages pkgtools/url2pkg and pkgtools/pkglint. + + Then, choose one of the top-level directories as the + category in which you want to place your package. You can also + create a directory of your own (maybe called + local). In that category directory, create + another directory for your package and change into + it. + + Run the program url2pkg, which + will ask you for a URL. Enter the URL of the distribution file + (in most cases a .tar.gz file) and watch + how the basic ingredients of your package are created + automatically. The distribution file is extracted automatically + to fill in some details in the Makefile + that would otherwise have to be done manually. + + Examine the extracted files to determine the + dependencies of your package. Ideally, this is mentioned in some + README file, but things may differ. For + each of these dependencies, look where it exists in pkgsrc, and + if there is a file called buildlink3.mk in + that directory, add a line to your package + Makefile which includes that file just + before the last line. If the buildlink3.mk + file does not exist, add a DEPENDS line to + the Makefile, which specifies the version of the dependency and + where it can be found in pkgsrc. This line should be placed in + the third paragraph. If the dependency is only needed for + building the package, but not when using it, use + BUILD_DEPENDS instead of + DEPENDS. Your package may then look like + this: + + + [...] + + BUILD_DEPENDS+= lua>=5.0:../../lang/lua + DEPENDS+= screen-[0-9]*:../../misc/screen + DEPENDS+= screen>=4.0:../../misc/screen + + [...] + + .include "../../category/package/buildlink3.mk" + .include "../../devel/glib2/buildlink3.mk" + .include "../../mk/bsd.pkg.mk" + + + + + Run pkglint to see what things + still need to be done to make your package a good + one. If you don't know what pkglint's warnings want to tell you, + try pkglint --explain or pkglint + -e, which outputs additional + explanations. + + Now, run bmake to build the + package. For the various things that can go wrong in this phase, + consult . + + When the package builds fine, the next step is to + install the package. Run bmake install and + hope that everything works. + + Up to now, the file PLIST, + which contains a list of the files that are installed by the + package, is nearly empty. Run bmake print-PLIST + >PLIST to generate a probably correct list. Check + the file using your preferred text editor to see if the list of + files looks plausible. + + Run pkglint again to see if the + generated PLIST contains garbage or + not. + + When you ran bmake install, the + package has been registered in the database of installed files, + but with an empty list of files. To fix this, run bmake + deinstall and bmake install again. + Now the package is registered with the list of files from + PLIST. + + Run bmake package to create a + binary package from the set of installed files. + + + + diff --git a/doc/guide/files/pkgsrc.xml b/doc/guide/files/pkgsrc.xml index 098dab39d30..34dbe928cbe 100644 --- a/doc/guide/files/pkgsrc.xml +++ b/doc/guide/files/pkgsrc.xml @@ -1,4 +1,4 @@ - + @@ -45,7 +45,7 @@ The NetBSD Foundation, Inc - $NetBSD: pkgsrc.xml,v 1.18 2006/05/19 22:05:09 rillig Exp $ + $NetBSD: pkgsrc.xml,v 1.19 2006/06/01 08:39:03 rillig Exp $ @@ -75,6 +75,12 @@ The pkgsrc developer's guide + This part of the book deals with creating and + modifying packages. It starts with a HOWTO-like + guide on creating a new package. The remaining chapters are more + like a reference manual for pkgsrc. + + &chap.creating; &chap.components; &chap.makefile; &chap.plist; -- cgit v1.2.3