Available to PC-BSD is its own PBI collection, FreeBSD ports, and FreeBSD packages. However, it is also possible to use the NetBSD pkgsrc system to build software. This is not (yet) a pre-configured feature, which means there are some special instructions to follow for this functionality to be enabled. This section will describe how to configure and use NetBSD pkgsrc from PC-BSD. <br>'''NOTE:''' Although these instructions seem complete and look polished, there is still some testing in progress, so be wary.

# Bootstrap pkgsrc. FreeBSD stores its ports pkg database in /var/db/pkg/. It is therefore recommended to use /usr/db/pkgsrc/ with the --pkgdbdir flag as below:<br><br><nowiki>#</nowiki> cd /usr/pkgsrc/bootstrap/<br><nowiki>#</nowiki> ./bootstrap --pkgdbdir /var/db/pkgsrc<br><br>

+

−

# The NetBSD pkg tools and FreeBSD pkg tools have identical names. It is recommended to change the name of the NetBSD set to match 'bmake' by prepending a 'b' to each, as follows:<br><br><nowiki>#</nowiki> cd /usr/pkg/sbin/<br><nowiki>#</nowiki> mv pkg_add bpkg_add<br><nowiki>#</nowiki> mv pkg_create bpkg_create<br><nowiki>#</nowiki> mv pkg_delete bpkg_delete<br><nowiki>#</nowiki> mv pkg_info bpkg_info<br><br>If the FreeBSD ports tools will not be used, they can be moved out of the way as follows:<br><br><nowiki>#</nowiki> cd /usr/sbin/<br><nowiki>#</nowiki> mv pkg_add pkg_add.orig<br><nowiki>#</nowiki> mv pkg_create pkg_create.orig<br><nowiki>#</nowiki> mv pkg_delete pkg_delete.orig<br><nowiki>#</nowiki> mv pkg_info pkg_info.orig<br><br>

# Add the PKG_PATH definition for the latest collection of pkgsrc packages (5.1_2011Q4) to the user's .cshrc file with the following line:<br><br><nowiki>setenv PKG_PATH ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1_2011Q4/All/</nowiki><br><br>

# The vulnerabilities of some ports (ie Firefox) may prevent them from being built. An example mk.conf file will be placed in /etc/mk.conf.example file when you use the bootstrap script. Adjust /usr/pkg/etc/mk.conf to allow vulnerable programs to be built by adding the following line:<br><br>ALLOW_VULNERABLE_PACKAGES=TRUE<br><br>

+

−

==Keeping pkgsrc up to date==

+

<!--T:2-->

−

# The process for using tar files is very much the same as when obtaining them originally, except that the old tree must be erased first<br><br><nowiki>#</nowiki> rm -rf /usr/pkgsrc/<br><nowiki># ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz</nowiki><br><nowiki>#</nowiki> tar -xzf pkgsrc.tar.gz -C /usr<br><br>

+

Available to PC-BSD® is its own PBI collection, FreeBSD ports, and FreeBSD packages. However, it is also possible to use the NetBSD pkgsrc system to build software. This is not (yet) a pre-configured feature, which means there are some special instructions to follow for this functionality to be enabled. '''This is not an official feature.''' This section will describe how to configure and use NetBSD pkgsrc from PC-BSD®.{{caveat|icon64=Although these instructions seem complete and look polished, there may still be ommissions or inaccuracies, so be wary.}}{{warning|icon64='''<span class=txtlg>This was originally written/explored in Dec 2011, and should be updated/re-tested.</span>'''}}

# The vulnerabilities of some ports (ie Firefox) may prevent them from being built. An example mk.conf file will be placed in /etc/mk.conf.example file when you use the bootstrap script. Adjust /usr/pkg/etc/mk.conf to allow vulnerable programs to be built by adding the following line:

+

#: ALLOW_VULNERABLE_PACKAGES=TRUE

+

+

== Keeping pkgsrc up to date == <!--T:5-->

+

+

<!--T:6-->

+

# The process for using tar files is very much the same as when obtaining them originally, except that the old tree must be erased first<br/>

ERROR: - "/usr/pkgsrc/bootstrap/work/bin/bmake replace" to replace only the package without re-linking dependencies,

ERROR: - "/usr/pkgsrc/bootstrap/work/bin/bmake replace" to replace only the package without re-linking dependencies,

−

ERROR: risking various problems. </nowiki>

+

ERROR: risking various problems.}}

−

==Using pkgsrc to build==

+

== Using pkgsrc to build == <!--T:8-->

+

+

<!--T:9-->

Much like using the FreeBSD ports system, building with the NetBSD pkgsrc system is a rather simple matter of going to the location of the application within the pkgsrc tree, and then using bmake, for example:

Much like using the FreeBSD ports system, building with the NetBSD pkgsrc system is a rather simple matter of going to the location of the application within the pkgsrc tree, and then using bmake, for example:

−

:<nowiki>%</nowiki>su -m

+

<!--T:10-->

−

:<nowiki>#</nowiki> unsetenv PKG_PATH

+

: {{percent}} su -m

−

