Difference between revisions of "Pkgsrc in PC-BSD®"

From PC-BSD Wiki
Jump to: navigation, search
(13 intermediate revisions by one user not shown)
Line 4: Line 4:
  
 
<!--T:2-->
 
<!--T:2-->
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®.{{note|icon64=Although these instructions seem complete and look polished, there may still be ommissions or inaccuracies, so be wary.}}
+
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=This was originally written/explored in Dec 2011, and should be updated/re-tested.}}
  
 
== Setting things up == <!--T:3-->
 
== Setting things up == <!--T:3-->
  
 
<!--T:4-->
 
<!--T:4-->
# Obtain the NetBSD pkgsrc tree by the following commands:{{txtbox|tbstyle=margin-left=10px;|box={{pound}} ftp {{ftp}}ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
+
# Obtain the NetBSD pkgsrc tree by the following commands:<br/>
{{pound}} tar -xzf pkgsrc.tar.gz -C /usr}}
+
#: {{pound}} ftp {{ftp}}ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz<br/>
# Bootstrap pkgsrc. FreeBSD stores its ports pkg database in /var/db/pkg/. It is therefore recommended to use /var/db/pkgsrc/ with the --pkgdbdir flag as below:<br>
+
#: {{pound}} tar -xzf pkgsrc.tar.gz -C /usr<br/>
#: {{pound}} cd /usr/pkgsrc/bootstrap/<br>{{pound}} ./bootstrap --pkgdbdir /var/db/pkgsrc<br>
+
# Bootstrap pkgsrc. FreeBSD stores its ports pkg database in /var/db/pkg/. It is therefore recommended to use /var/db/pkgsrc/ with the --pkgdbdir flag as below:<br/>
 +
#: {{pound}} cd /usr/pkgsrc/bootstrap/<br/>{{pound}} ./bootstrap --pkgdbdir /var/db/pkgsrc<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:
 
# 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:
#: {{pound}} cd /usr/pkg/sbin/<br>{{pound}} mv pkg_add bpkg_add<br>{{pound}} mv pkg_create bpkg_create
+
#: {{pound}} cd /usr/pkg/sbin/<br/>{{pound}} mv pkg_add bpkg_add<br/>{{pound}} mv pkg_create bpkg_create
#: {{pound}} mv pkg_delete bpkg_delete<br>{{pound}} mv pkg_info bpkg_info
+
#: {{pound}} mv pkg_delete bpkg_delete<br/>{{pound}} mv pkg_info bpkg_info
 
# If the FreeBSD ports tools will not be used, they can be moved out of the way entirely, as follows:
 
# If the FreeBSD ports tools will not be used, they can be moved out of the way entirely, as follows:
#: {{pound}} cd /usr/sbin/<br>{{pound}} mv pkg_add pkg_add.orig<br>
+
#: {{pound}} cd /usr/sbin/<br/>{{pound}} mv pkg_add pkg_add.orig<br/>
#: {{pound}} mv pkg_create pkg_create.orig<br>{{pound}} mv pkg_delete pkg_delete.orig<br>{{pound}} mv pkg_info pkg_info.orig<br>
+
#: {{pound}} mv pkg_create pkg_create.orig<br/>{{pound}} mv pkg_delete pkg_delete.orig<br/>{{pound}} mv pkg_info pkg_info.orig<br/>
 
# Add the location of bmake (/usr/pkg/bin) and NetBSD pkg tools (/usr/pkg/sbin) to the user's search path variable. Edit the file .cshrc in the user's home directory to modify the following line:
 
# Add the location of bmake (/usr/pkg/bin) and NetBSD pkg tools (/usr/pkg/sbin) to the user's search path variable. Edit the file .cshrc in the user's home directory to modify the following line:
#: set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin '''/usr/pkg/sbin /usr/pkg/bin''' $HOME/bin)<br>
+
#: set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin '''/usr/pkg/sbin /usr/pkg/bin''' $HOME/bin)<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:
 
# 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:
#: setenv PKG_PATH {{ftp}}ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1_2011Q4/All/<br>
+
#: setenv PKG_PATH {{ftp}}ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1_2011Q4/All/<br/>
# Obtain the vulnerabilities file:<br>
+
# Obtain the vulnerabilities file:<br/>
#: {{pound}} /usr/pkg/sbin/pkg_admin -K fetch-pkg-vulnerabilities<br>
+
#: {{pound}} /usr/pkg/sbin/pkg_admin -K fetch-pkg-vulnerabilities<br/>
#: This prevents the non-fatal error below:<br>
+
#: This prevents the non-fatal error below:<br/>
#:: WARNING: No /var/db/pkg/pkg-vulnerabilities file found.<br>
+
#:: WARNING: No /var/db/pkg/pkg-vulnerabilities file found.<br/>
#:: WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.<br>
+
#:: WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.<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:
 
# 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
 
#: ALLOW_VULNERABLE_PACKAGES=TRUE
Line 34: Line 35:
  
 
<!--T:6-->
 
<!--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>
+
# 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/>
#: {{pound}} rm -rf /usr/pkgsrc/<br>
+
#: {{pound}} rm -rf /usr/pkgsrc/<br/>
#: {{pound}} ftp {{ftp}}ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz<br>
+
#: {{pound}} ftp {{ftp}}ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz<br/>
#: {{pound}} tar -xzf pkgsrc.tar.gz -C /usr<br>
+
#: {{pound}} tar -xzf pkgsrc.tar.gz -C /usr<br/>
# Next bootstrap pkgsrc again<br>
+
# Next bootstrap pkgsrc again<br/>
#: {{pound}} cd /usr/pkgsrc/bootstrap/<br>
+
#: {{pound}} cd /usr/pkgsrc/bootstrap/<br/>
#: {{pound}} ./bootstrap --pkgdbdir /var/db/pkgsrc<br>
+
#: {{pound}} ./bootstrap --pkgdbdir /var/db/pkgsrc<br/>
# Update the bootstrap-mk-files<br>
+
# Update the bootstrap-mk-files<br/>
 
