Index: Mk/Uses/pgsql.mk =================================================================== --- Mk/Uses/pgsql.mk +++ Mk/Uses/pgsql.mk @@ -60,12 +60,6 @@ IGNORE= will not allow setting both DEFAULT_PGSQL_VER and WITH_PGSQL_VER. Use DEFAULT_VERSIONS=pgsql=9.6 instead . endif -# Setting/finding PostgreSQL version we want. -PG_CONFIG?= ${LOCALBASE}/bin/pg_config -. if exists(${PG_CONFIG}) -_PGSQL_VER!= ${PG_CONFIG} --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9]\.*[0-9]\).*/\1/p' -. endif - # Handle the + and - version stuff . if !empty(pgsql_ARGS) . if ${pgsql_ARGS:M*+} @@ -93,20 +87,20 @@ . endif PGSQL_VER?= ${version} . endfor -. if defined(_PGSQL_VER) -. for v in ${_PGSQL_VER} -. if ${_WANT_PGSQL_VER:M$v} == ${_PGSQL_VER} -PGSQL_VER= ${_PGSQL_VER} +. if defined(PGSQL_DEFAULT) +. for v in ${PGSQL_DEFAULT} +. if ${_WANT_PGSQL_VER:M$v} == ${PGSQL_DEFAULT} +PGSQL_VER= ${PGSQL_DEFAULT} . endif . endfor . endif -. if defined(_PGSQL_VER) && ${_PGSQL_VER} != ${PGSQL_VER} -IGNORE?= cannot install: the port wants postgresql-client version ${_WANT_PGSQL_VER} and you have version ${_PGSQL_VER} installed +. if defined(PGSQL_DEFAULT) && ${PGSQL_DEFAULT} != ${PGSQL_VER} +IGNORE?= cannot install: the port wants postgresql-client one of versions ${_WANT_PGSQL_VER:S/$/,/} but ${PGSQL_DEFAULT} is the default, or installed. To change the default version, add DEFAULT_VERSIONS+=pgsql=${PGSQL_VER} to your make.conf . endif . endif # OK, so the port is ambivalent, we'll just take what's on the system. -PGSQL_VER?= ${_PGSQL_VER} +PGSQL_VER?= ${PGSQL_DEFAULT} # After all that, we still have found nothing! . if empty(PGSQL_VER) Index: Mk/bsd.default-versions.mk =================================================================== --- Mk/bsd.default-versions.mk +++ Mk/bsd.default-versions.mk @@ -72,7 +72,17 @@ PERL5_DEFAULT:= ${_PERL5_FROM_BIN:R} .endif # Possible values: 9.2, 9.3, 9.4, 9.5, 9.6 +_PG_CONFIG= ${LOCALBASE}/bin/pg_config +.if !exists(${_PG_CONFIG}) || (!defined(_PORTS_ENV_CHECK) && \ + defined(PACKAGE_BUILDING)) PGSQL_DEFAULT?= 9.5 +.elif !defined(PGSQL_DEFAULT) +.if !defined(_PGSQL_FROM_CONFIG) +_PGSQL_FROM_CONFIG!= ${_PG_CONFIG} --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9]\.*[0-9]\).*/\1/p' +.endif +_EXPORTED_VARS+= _PGSQL_FROM_CONFIG +PGSQL_DEFAULT:= ${_PGSQL_FROM_CONFIG} +.endif # Possible values: 5.6, 7.0, 7.1 PHP_DEFAULT?= 5.6 # Possible values: 2.7, 3.3, 3.4, 3.5, 3.6