:<nowiki>#</nowiki> cd /usr/pkgsrc/www/firefox/

+

: {{pound}} unsetenv PKG_PATH

−

:<nowiki>#</nowiki> bmake install clean

+

: {{pound}} cd /usr/pkgsrc/www/firefox/

+

: {{pound}} bmake install clean

+

+

<!--T:11-->

+

However, if there may be options that would modify what is built, how it is installed, or the features enabled. The additional steps for options adjustment is done prior to invoking ''bmake install clean.'' Discover whether there are options:

+

+

<!--T:12-->

+

{{cli|xterm=

+

{{pound}} bmake show-options<br/>

+

+

<!--T:13-->

+

Any of the following general options may be selected:<br/>

+

: official-mozilla-branding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Use official Mozilla reg. trademarks and logos.

+

+

<!--T:14-->

+

These options are enabled by default:

+

+

<!--T:15-->

+

These options are currently enabled:

+

+

<!--T:16-->

+

You can select which build options to use by setting PKG_DEFAULT_OPTIONS

+

or PKG_OPTIONS.firefox.

+

}}

−

==Adding a NetBSD pkg==

+

== Adding a NetBSD pkg == <!--T:17-->

−

:<nowiki>%</nowiki>su -m

+

: {{percent}} su -m

−

:<nowiki>#</nowiki> bpkg_add firefox

+

: {{pound}} bpkg_add firefox

−

The above probably should simply work, or the NetBSD documentation would not mention renaming the FreeBSD pkg tools. However, for the moment, testing throws the following type of error:

+

<!--T:18-->

+

The above probably should simply work, or the NetBSD documentation would not mention renaming the FreeBSD pkg tools. However, for the moment, testing this throws the following type of error:

−

<nowiki>

+

<!--T:19-->

−

pkg_add: Warning: package `firefox-3.6.16' was built for a platform:

+

{{cli|xterm=

−

pkg_add: NetBSD/x86_64 5.1 (pkg) vs. FreeBSD/x86_64 9.0 (this host)

+

pkg_add: Warning: package `firefox-3.6.16' was built for a platform:<br/>

Latest revision as of 16:14, 25 March 2014

Contents

Available to PC-BSD® is its own PBI collection, FreeBSD ports, and FreeBSD packages. However, it is also possible to use the NetBSD pkgsrc system to build software. This is not (yet) a pre-configured feature, which means there are some special instructions to follow for this functionality to be enabled. This is not an official feature. This section will describe how to configure and use NetBSD pkgsrc from PC-BSD®.

Although these instructions seem complete and look polished, there may still be ommissions or inaccuracies, so be wary.

This was originally written/explored in Dec 2011, and should be updated/re-tested.

The vulnerabilities of some ports (ie Firefox) may prevent them from being built. An example mk.conf file will be placed in /etc/mk.conf.example file when you use the bootstrap script. Adjust /usr/pkg/etc/mk.conf to allow vulnerable programs to be built by adding the following line:

The process for using tar files is very much the same as when obtaining them originally, except that the old tree must be erased first

# rm -rf /usr/pkgsrc/

# ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz

# tar -xzf pkgsrc.tar.gz -C /usr

Next bootstrap pkgsrc again

# cd /usr/pkgsrc/bootstrap/

# ./bootstrap --pkgdbdir /var/db/pkgsrc

Update the bootstrap-mk-files

# cd /usr/pkgsrc/pkgtools/bootstrap-mk-files/

# /usr/pkgsrc/bootstrap/work/bin/bmake update

And if that does not work (such as on a standard NetBSD install) try:

# /usr/pkgsrc/bootstrap/work/bin/bmake replace

# /usr/pkgsrc/bootstrap/work/bin/bmake update

===> Installing for bootstrap-mk-files-20111205

ERROR: bootstrap-mk-files-20111106 is already installed - perhaps an older version?
ERROR: If so, you may use either of:
ERROR: - "pkg_delete bootstrap-mk-files-20111106" and "/usr/pkgsrc/bootstrap/work/bin/bmake reinstall" to upgrade properly
ERROR:
ERROR: - "/usr/pkgsrc/bootstrap/work/bin/bmake update" to rebuild the package and all of its dependencies
ERROR:
ERROR: - "/usr/pkgsrc/bootstrap/work/bin/bmake replace" to replace only the package without re-linking dependencies,

Much like using the FreeBSD ports system, building with the NetBSD pkgsrc system is a rather simple matter of going to the location of the application within the pkgsrc tree, and then using bmake, for example:

% su -m

# unsetenv PKG_PATH

# cd /usr/pkgsrc/www/firefox/

# bmake install clean

However, if there may be options that would modify what is built, how it is installed, or the features enabled. The additional steps for options adjustment is done prior to invoking bmake install clean. Discover whether there are options:

Xterm

# bmake show-options

Any of the following general options may be selected:

official-mozilla-branding Use official Mozilla reg. trademarks and logos.

These options are enabled by default:

These options are currently enabled:

You can select which build options to use by setting PKG_DEFAULT_OPTIONS
or PKG_OPTIONS.firefox.