View | Details | Raw Unified | Return to bug 61683
Collapse All | Expand All

(-)Mk/bsd.port.mk (-28 / +66 lines)
Lines 70-76 Link Here
70
# PKGNAMESUFFIX	- Suffix to specify compilation options.  Optional.
70
# PKGNAMESUFFIX	- Suffix to specify compilation options.  Optional.
71
#				  Do not define this in your Makefile.
71
#				  Do not define this in your Makefile.
72
# UNIQUENAME	- A name for your port that is globally unique.  By default,
72
# UNIQUENAME	- A name for your port that is globally unique.  By default,
73
# 				  this is set to ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
73
# 				  this is set to ${LATEST_LINK} when set, ${PKGNAMEPREFIX}${PORTNAME} else
74
# DISTNAME		- Name of port or distribution used in generating
74
# DISTNAME		- Name of port or distribution used in generating
75
#				  WRKSRC and DISTFILES below (default:
75
#				  WRKSRC and DISTFILES below (default:
76
#				  ${PORTNAME}-${PORTVERSION}).
76
#				  ${PORTNAME}-${PORTVERSION}).
Lines 1019-1031 Link Here
1019
# where 'make config' records user configuration options
1019
# where 'make config' records user configuration options
1020
PORT_DBDIR?=	/var/db/ports
1020
PORT_DBDIR?=	/var/db/ports
1021
1021
1022
UNIQUENAME?=${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
1022
.if defined(LATEST_LINK)
1023
OPTIONSFILE?=${PORT_DBDIR}/${UNIQUENAME}/options
1023
UNIQUENAME?=	${LATEST_LINK}
1024
.if exists(${OPTIONSFILE})
1024
.else
1025
.include "${OPTIONSFILE}"
1025
UNIQUENAME?=	${PKGNAMEPREFIX}${PORTNAME}
1026
.endif
1027
OPTIONSFILE?=	${PORT_DBDIR}/${UNIQUENAME}/options
1028
_OPTIONSFILE!=	${ECHO_CMD} "${OPTIONSFILE}"
1029
.if defined(OPTIONS)
1030
.if exists(${_OPTIONSFILE}) && !make(rmconfig)
1031
.include "${_OPTIONSFILE}"
1032
.endif
1033
.if exists(${_OPTIONSFILE}.local)
1034
.include "${_OPTIONSFILE}.local"
1026
.endif
1035
.endif
1027
.if exists(${OPTIONSFILE}.local)
1028
.include "${OPTIONSFILE}.local"
1029
.endif
1036
.endif
1030
1037
1031
# check for old, crufty, makefile types, part 1:
1038
# check for old, crufty, makefile types, part 1:
Lines 2888-2894 Link Here
2888
################################################################
2895
################################################################
2889
.if (!defined(OPTIONS) || defined(CONFIG_DONE) || \
2896
.if (!defined(OPTIONS) || defined(CONFIG_DONE) || \
2890
	defined(PACKAGE_BUILDING) || defined(BATCH) || \
2897
	defined(PACKAGE_BUILDING) || defined(BATCH) || \
2891
	exists(${OPTIONSFILE}) || exists(${OPTIONSFILE}.local))
2898
	exists(${_OPTIONSFILE}) || exists(${_OPTIONSFILE}.local))
2892
_OPTIONS_OK=yes
2899
_OPTIONS_OK=yes
2893
.endif
2900
.endif
2894
2901
Lines 2965-2970 Link Here
2965
.else
2972
.else
2966
	@${DO_NADA}
2973
	@${DO_NADA}
2967
.endif
2974
.endif
2975
.if defined(_OPTIONS_READ)
2976
	@${ECHO_MSG} "===>  Found saved configuration for ${_OPTIONS_READ}"
2977
.if ${OPTIONSFILE} != ${_OPTIONSFILE}
2978
	@${ECHO_MSG} "===>  *** CAUTION *** Using wrong configuration file ${_OPTIONSFILE}"
2979
.endif
2980
.endif
2981
2968
2982
2969
# Warn user about deprecated packages.  Advisory only.
2983
# Warn user about deprecated packages.  Advisory only.
2970
2984
Lines 4903-4912 Link Here
4903
.if !defined(OPTIONS)
4917
.if !defined(OPTIONS)
4904
	@${ECHO_MSG} "===> No options to configure"
4918
	@${ECHO_MSG} "===> No options to configure"
4905
.else
4919
.else
4906
	@(${MKDIR} ${PORT_DBDIR}/${UNIQUENAME} 2> /dev/null) || \
4920
.if ${OPTIONSFILE} != ${_OPTIONSFILE}
4907
		(${ECHO_MSG} "===> Cannot create ${PORT_DBDIR}/${UNIQUENAME}, check permissions"; exit 1)
4921
	@${ECHO_MSG} "===> Using wrong configuration file ${_OPTIONSFILE}"
4908
	-@if [ -e ${OPTIONSFILE} ]; then \
4922
	@exit 1
4909
		. ${OPTIONSFILE}; \
4923
.endif
4924
	@(${MKDIR} `dirname ${_OPTIONSFILE}` 2> /dev/null) || \
4925
		(${ECHO_MSG} "===> Cannot create `dirname ${_OPTIONSFILE}`, check permissions"; exit 1)
4926
	-@if [ -e ${_OPTIONSFILE} ]; then \
4927
		. ${_OPTIONSFILE}; \
4910
	fi; \
4928
	fi; \
4911
	set ${OPTIONS} XXX; \
4929
	set ${OPTIONS} XXX; \
4912
	while [ $$# -gt 3 ]; do \
4930
	while [ $$# -gt 3 ]; do \
Lines 4916-4922 Link Here
4916
		withoutvar=WITHOUT_$$1; \
4934
		withoutvar=WITHOUT_$$1; \
4917
		withval=$$(eval ${ECHO_CMD} $$\{$${withvar}\}); \
4935
		withval=$$(eval ${ECHO_CMD} $$\{$${withvar}\}); \
4918
		withoutval=$$(eval ${ECHO_CMD} $$\{$${withoutvar}\}); \
4936
		withoutval=$$(eval ${ECHO_CMD} $$\{$${withoutvar}\}); \
4919
		${ECHO_CMD} $${withval}; \
4920
		if [ ! -z "$${withval}" ]; then \
4937
		if [ ! -z "$${withval}" ]; then \
4921
			val=on; \
4938
			val=on; \
4922
		elif [ ! -z "$${withoutval}" ]; then \
4939
		elif [ ! -z "$${withoutval}" ]; then \
Lines 4926-4935 Link Here
4926
		fi; \
4943
		fi; \
4927
		DEFOPTIONS="$${DEFOPTIONS} $$1 \"$$2\" $${val}"; \
4944
		DEFOPTIONS="$${DEFOPTIONS} $$1 \"$$2\" $${val}"; \
4928
		shift 3; \
4945
		shift 3; \
4929
	done > /dev/null; \
4946
	done; \
4930
	TMPOPTIONSFILE=$$(mktemp -t portoptions); \
4947
	TMPOPTIONSFILE=$$(mktemp -t portoptions); \
4931
	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
4948
	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
4932
	${SH} -c "${DIALOG} --checklist \"Options for ${PORTNAME} ${PORTVERSION}\" 21 70 15 $${DEFOPTIONS} 2> $${TMPOPTIONSFILE}"; \
4949
	${SH} -c "${DIALOG} --checklist \"Options for ${PKGNAME:C/-([^-]+)$/ \1/}\" 21 70 15 $${DEFOPTIONS} 2> $${TMPOPTIONSFILE}"; \
4933
	status=$$?; \
4950
	status=$$?; \
4934
	if [ $${status} -ne 0 ] ; then \
4951
	if [ $${status} -ne 0 ] ; then \
4935
		${RM} -f $${TMPOPTIONSFILE}; \
4952
		${RM} -f $${TMPOPTIONSFILE}; \
Lines 4937-4955 Link Here
4937
		exit 0; \
4954
		exit 0; \
4938
	fi; \
4955
	fi; \
4939
	if [ ! -e ${TMPOPTIONSFILE} ]; then \
4956
	if [ ! -e ${TMPOPTIONSFILE} ]; then \
4940
		${ECHO_MSG} "===> No user-specified options to save for ${PORTNAME}"; \
4957
		${ECHO_MSG} "===> No user-specified options to save for ${PKGNAME}"; \
4941
		exit 0; \
4958
		exit 0; \
4942
	fi; \
4959
	fi; \
4943
	SELOPTIONS=$$(${CAT} $${TMPOPTIONSFILE}); \
4960
	SELOPTIONS=$$(${CAT} $${TMPOPTIONSFILE}); \
4944
	${RM} -f $${TMPOPTIONSFILE}; \
4961
	${RM} -f $${TMPOPTIONSFILE}; \
4945
	${ECHO_MSG} "# This file is auto-generated by 'make config'.  No user-servicable parts" > ${OPTIONSFILE}; \
4962
	${ECHO_CMD} "# This file is auto-generated by 'make config'." > ${_OPTIONSFILE}; \
4946
	${ECHO_MSG} "# inside!" >> ${OPTIONSFILE}; \
4963
	${ECHO_CMD} "# No user-servicable parts inside!" >> ${_OPTIONSFILE}; \
4964
	${ECHO_CMD} "# Options for ${PKGNAME}" >> ${_OPTIONSFILE}; \
4965
	${ECHO_CMD} "_OPTIONS_READ=${PKGNAME}" >> ${_OPTIONSFILE}; \
4947
	for i in $${OPTIONSLIST}; do \
4966
	for i in $${OPTIONSLIST}; do \
4948
		${ECHO_CMD} $${SELOPTIONS} | ${GREP} -qw $${i}; \
4967
		${ECHO_CMD} $${SELOPTIONS} | ${GREP} -qw $${i}; \
4949
		if [ $$? -eq 0 ]; then \
4968
		if [ $$? -eq 0 ]; then \
4950
			${ECHO_CMD} WITH_$${i}=true >> ${OPTIONSFILE}; \
4969
			${ECHO_CMD} WITH_$${i}=true >> ${_OPTIONSFILE}; \
4951
		else \
4970
		else \
4952
			${ECHO_CMD} WITHOUT_$${i}=true >> ${OPTIONSFILE}; \
4971
			${ECHO_CMD} WITHOUT_$${i}=true >> ${_OPTIONSFILE}; \
4953
		fi; \
4972
		fi; \
4954
	done
4973
	done
4955
.endif
4974
.endif
Lines 4957-4965 Link Here
4957
4976
4958
.if !target(showconfig)
4977
.if !target(showconfig)
4959
showconfig:
4978
showconfig:
4960
.if exists(${OPTIONSFILE})
4979
.if defined(OPTIONS) && exists(${_OPTIONSFILE})
4961
	@${ECHO_MSG} "===> The following configuration options are set for ${PORTNAME}"; \
4980
	@${ECHO_MSG} "===> The following configuration options are set for ${PKGNAME}:"
4962
	${GREP} -v ^# ${OPTIONSFILE}
4981
	-@if [ -e ${_OPTIONSFILE} ]; then \
4982
		. ${_OPTIONSFILE}; \
4983
	fi; \
4984
	set ${OPTIONS} XXX; \
4985
	while [ $$# -gt 3 ]; do \
4986
		defaultval=$$3; \
4987
		withvar=WITH_$$1; \
4988
		withoutvar=WITHOUT_$$1; \
4989
		withval=$$(eval ${ECHO_CMD} $$\{$${withvar}\}); \
4990
		withoutval=$$(eval ${ECHO_CMD} $$\{$${withoutvar}\}); \
4991
		if [ ! -z "$${withval}" ]; then \
4992
			val=on; \
4993
		elif [ ! -z "$${withoutval}" ]; then \
4994
			val=off; \
4995
		else \
4996
			val="$$3 (default)"; \
4997
		fi; \
4998
		${ECHO_MSG} "     $$1=$${val} \"$$2\""; \
4999
		shift 3; \
5000
	done
4963
.else
5001
.else
4964
	@${ECHO_MSG} "===> No configuration options are set for this port"
5002
	@${ECHO_MSG} "===> No configuration options are set for this port"
4965
.if defined(OPTIONS)
5003
.if defined(OPTIONS)
Lines 4970-4981 Link Here
4970
5008
4971
.if !target(rmconfig)
5009
.if !target(rmconfig)
4972
rmconfig:
5010
rmconfig:
4973
.if exists(${OPTIONSFILE})
5011
.if defined(OPTIONS) && exists(${_OPTIONSFILE})
4974
	-@${ECHO_MSG} "===> Removing user-configured options for ${PORTNAME}"; \
5012
	-@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \
4975
	${RM} -f ${OPTIONSFILE}; \
5013
	${RM} -f ${_OPTIONSFILE}; \
4976
	${RMDIR} ${PORT_DBDIR}/${UNIQUENAME}
5014
	${RMDIR} `dirname ${_OPTIONSFILE}`
4977
.else
5015
.else
4978
	@${ECHO_MSG} "===> No user-specified options configured for ${PORTNAME}"
5016
	@${ECHO_MSG} "===> No user-specified options configured for ${PKGNAME}"
4979
.endif
5017
.endif
4980
.endif
5018
.endif

Return to bug 61683