Alternatives: SRPM, Debian, Gentoo portage, pkgsrc, ...
List of packages: http://www.NetBSD.org/packages/
Installation happens with a few simple commands:
| 1. | make fetch: | Download the sources |
| 2. | make checksum: | Ensure integrity |
| 3. | make install-depends: | Install required packages |
| 4. | make extract: | Unpack |
| 5. | make patch: | Apply patches |
| 6. | make configure: | Configure |
| 7. | make build: | Compile |
| 8. | make install: | Install and register (for pkg_info(1) etc.) |
| 9. | make package: | Make binary package (optional) |
| 10. | make clean: | Remove working directory |
Exercises:
rfhpc8317% cat x11/xteddy/Makefile
# $NetBSD: Makefile,v 1.13 2005/06/01 18:03:33 jlam Exp $
DISTNAME= xteddy-1.1
CATEGORIES= x11 games
MASTER_SITES= http://www.ITN.LiU.SE/~stegu/xteddy/
MAINTAINER= johnam@mail.kemper.org
HOMEPAGE= http://www.ITN.LiU.SE/~stegu/xteddy
COMMENT= Xteddy is a cuddly teddy bear for your X Windows desktop
GNU_CONFIGURE= YES
pre-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/xteddy
${INSTALL_DATA_DIR} ${PREFIX}/share/xteddy/pixmaps
.include "../../graphics/xpm/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
Exercises:
rfhpc8317% cd /home1/NetBSD/cvs/pkgsrc/ rfhpc8317% grep ^DEPEND meta-pkgs/kde3/Makefile DEPENDS+= kdeartwork-3.1.4:../../misc/kdeartwork3 DEPENDS+= kdeaddons-3.1.4:../../misc/kdeaddons3 DEPENDS+= kdeadmin-3.1.4:../../misc/kdeadmin3 DEPENDS+= kdeedu-3.1.4:../../misc/kdeedu3 DEPENDS+= kdegames-3.1.4:../../games/kdegames3 DEPENDS+= kdegraphics-3.1.4:../../graphics/kdegraphics3 DEPENDS+= kdemultimedia-3.1.4:../../audio/kdemultimedia3 DEPENDS+= kdenetwork-3.1.4:../../net/kdenetwork3 DEPENDS+= kdepim-3.1.4:../../misc/kdepim3 DEPENDS+= kdetoys-3.1.4:../../games/kdetoys3 DEPENDS+= kdeutils-3.1.4:../../misc/kdeutils3 DEPENDS+= quanta-3.1.4:../../www/quanta3The variable DEPENDS is assigned pairs of the form "name-version:directory". "name-version" are the name and the version of the required package, "directory" is a path relative to the current package's directory which is the directory from which the package can be installed, if it is not already installed.
Exercises:
Packages which require information about a certain other package pull this information right from that other package, without storing redundant information like the current version number, etc.:
rfhpc8317% grep .include graphics/xpaint/Makefile .include "../../graphics/jpeg/buildlink3.mk" .include "../../graphics/png/buildlink3.mk" .include "../../graphics/tiff/buildlink3.mk" .include "../../graphics/xpm/buildlink3.mk" .include "../../mk/bsd.pkg.mk"The buildlink files contain other information, which are helpful when using the package, e.g.:
rfhpc8317% cat graphics/jpeg/buildlink3.mk
# $NetBSD: buildlink3.mk,v 1.6 2004/10/03 00:14:54 tv Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
JPEG_BUILDLINK3_MK:= ${JPEG_BUILDLINK3_MK}+
.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= jpeg
.endif
BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Njpeg}
BUILDLINK_PACKAGES+= jpeg
.if !empty(JPEG_BUILDLINK3_MK:M+)
BUILDLINK_DEPENDS.jpeg+= jpeg>=6b
BUILDLINK_RECOMMENDED.jpeg+= jpeg>=6bnb2
BUILDLINK_PKGSRCDIR.jpeg?= ../../graphics/jpeg
.endif # JPEG_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
With the help of a number of variables, information is passed to the
pkgsrc system, containing the following information:
Exercises:
Demo: compiling and installing the xteddy package.
yui# pkg_info xteddy
pkg_info: can't find package `xteddy' installed or in a file!
yui# cd /usr/pkgsrc/*/xteddy
yui# ls
CVS DESCR Makefile PLIST distinfo patches
yui#
yui# make
===> Checking for vulnerabilities in xteddy-1.1
=> Checksum SHA1 OK for xteddy-1.1.tar.gz.
=> Checksum RMD160 OK for xteddy-1.1.tar.gz.
===> Extracting for xteddy-1.1
===> Required installed package x11-links>=0.25: x11-links-0.26 found
===> Patching for xteddy-1.1
===> Applying pkgsrc patches for xteddy-1.1
===> Overriding tools for xteddy-1.1
===> Creating toolchain wrappers for xteddy-1.1
===> Configuring for xteddy-1.1
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... missing
checking for gcc... cc
checking whether the C compiler (cc -O2 -I/usr/pkg/include -I/usr/X11R6/include -L/usr/pkg/lib -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -Wl,-R/usr/pkg/lib) works... yes
checking whether the C compiler (cc -O2 -I/usr/pkg/include -I/usr/X11R6/include -L/usr/pkg/lib -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -Wl,-R/usr/pkg/lib) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether cc accepts -g... yes
checking how to run the C preprocessor... cc -E
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for main in -lXpm... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
===> Building for xteddy-1.1
cc -DPACKAGE=\"xteddy\" -DVERSION=\"1.1\" -DHAVE_LIBXPM=1 -DPIXMAP_PATH=\"/usr/pkg/share/xteddy/pixmaps\" -I. -I. -I/usr/pkg/include -I/usr/X11R6/include -O2 -I/usr/pkg/include -I/usr/X11R6/include -I/usr/X11R6/include -c xteddy.c
cc -O2 -I/usr/pkg/include -I/usr/X11R6/include -L/usr/pkg/lib -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -Wl,-R/usr/pkg/lib -o xteddy -L/usr/X11R6/lib -lSM -lICE xteddy.o -L/usr/X11R6/lib -lX11 -lXext -lXpm
=> Unwrapping files-to-be-installed.
yui#
yui#
yui# ls work.i386/
.build_done .gcc .tools_makevars.mk
.build_makevars.mk .patch_done .work.log
.buildlink .patch_makevars.mk .wrapper
.configure_done .pkgdb .wrapper_done
.configure_makevars.mk .subst_unwrap_done .wrapper_makevars.mk
.extract_done .tools .x11-buildlink
.extract_makevars.mk .tools_done xteddy-1.1
yui# ls work.i386/xteddy-1.1/
AUTHORS NEWS configure xteddy
COPYING README configure.in xteddy.1
ChangeLog aclocal.m4 configure.orig xteddy.README
INSTALL autogen.sh html xteddy.c
Makefile config.cache install-sh xteddy.o
Makefile.am config.h.in missing
Makefile.in config.log mkinstalldirs
Makefile.in.orig config.status pixmaps
yui# ./work.i386/xteddy-1.1/xteddy
Can not find /usr/pkg/share/xteddy/pixmaps/./work.i386/xteddy-1.1/xteddy_color.xpm.
yui#
yui# pwd
/disk1/cvs/pkgsrc/x11/xteddy
yui# make install
===> Checking for vulnerabilities in xteddy-1.1
===> Installing for xteddy-1.1
install -d -o root -g wheel -m 755 /usr/pkg/share/xteddy
install -d -o root -g wheel -m 755 /usr/pkg/share/xteddy/pixmaps
/bin/sh ./mkinstalldirs /usr/pkg/bin
install -c -s -o root -g wheel -m 555 xteddy /usr/pkg/bin/xteddy
make install-man1
/bin/sh ./mkinstalldirs /usr/pkg/man/man1
install -c -o root -g wheel -m 444 ./xteddy.1 /usr/pkg/man/man1/xteddy.1
/bin/sh ./mkinstalldirs /usr/pkg/share/xteddy
install -c -o root -g wheel -m 444 ./pixmaps/xteddy_bw.xbm /usr/pkg/share/xteddy/pixmaps/xteddy_bw.xbm
install -c -o root -g wheel -m 444 ./pixmaps/xteddy_color.xpm /usr/pkg/share/xteddy/pixmaps/xteddy_color.xpm
install -c -o root -g wheel -m 444 ./pixmaps/xteddy_icon.xbm /usr/pkg/share/xteddy/pixmaps/xteddy_icon.xbm
install -c -o root -g wheel -m 444 ./pixmaps/xteddy_mask.xbm /usr/pkg/share/xteddy/pixmaps/xteddy_mask.xbm
install -c -o root -g wheel -m 444 ./pixmaps/xpenguin_bw.xbm /usr/pkg/share/xteddy/pixmaps/xpenguin_bw.xbm
install -c -o root -g wheel -m 444 ./pixmaps/xpenguin_color.xpm /usr/pkg/share/xteddy/pixmaps/xpenguin_color.xpm
install -c -o root -g wheel -m 444 ./pixmaps/xpenguin_icon.xbm /usr/pkg/share/xteddy/pixmaps/xpenguin_icon.xbm
install -c -o root -g wheel -m 444 ./pixmaps/xpenguin_mask.xbm /usr/pkg/share/xteddy/pixmaps/xpenguin_mask.xbm
install -c -o root -g wheel -m 444 ./pixmaps/teddy_bw.xbm /usr/pkg/share/xteddy/pixmaps/teddy_bw.xbm
install -c -o root -g wheel -m 444 ./pixmaps/teddy_color.xpm /usr/pkg/share/xteddy/pixmaps/teddy_color.xpm
install -c -o root -g wheel -m 444 ./pixmaps/teddy_icon.xbm /usr/pkg/share/xteddy/pixmaps/teddy_icon.xbm
install -c -o root -g wheel -m 444 ./pixmaps/teddy_mask.xbm /usr/pkg/share/xteddy/pixmaps/teddy_mask.xbm
===> Registering installation for xteddy-1.1
===> Checking for work-directory references in xteddy-1.1
yui#
yui# pkg_info -e xteddy
xteddy-1.1
yui# pkg_info xteddy
Information for xteddy-1.1:
Comment:
Xteddy is a cuddly teddy bear for your X Windows desktop
Description:
Normally, xteddy just sits around doing nothing. After
all, that's what teddy bears are for. Look at him, talk to
him, place heavy windows on top of him, zap him around
until he becomes dizzy, do what you like; he will always
be your true (albeit virtual) friend.
Homepage:
http://www.ITN.LiU.SE/~stegu/xteddy
yui# xteddy
^C
yui#
yui# pwd
/disk1/cvs/pkgsrc/x11/xteddy
yui# make deinstall
===> Deinstalling for xteddy
Running /usr/sbin/pkg_delete -K /var/db/pkg xteddy-1.1
yui# pkg_info xteddy
pkg_info: can't find package `xteddy' installed or in a file!
Directory Layout:
| $HOME/ | |||||
| OS/ | Common files for all operating systems | ||||
| pkgsrc_env_no-root | File with definitions for non-root builds | ||||
| pkgsrc/ | Symlink to /home1/NetBSD/cvs/pkgsrc/ | ||||
| distfiles/ | Compressed source archives (.tar.gz, ...) | ||||
| OS-NetBSD/ | Files for NetBSD | ||||
| tmp/ | Working directory | ||||
| db/pkg/ | Management information | ||||
| packages/ | Binary pkgs from "make package" | ||||
| pkg/ | Installed packages | ||||
| var/ | Miscellaneous files | ||||
| OS-SunOS/ | As OS-NetBSD, for Solaris | ||||
| OS-Linux/ | The same, for Linux |
rfhpc8133% ssh shell.cs.stevens.edu murky% mkdir $HOME/OS murky% cd $HOME/OS murky% wget -q http://www.feyrer.de/OS/pkgsrc_env_no-root murky% setenv MAKECONF `pwd`/pkgsrc_env_no-root murky% ls -la $MAKECONF -rw-rw-r-- 1 feyrer cs 816 Oct 6 04:46 /usr/faculty/cs/feyrer/OS/pkgsrc_env_no-root murky% ln -s /usr/pkgsrc .
murky% cd pkgsrc/misc/figlet/ murky% make ... murky% make install ...
murky% setenv PKG_DBDIR $HOME/OS/OS-NetBSD/db/pkg murky% pkg_info murky% pkg_info figlet murky% pkg_info -qL figlet
murky% set path= ( $HOME/OS/OS-NetBSD/pkg/bin $path )
murky% rehash
murky% which figlet
/net/rfhs8012/home3/bedienst/feyrer/OS/OS-NetBSD/pkg/bin/figlet
murky% figlet Hello World
_ _ _ _ __ __ _ _
| | | | ___| | | ___ \ \ / /__ _ __| | __| |
| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` |
| _ | __/ | | (_) | \ V V / (_) | | | | (_| |
|_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_|
noon% ssh heineken.cs.stevens.edu heineken% cd $HOME/OS heineken% wget -q http://www.feyrer.de/OS/pkgsrc_env_no-root heineken% setenv MAKECONF `pwd`/pkgsrc_env_no-root heineken% ls -la $MAKECONF -rw-rw-r-- 1 feyrer cs 816 Oct 6 04:46 /usr/faculty/cs/feyrer/OS/pkgsrc_env_no-root heineken% heineken% env CVS_RSH=ssh \ ? cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot co \ ? pkgsrc/bootstrap \ ? pkgsrc/pkgtools/libnbcompat \ ? pkgsrc/net/tnftp \ ? pkgsrc/pkgtools/digest \ ? pkgsrc/archivers/pax \ ? pkgsrc/pkgtools/mtree \ ? pkgsrc/pkgtools/pkg_install U pkgsrc/bootstrap/README ...
heineken% cd pkgsrc/bootstrap/
heineken% setenv MY_HOME $HOME/OS/OS-`uname -s`
heineken% setenv LOCALBASE ${MY_HOME}/pkg
heineken% setenv PKG_DBDIR ${MY_HOME}/db/pkg
heineken% ./bootstrap \
? --prefix=${LOCALBASE} \
? --pkgdbdir=${PKG_DBDIR} \
? --ignore-user-check
===> bootstrap command: ./bootstrap --prefix=/home/feyrer/OS/OS-Linux/pkg --pkgdbdir=/home/feyrer/OS/OS-Linux/db/pkg --ignore-user-check
===> bootstrap started: Mon Aug 15 23:38:05 EDT 2005
Working directory is: work
===> running: /bin/sed -e 's|@DEFAULT_INSTALL_MODE@|'0755'|' files/install-sh.in > work/install-sh
===> running: /bin/chmod +x work/install-sh
===> building as unprivileged user feyrer/cs
===> Building libnbcompat
.....
...
.
...
.....
===> Installing packages(7) man page
===> running: /bin/sh work/install-sh -c -m 444 files/packages.cat7 /home/feyrer/OS/OS-Linux/pkg/man/cat7/packages.0
Please remember to add /home/feyrer/OS/OS-Linux/pkg/bin to your PATH environment variable
and /home/feyrer/OS/OS-Linux/pkg/man to your MANPATH environment variable, if necessary.
An example mk.conf file "work/mk.conf.example" with the settings you
provided to "bootstrap" has been created for you.
Please copy work/mk.conf.example to /home/feyrer/OS/OS-Linux/pkg/etc/mk.conf.
You can find extensive documentation of the NetBSD Packages Collection
in /home/feyrer/OS/pkgsrc/doc/pkgsrc.txt and packages(7).
Hopefully everything is now complete.
Thank you
===> bootstrap started: Mon Aug 15 23:38:05 EDT 2005
===> bootstrap ended: Mon Aug 15 23:41:00 EDT 2005
heineken%
heineken%
heineken% cd $MY_HOME/pkg
heineken% ls
bin lib man sbin share
heineken% ls *bin
bin:
bmake cpio digest ftp pax tar
sbin:
linkfarm mtree pkg_add pkg_admin pkg_create pkg_delete
pkg_info pkg_view
heineken% cd $HOME/OS/OS-`uname -s`/pkg heineken% set path=( `pwd`/bin `pwd`/sbin $path ) heineken% rehash heineken% heineken% cd $HOME/OS heineken% mv pkgsrc pkgsrc.bootstrap heineken% ln -s /usr/pkgsrc . heineken% heineken% setenv MAKECONF `pwd`/pkgsrc_env_no-root heineken% setenv PKG_DBDIR $HOME/OS/OS-`uname -s`/db/pkg heineken% pkg_info digest-20050731 Message digest wrapper utility
heineken% cd $HOME/OS/pkgsrc/misc/figlet/
heineken% bmake
...
heineken% bmake install
...
heineken% pkg_info
digest-20050731 Message digest wrapper utility
figlet-2.2.1nb2 Print text banners in fancy ASCII art characters
heineken% rehash
heineken% which figlet
/usr/faculty/cs/feyrer/OS/OS-Linux/pkg/bin/figlet
heineken% figlet Hello `uname -s`
_ _ _ _ _ _
| | | | ___| | | ___ | | (_)_ __ _ ___ __
| |_| |/ _ \ | |/ _ \ | | | | '_ \| | | \ \/ /
| _ | __/ | | (_) | | |___| | | | | |_| |> <
|_| |_|\___|_|_|\___/ |_____|_|_| |_|\__,_/_/\_\