#: {{pound}} cd /usr/pkgsrc/pkgtools/bootstrap-mk-files/
 
#: {{pound}} cd /usr/pkgsrc/pkgtools/bootstrap-mk-files/
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake update<br>
+
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake update<br/>
# And if that does not work (such as on a standard NetBSD install) try:<br>
+
# And if that does not work (such as on a standard NetBSD install) try:<br/>
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake replace<br>
+
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake replace<br/>
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake update<br>
+
#: {{pound}} /usr/pkgsrc/bootstrap/work/bin/bmake update<br/>
  
 
  <!--T:7-->
 
  <!--T:7-->
<nowiki>
+
{{txtbox|box====> Installing for bootstrap-mk-files-20111205
===> Installing for bootstrap-mk-files-20111205
+
 
ERROR: bootstrap-mk-files-20111106 is already installed - perhaps an older version?
 
ERROR: bootstrap-mk-files-20111106 is already installed - perhaps an older version?
 
ERROR: If so, you may use either of:
 
ERROR: If so, you may use either of:
Line 58: Line 58:
 
ERROR:       
 
ERROR:       
 
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.
+
ERROR:      risking various problems.}}
</nowiki>
+
  
 
== Using pkgsrc to build == <!--T:8-->
 
== Using pkgsrc to build == <!--T:8-->
Line 77: Line 76:
 
<!--T:12-->
 
<!--T:12-->
 
{{cli|xterm=
 
{{cli|xterm=
{{pound}} bmake show-options<br>
+
{{pound}} bmake show-options<br/>
  
 
<!--T:13-->
 
<!--T:13-->
Any of the following general options may be selected:<br>
+
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.
+
:       official-mozilla-branding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   Use official Mozilla reg. trademarks and logos.
  
 
<!--T:14-->
 
<!--T:14-->
Line 103: Line 102:
 
<!--T:19-->
 
<!--T:19-->
 
{{cli|xterm=
 
{{cli|xterm=
pkg_add: Warning: package `firefox-3.6.16' was built for a platform:<br>
+
pkg_add: Warning: package `firefox-3.6.16' was built for a platform:<br/>
pkg_add: NetBSD/x86_64 5.1 (pkg) vs. FreeBSD/x86_64 9.0 (this host)<br>
+
pkg_add: NetBSD/x86_64 5.1 (pkg) vs. FreeBSD/x86_64 9.0 (this host)<br/>
pkg_add: 1 package addition failed<br>
+
pkg_add: 1 package addition failed<br/>
 
}}
 
}}
 
</translate>
 
</translate>

Revision as of 19:07, 6 November 2013

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®.

Caveat:
Although these instructions seem complete and look polished, there may still be ommissions or inaccuracies, so be wary.
WARNING This was originally written/explored in Dec 2011, and should be updated/re-tested.

Setting things up

  1. Obtain the NetBSD pkgsrc tree by the following commands:
    # ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
    # tar -xzf pkgsrc.tar.gz -C /usr
  2. Bootstrap pkgsrc. FreeBSD stores its ports pkg database in /var/db/pkg/. It is therefore recommended to use /var/db/pkgsrc/ with the --pkgdbdir flag as below:
    # cd /usr/pkgsrc/bootstrap/
    # ./bootstrap --pkgdbdir /var/db/pkgsrc
  3. 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:
    # cd /usr/pkg/sbin/
    # mv pkg_add bpkg_add
    # mv pkg_create bpkg_create
    # mv pkg_delete bpkg_delete
    # mv pkg_info bpkg_info
  4. If the FreeBSD ports tools will not be used, they can be moved out of the way entirely, as follows:
    # cd /usr/sbin/
    # mv pkg_add pkg_add.orig
    # mv pkg_create pkg_create.orig
    # mv pkg_delete pkg_delete.orig
    # mv pkg_info pkg_info.orig
  5. Add the location of bmake (/usr/pkg/bin) and NetBSD pkg tools (/usr/pkg/sbin) to the user's search path variable. Edit the file .cshrc in the user's home directory to modify the following line:
    set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/pkg/sbin /usr/pkg/bin $HOME/bin)
  6. 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:
    setenv PKG_PATH ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1_2011Q4/All/
  7. Obtain the vulnerabilities file:
    # /usr/pkg/sbin/pkg_admin -K fetch-pkg-vulnerabilities
    This prevents the non-fatal error below:
    WARNING: No /var/db/pkg/pkg-vulnerabilities file found.
    WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.
  8. 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

  1. 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
  2. Next bootstrap pkgsrc again
    # cd /usr/pkgsrc/bootstrap/
    # ./bootstrap --pkgdbdir /var/db/pkgsrc
  3. Update the bootstrap-mk-files
    # cd /usr/pkgsrc/pkgtools/bootstrap-mk-files/
    # /usr/pkgsrc/bootstrap/work/bin/bmake update
  4. 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,

ERROR: risking various problems.

Using pkgsrc to build

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:

Pseudo-xterm-left.png Xterm Pseudo-xterm-right.png

# 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.

Adding a NetBSD pkg

% su -m
# 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 this throws the following type of error:

Pseudo-xterm-left.png Xterm Pseudo-xterm-right.png

pkg_add: Warning: package `firefox-3.6.16' was built for a platform:
pkg_add: NetBSD/x86_64 5.1 (pkg) vs. FreeBSD/x86_64 9.0 (this host)
pkg_add: 1 package addition failed

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox