When I install software from ports on a FreeBSD system, sometimes rather outdated versions of Apache/MySQL/Perl/etc are installed as dependencies. Is there any way to set the versions of these ports beforehand so that if they're ever required, the ports system would choose an appropriate version?
3 Answers
You can look in /usr/ports/Mk/bsd.*.mk
for corresponding variables and set them in /etc/make.conf
. But it's safer to just install needed versions of such software and then continue with everything else.
Set for example:
DEFAULT_VERSIONS= perl5=5.18 ruby=2.0
in your /etc/make.conf
This information is taken from /usr/ports/Mk/bsd.default-versions.mk
# $FreeBSD: head/Mk/bsd.default-versions.mk 345909 2014-02-25 00:32:09Z gerald $
#
# MAINTAINER: [email protected]
#
# Provide default versions for ports with multiple versions selectable
# by the user.
#
# Users who want to override these defaults can easily do so by defining
# DEFAULT_VERSIONS in their make.conf as follows:
#
# DEFAULT_VERSIONS= perl5=5.18 ruby=2.0
.if !defined(_INCLUDE_BSD_DEFAULT_VERSIONS_MK)
_INCLUDE_BSD_DEFAULT_VERSIONS_MK= yes
.for lang in ${DEFAULT_VERSIONS}
_l= ${lang:C/=.*//g}
${_l:U}_DEFAULT= ${lang:C/.*=//g}
.endfor
APACHE_DEFAULT?= 2.2
FPC_DEFAULT?= 2.6.2
GCC_DEFAULT?= 4.6
LUA_DEFAULT?= 5.2
MYSQL_DEFAULT?= 5.5
PERL5_DEFAULT?= 5.16
PGSQL_DEFAULT?= 9.0
PHP_DEFAULT?= 5.4
PYTHON_DEFAULT?= 2.7
PYTHON2_DEFAULT?= 2.7
PYTHON3_DEFAULT?= 3.3
RUBY_DEFAULT?= 1.9
TCLTK_DEFAULT?= 8.6
.endif
The version of the port is the version that the port maintainer has built and tested (and that gets routinely build-tested by the ports tinderbox) -- I don't know of any ports that have a version knob, though you can find multiple versions of some ports in the tree (for example, PostgreSQL has versions from 7.3 through 9.0).
You can install the newer versions of these ports manually and (if they're suitable) they will be found as dependencies and used by other ports.
The general answer for port upgrades is that if you want a newer version of a port than what's in the tree you can create and submit a patch that updates the port (A cursory read through The FreeBSD Porter's Handbook may be a good idea to get familiar with how things work in the ports tree).
If your newer version introduces incompatible changes you should probably create a new port for it (you can use the older version as a skeleton).
-
mysql has a version knob:
grep ^DEFAULT_MYSQL_VER /usr/ports/Mk/bsd.database.mk
Apr 1, 2011 at 16:35 -
@eugene y Hmm, I forgot about those .mk files -- looking around there appears to be one for
DEFAULT_PGSQL_VER
as well & a few others . You can definitely set these in/etc/make.conf
or on the command line. I don't know if there are knobs for everything you need to touch, but it may be a good start & an automated script can handle the rest...– voretaq7Apr 1, 2011 at 16:48