| README.md | 10 months ago | ||
| pkgsrc-newprefix | 10 months ago | ||
This script allows you to install pkgsrc-apps into your favorite directory without confliction with any other applications you've already have.
If you are using pkgsrc in your system, you might want to examine if the new version in new pkgsrc works or not, or fails to build. Using `bmake update' or pkg_rolling-replace is handy enough to update all the apps in your /usr/pkg, but if one of package fails to compile, you will lost all the applications under dependency.
Try to newly build new application in new $PREFIX!
If you are using LibreOffice and Firefox which come from pkgsrc, it is recommended that you have application-dedicated directories as below:
/opt+firefox+158.1/...
| +158.2/...
| +159.0/...
+LO+25.0/...
| +25.1/...
| +26.0/...
If the new version of firefox comes to pkgsrc, try to do this.
% pkgsrc-newprefix -bM -p /opt/firefox/159.1
This script will execute pkgsrc-bootstrap with a new prefix(/opt/firefox/159.1) and call bmake in that directory. If compilation fails, you only need to is rm -r /opt/firefox/159.1. No applications currently you use will be affected.
(-b option: Use bash to execute configure script
-M option: Force to specify X11_TYPE=modular, good for firefox)
It requires NO privilege in most cases.
% pkgsrc-newprefix -p /opt/pkg2026q1% pkgsrc-newprefix -p /opt/pkg2026q1 meta-pkgs/mate x11/gnome-terminal% pkgsrc-newprefix -p /opt/pkg2026q1 multimedia/ffmpeg99Pkgsrc building ordinarily installs all the tools as build-dependencies'. You might have manyGCC's in your package directories. Although we can afford more disk spaces nowadays due to the decreased cost of storage, it is no doubt that having many same build tools are redundant. You can eliminate only build-dependencies by install apps twice as below:
STEP 1: pkgsrc-newprefix -p $PREFIX -t $WORKDIR # takes some hours STEP 2: rm -r $PREFIX STEP 3: pkgsrc-newprefix -A -p $PREFIX -t $WORKDIR # takes few minutes
The `-A' option installs binary packages saved under $WORKDIR without compilation processes.
pkgsrc-newprefix - Create new pkgsrc tree with some required packages
Usage: pkgsrc-newprefix [options] PackagesToInstall...
Options are:
-p PREFIX Set pkg tree prefix to PREFIX (/usr/pkg.2025-03-01)
-P PKGDIR Set binary package dir to PKGDIR ()
-j N Set MAKE_JOBS value to N (nCPU)
-w WORKDIR Set WRKOBJDIR value to DIR ($PREFIX/w)
-s PKGSRCdir Location of pkgsrc top directory (/usr/pkgsrc)
-d DISTdir Location of pkgsrc DISTDIR (/usr/pkgsrc/distfiles)
-N Set X11_TYPE=native (default on NetBSD)
-M Set X11_TYPE=modular
-i Install pkgs only - Skip bootstrap
-A (Add)pkg_add $PKGDIR/PKG.tgz instead of build, if any.
-a "PkgList..." Add PkgList... to installation list
-c yes|no|auto Use cwrappers mode
-C Do clean-depends on each successful build
-b Use bash for CONFIG_SHELL and WRAPPER_SHELL
-U Replace an already installed package if exists
(Cannot skip pkg with version number eg. py38-*)
-t TMPDIR Use $TMPDIR as default prefix of WORKOBJDIR/PKGDIR
Effective environment variables are:
PKGSRC Location of pkgsrc source tree
DISTDIR Location of distfiles
LOCALPATCHES Location of local patches
MK_JOBS Number of MAKE_JOBS (make -j)
PKG_PREFIX Installation prefix of pkgsrc software
COMPILER Which compiler to build (see bootstrap/README*)
This script is distributed under `The 2-Clause BSD License'.