This document was written in 2011 and is now just for reference. It will not be updated. The TODO is outdated, but do not change it, this would not help. See the [[.:usersguide:|UsersGuide]] to use pkgsrc, and the [[.:developersguide:|DevelopersGuide]] if you want to play with the various facets of pkgsrc and its content.
===== Testing pkgsrc on Minix =====
==== About this page ====
This page describes how to build packages with pkgsrc. It is intended for people who would like to help port packages and develop pkgsrc further. If you just want to install binary packages, you should read [[.:usersguide:installingbinarypackages|Installing Binary Packages]]. While this page also describes basic usage, more information can be found at [[http://www.netbsd.org/docs/pkgsrc|pkgsrc guide]].
==== Prerequisites ====
=== Regular way ===
You need a minix system installed with a post-pkgsrc .iso (a 3.1.8 development version), see [[http://www.minix3.org/download/|the download page]]. This comes with pkgsrc support in the base system, and pkgin (the binary package manager) pre-installed. This is necessary to bootstrap pkgsrc functionality (e.g. building packages).
pkgsrc is self-hosting, i.e. you should need no packages from packman in order to compile or install pkgsrc packages. Instructions for checking out and building Minix trunk can be found on the [[.:developersguide:trackingcurrent|Tracking Current]] wiki page.
=== Bootstrapping binary packages after source-upgrading older systems ===
If you have source-upgraded, i.e. have pkg_add, etc., installed, you can bootstrap your system to install binary packages by installing pkgin as a binary like so:
# pkg_add ftp://ftp.minix3.org/pub/minix/packages/3.1.9/i386/All/pkgin-0.3.3.1nb1.tgz
==== Setting up pkgsrc on Minix ====
This section is about the /usr/pkgsrc source tree, needed if you want to compile or contribute packages, or patches. If you just want binary packages, see later sections.
Required for this step: git. Install it with
# pkgin in scmgit-base
To set up the pkgsrc tree:
# cd /usr
# make pkgsrc-create
Note: this takes more than 400Mb of hard disk space (as of January 7th, 2011)
To update the pkgsrc tree in the future:
# cd /usr
# make pkgsrc-update
==== Compiling a package ====
All pkgsrc operations should be done with bmake.
To build a package (misc/figlet in this example) you need to cd to that directory and do a make install
# cd /usr/pkgsrc/misc/figlet
# bmake install
This installs figlet in /usr/pkg
==== Working with binary packages ====
=== pkgin ===
This is the recommended binary package UI. See [[.:usersguide:installingbinarypackages|Installing Binary Packages]] for more info.
Newer 3.1.8 cdrom images include pkgin pre-installed. Do a 'pkgin up' (for update) to get started.
=== pkgsrc binary installing interface ===
There is a small number of binary packages that have been uploaded and can be installed with the rudimentary pkgsrc interface. From a package dir, type 'make bin-install,' like so:
# cd /usr/pkgsrc/misc/figlet
# bmake bin-install
===> Binary install for figlet-2.2.2nb1
=> Installing figlet-2.2.2nb1 from /usr/pkgsrc/packages/All;ftp://ftp.minix3.org/pub/minix/packages/3.1.8/i386/All
figlet-2.2.2nb1: rebuilding run-time library search paths database
figlet-2.2.2nb1 successfully installed.
To see which binary packages are available, see [[ftp://ftp.minix3.org/pub/minix/packages/3.1.8/i386/|the Minix binary package repository for 3.1.8/i386]].
==== Packages that currently compile on Minix ====
Over 150 packages currently compile on Minix. The most complete and up to date list can be found in [[http://git.minix3.org/?p=pkgsrc.git;a=blob;f=minix/limited_list.pbulk;hb=refs/heads/minix-master|/usr/pkgsrc/minix/limited_list.pbulk]].
==== Porting other packages ====
Quite a few packages that compile on Minix do not build within pkgsrc as Minix specific patches are missing. We will use devel/ncurses as an example to illustrate the process of creating patches in pkgsrc format
We need to first install pkgdiff which contains the tools required to make patches in pkgsrc format.
**Note 1:** devel/ncurses has already been worked on.
**Note 2:** Compiling pkgdiff, will compile perl and gzip as dependencies, If you want to avoid this, install perl and gzip from packman
# cd pkgtools/pkgdiff
# bmake install
Now extract and apply existing patches to the source
# cd /usr/pkgsrc/devel/ncurses
# bmake patch
Packages are extracted and built by default in /usr/tmp/work.
# cd /usr/pkgsrc/work/devel/ncurses/work
# ls
...
ncurses-5.7
...
Here you will find the extracted and patched version of ncurses. Now apply any minix specfic changes to the source code. Minix specific changes for several packages can be found in the [[http://gforge.cs.vu.nl/gf/project/minix/scmsvn/?action=browse&path=/trunk/bigports/|bigports]] repository.
**Before changing a file, backup the original version with an added .orig suffix. If you use pkgvi (part of pkgdiff) to edit the file, this gets done automatically. If you don't backup with the right suffix, mkpatches below doesn't work.**
You can build the source in the work directory by typing 'make minix'. Repeat until it builds and works.
Now build the package
# cd /usr/pkgsrc/devel/ncurses
# bmake
Since packages found in pkgsrc are generally newer than the ones in bigports, you might need to make a few more changes.
Once the package builds successfully, it's time to make patches:
# cd /usr/pkgsrc/devel/ncurses
# mkpatches -d patches
# rm patches/*.orig
# bmake mdi
the new patches are now installed in /usr/pkgsrc/devel/ncurses/patches. See man mkpatches for details. It is a good idea to manually inspect them.
bmake mdi updates the distinfo file. If you don't run make mdi the command "make" doesn't recognize the new patches.
**Note**: pkgsrc modifies gnu configure scripts and makefiles. So when you do mkpatches, it is likely that the created patches have these changes, these need to be removed.
Make sure everything works fine with the new set of patches:
# bmake clean
# bmake
==== Submitting changes and reporting bugs ====
Currently you just mail them to me [gautam (at) minix3 (dot) org].
===== Pkgsrc TODO items =====
==== Packages we have from pkgsrc but that need to pass testsuites too ====
* Gcc
* Binutils
* Git
* Subversion
==== Packages we need but don't have yet ====
* clang+llvm
* python
* zsh
* nvi
* wget
* GNU coreutils
* emacs
* e2fsprogs
* OSS
===== Volunteer Pkgsrc =====
A secondary pkgsrc repository has been created to allow volunteers to contribute to pkgsrc directly. It is currently experimental as its relationship to the primary pkgsrc repository has yet to be determined.
To read more, please see [[.:volunteerpkgsrc|Volunteer Pkgsrc]].