1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-17 03:25:46 +00:00
freebsd-ports/Mk/bsd.options.mk

530 lines
17 KiB
Makefile
Raw Normal View History

# $FreeBSD$
#
# These variables are used in port makefiles to define the options for a port.
#
2014-06-18 07:13:26 +00:00
# OPTIONS_DEFINE - List of options this ports accept
# OPTIONS_DEFINE_${ARCH} - List of options this ports accept and are
2014-06-18 07:13:26 +00:00
# specific to ${ARCH}
# OPTIONS_DEFAULT - List of options activated by default
# OPTIONS_DEFAULT_${ARCH} - List of options activated by default for a
2014-06-18 07:13:26 +00:00
# given arch
#
2014-06-18 07:13:26 +00:00
# ${OPTION}_DESC - Description of the ${OPTION}
#
2014-06-18 07:13:26 +00:00
# OPTIONS_SINGLE - List of single-choice grouped options: 1 and
# only 1 among N
# OPTIONS_RADIO - List of radio-choice grouped options: 0 or 1
# among N
# OPTIONS_MULTI - List of multiple-choice grouped options: at
# least 1 among N
# OPTIONS_GROUP - List of group-choice grouped options: 0 or
# more among N
#
# OPTIONS_SINGLE_${NAME} - List of OPTIONS grouped as single choice (for
2014-06-18 07:13:26 +00:00
# the single named as ${NAME} as defined in
# OPTIONS_SINGLE)
# OPTIONS_RADIO_${NAME} - List of OPTIONS grouped as radio choice (for
2014-06-18 07:13:26 +00:00
# the radio named as ${NAME} as defined in
# OPTIONS_RADIO)
# OPTIONS_MULTI_${NAME} - List of OPTIONS grouped as multiple-choice
2014-06-18 07:13:26 +00:00
# (for the multi named as ${NAME} as defined in
# OPTIONS_MULTI)
# OPTIONS_GROUP_${NAME} - List of OPTIONS grouped as group-choice (for
2014-06-18 07:13:26 +00:00
# the group named as ${NAME} as defined in
# OPTIONS_GROUP)
#
2014-06-18 07:13:26 +00:00
# OPTIONS_EXCLUDE - List of options unsupported (useful for slave ports)
# OPTIONS_EXCLUDE_${ARCH} - List of options unsupported on a given ${ARCH}
# OPTIONS_EXCLUDE_${OPSYS} - List of options unsupported on a given ${OPSYS}
2014-06-18 07:13:26 +00:00
# OPTIONS_SLAVE - This is designed for slave ports, it removes an
# option from the options list inherited from the
# master port and it always adds it to PORT_OPTIONS
# meaning activated
#
# These variables can be used in make.conf to configure options. They are
# processed in the order listed below, i.e. later variables override the effects
# of previous variables. Options saved using the options dialog are processed
# right before OPTIONS_SET_FORCE. When building a port a dialog to configure
# options will only appear if there are new options, i.e. options which have not
# been configured before either using the option dialog in a previous build or
# using the variables below. You can force the dialog to appear by running
# "make config".
#
2014-06-18 07:13:26 +00:00
# OPTIONS_SET - List of options to enable for all ports.
# OPTIONS_UNSET - List of options to disable for all ports.
# ${OPTIONS_NAME}_SET - List of options to enable for a specific port.
# ${OPTIONS_NAME}_UNSET - List of options to disable for a specific port.
#
2014-06-18 07:13:26 +00:00
# OPTIONS_SET_FORCE - List of options to enable for all ports.
# OPTIONS_UNSET_FORCE - List of options to disable for all ports.
# ${OPTIONS_NAME}_SET_FORCE - List of options to enable for a specific port.
# ${OPTIONS_NAME}_UNSET_FORCE
2014-06-18 07:13:26 +00:00
# - List of options to disable for a specific port.
#
# These variables can be used on the command line. They override the effects of
# the make.conf variables above.
#
2014-06-18 07:13:26 +00:00
# WITH - Set options from the command line
# WITHOUT - Unset options from the command line
#
#
# The following knobs are there to simplify the handling of OPTIONS in simple
# cases :
#
2014-06-18 07:13:26 +00:00
# OPTIONS_SUB When defined it will add to PLIST_SUB:
# Option enabled ${opt}=""
# Option disabled ${opt}="@comment "
#
# ${opt}_CONFIGURE_ON When option is enabled, it will add its content to
2014-06-18 07:13:26 +00:00
# the CONFIGURE_ARGS.
# ${opt}_CONFIGURE_OFF When option is disabled, it will add its content to
2014-06-18 07:13:26 +00:00
# the CONFIGURE_ARGS.
# ${opt}_CONFIGURE_ENABLE Will add to CONFIGURE_ARGS:
2014-06-18 07:13:26 +00:00
# Option enabled --enable-${content}
# Option disabled --disable-${content}
# ${opt}_CONFIGURE_WITH Will add to CONFIGURE_ARGS:
2014-06-18 07:13:26 +00:00
# Option enabled --with-${content}
# Option disabled --without-${content}
#
2014-06-18 07:13:26 +00:00
# ${opt}_CMAKE_ON When option is enabled, it will add its content to
# the CMAKE_ARGS.
# ${opt}_CMAKE_OFF When option is disabled, it will add its content to
# the CMAKE_ARGS.
#
2014-06-18 07:13:26 +00:00
# ${opt}_QMAKE_ON When option is enabled, it will add its content to
# the QMAKE_ARGS.
# ${opt}_QMAKE_OFF When option is disabled, it will add its content to
# the QMAKE_ARGS.
#
# ${opt}_USE= FOO=bar When option is enabled, it will enable
2014-06-18 07:13:26 +00:00
# USE_FOO+= bar
# If you need more than one option, you can do
# FOO=bar,baz and you'll get USE_FOO=bar baz
# ${opt}_USE_OFF= FOO=bar When option is disabled, it will enable
# USE_FOO+= bar
#
# For each of:
Support LIBS like LDFLAGS. - Add LIBS="${LIBS}" to MAKE_ENV and CONFIGURE_ENV. - Add an option helper for LIBS. - Adjust all ports that already use LIBS. Also remove references to PTHREAD_CFLAGS and PTHREAD_LIBS while here. - Some ports did not support having a LIBS environment variable and required additional patches. Somewhat simplified a linker command line looks like: ${CC} ${src_LDFLAGS} ${LDFLAGS} ${src_LIBS} ${LIBS} where src_LDFLAGS and src_LIBS are controlled by upstream and LDFLAGS and LIBS can be controlled by us. If possible -L and -l flags need to be added to LIBS to make sure they appear after any -L and -l flags set by upstream. Many ports currently add -L${LOCALBASE}/lib to LDFLAGS but this may appear too early on the command line causing installed libraries to be linked in instead of freshly built ones. Additional changes: benchmarks/netio: Replace WITH_IPV6 with an IPV6 option. comms/gnokii: Replace some patches with USES=pathfix. Also remove -fPIC. graphics/gimageview: USES=libtool and install desktop file in DESKTOPDIR. graphics/visionworkbench: Remove FreeBSD 7 support. multimedia/libmovtar: New LIB_DEPENDS syntax. multimedia/opencinematools: Use standard do-build. net/siproxd: USES=libtool:keepla (port actually needs .la files for plugins) net-mgmt/nagios: Remove -fPIC. net-mgmt/nagios4: Remove -fPIC. print/cups-base: Only add -lssp_nonshared on i386 and OSVERSION < 1000036. security/p11-kit: Replace PTHREAD_LIBS in CONFIGURE_ENV with ac_cv_func_pthread_mutexattr_init=no in CONFIGURE_ARGS. This skips a test in configure that falsely detects pthread_mutexattr_init in our libc. sysutils/dar: Fix iconv detection. x11/rxvt-unicode: Remove -lstdc++ and patch configure to remove a FreeBSD hack and use $CXX as linker as on other platforms. PR: 190592 Exp-run by: antoine Approved by: portmgr (antoine)
2014-06-11 14:49:59 +00:00
# ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
# CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES GH_ACCOUNT
# GH_PROJECT GH_TAGNAME INFO INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV
# PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES PLIST_SUB
# PORTDOCS SUB_FILES SUB_LIST USES,
# defining ${opt}_${variable} will add its content to the actual variable when
# the option is enabled. Defining ${opt}_${variable}_OFF will add its content
# to the actual variable when the option is disabled.
#
# For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
# defining ${opt}_${deptype}_DEPENDS will add its content to the actual
# dependency when the option is enabled. Defining
# ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
2014-09-22 12:09:08 +00:00
# when the option is disabled.
##
# Set all the options available for the ports, beginning with the
# global ones and ending with the ones decided by the maintainer.
.if !defined(OPTIONSMKINCLUDED)
OPTIONSMKINCLUDED= bsd.options.mk
OPTIONS_NAME?= ${PKGORIGIN:S/\//_/}
OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
OPTIONS_FILE?= ${PORT_DBDIR}/${OPTIONS_NAME}/options
_OPTIONS_FLAGS= ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
2014-06-18 07:13:26 +00:00
CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES \
EXTRA_PATCHES GH_ACCOUNT GH_PROJECT GH_TAGNAME INFO \
INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV PATCHFILES \
PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES PLIST_SUB \
PORTDOCS SUB_FILES SUB_LIST USES
_OPTIONS_DEPENDS= PKG FETCH EXTRACT PATCH BUILD LIB RUN
# The format here is target_family:priority:target-type
_OPTIONS_TARGETS= fetch:300:pre fetch:500:do fetch:700:post \
extract:300:pre extract:500:do extract:700:post \
patch:300:pre patch:500:do patch:700:post \
configure:300:pre configure:500:do configure:700:post \
build:300:pre build:500:do build:700:post \
install:300:pre install:500:do install:700:post \
package:300:pre package:500:do package:700:post \
stage:800:post
# Set the default values for the global options, as defined by portmgr
.if !defined(NOPORTDOCS)
PORT_OPTIONS+= DOCS
- Rename check-orphans to check-plist. Keep the old for backwards-compat. - Bug fixes: makeplist/check-plist: - Fix showing directories owned by RUN_DEPENDS/LIB_DEPENDS [1] - Use proper "rmdir PATH" syntax, not "rmdir >/dev/null... PATH" which pkg will not recognize. - Never consider base /etc/mtree/BSD.usr.dist or LOCLABASE Templates/BSD.local.dist as needing @dirrm handling. check-plist: - Fix showing PORTDOCS/PORTEXAMPLES files when the OPTIONS are not set. makeplist will still suggest them. - Fix showing files installed through unselected OPTIONS as orphans, by considering "@comment file" to be ignored. [2] - Fix @sample, @fc, @fcfontsdir, @fontsdir support - Fix return status when orphans are found to be non-zero - Add note when PREFIX=!LOCALBASE - Be more clear when orphans/no orphans are found. - Add a whitelist mechanism for globally approved ignores. - Add *.bak/*.orig to orphan whitelist for now. - Fix false-positive with dirs installed to /, such as with archivers/dpkg creating /var/db/dpkg - Fix false-positive with @dirrm ending in /, such as with ports-mgmt/poudriere with a @dirrmtry share/zsh/ - There are likely still some false-positives. I fixed as many as I could find. Please let me know of others. * One in particular that is not easily fixable is installing a file into a directory owned by another port where that other port is not a run-time dependency. So the leaf port may create all of the parent dirs and never clean them up. Cleaning them up is not proper unless no other package is depending on them. This will be addressed by pkg(8) once pkg_install is EOL, or sooner. - Consider @dirrm of directories owned by run-time dependencies, or /etc/mtree/* or Templates/BSD.local.dist (at LOCALBASE) as fatal errors. These should not be removed in the plist. @comment lines are not considered for this; they will not ignore an error. ===> Checking for directories owned by dependencies or MTREEs Error: Owned by dependency: @dirrmtry share/locale/af/LC_MESSAGES Error: Owned by dependency: @dirrmtry share/locale/af Error: Owned by dependency: @dirrmtry %%PERL5_MAN3%% - Detect files in plist that do not exist in the stagedir. Pkgng already did this, but now we have it unified with this check. @comment lines are not considered for this; they will not ignore an error. ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: foo Error: Missing: @dirrmtry bar - Change orphaned output due to several new errors introduced: ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: foo - Send errors to stderr check_leftovers.sh: - Prefer longer values for PLIST_SUB. bsd.options.mk: - Fix NOPORTDOCS/WITHOUT_NLS/NOPORTEXAMPLES not unsetting their respective OPTIONS. - Mark NOPORTDOCS/NOPORTEXAMPLES deprecated and hook them into the OPTIONS_WARNING to tell users the new format. - check-stagedir.sh refactoring: - Switch to using new PLIST_SUB_SED - Use ! instead of , in sed(1) regex to allow files/dirs with ',' - Rework PORTEXAMPLES/PORTDOCS handling so it acts on PLIST_SUB_SED'd value and not absolutes. Also simplify the regex for these a bit to allow reuse. - No longer need DOCSDIRS/EXAMPLESDIR in env - Wrap long lines - Unset some vars in env when they are done being used to free space for larger sed vars - Cleanup redundant sed regexes - Add a Scripts/plist_sub_sed_sort.sh to prefer longer values when substituting over shorter values. - To make check-plist ignore a file *as an orphan* do one of the following: 1. Install it 2. post-install: ${RM} ${STAGEDIR}file 3. Put the file behind an OPTION with a PLIST_SUB: %%OPTION%%file 4. Add to plist as a @comment [2]: @comment file @comment @dirrmtry dir Reviewed by: mat (much earlier version) Discussed with: mat, antoine, bapt, swills (various bits) With hat: portmgr PR: ports/185561 [1] Reported By: Alexander Yerenkow <yerenkow@gmail.com> [1] Tested with: pkg and pkg_install Reported by: many (false-positives) [2] This is a partial solution, we may still need a plist.ignore too. It doesn't make much sense to add files in main pkg-plist we don't care about, but maybe it does since you'll see and reconsider them being ignored someday. @comment is used as all the OPTION PLIST_SUB deactivations use @comment instead of something like @ignore.
2014-04-19 06:44:56 +00:00
.else
2014-06-18 07:13:26 +00:00
OPTIONS_WARNINGS+= "NOPORTDOCS"
- Rename check-orphans to check-plist. Keep the old for backwards-compat. - Bug fixes: makeplist/check-plist: - Fix showing directories owned by RUN_DEPENDS/LIB_DEPENDS [1] - Use proper "rmdir PATH" syntax, not "rmdir >/dev/null... PATH" which pkg will not recognize. - Never consider base /etc/mtree/BSD.usr.dist or LOCLABASE Templates/BSD.local.dist as needing @dirrm handling. check-plist: - Fix showing PORTDOCS/PORTEXAMPLES files when the OPTIONS are not set. makeplist will still suggest them. - Fix showing files installed through unselected OPTIONS as orphans, by considering "@comment file" to be ignored. [2] - Fix @sample, @fc, @fcfontsdir, @fontsdir support - Fix return status when orphans are found to be non-zero - Add note when PREFIX=!LOCALBASE - Be more clear when orphans/no orphans are found. - Add a whitelist mechanism for globally approved ignores. - Add *.bak/*.orig to orphan whitelist for now. - Fix false-positive with dirs installed to /, such as with archivers/dpkg creating /var/db/dpkg - Fix false-positive with @dirrm ending in /, such as with ports-mgmt/poudriere with a @dirrmtry share/zsh/ - There are likely still some false-positives. I fixed as many as I could find. Please let me know of others. * One in particular that is not easily fixable is installing a file into a directory owned by another port where that other port is not a run-time dependency. So the leaf port may create all of the parent dirs and never clean them up. Cleaning them up is not proper unless no other package is depending on them. This will be addressed by pkg(8) once pkg_install is EOL, or sooner. - Consider @dirrm of directories owned by run-time dependencies, or /etc/mtree/* or Templates/BSD.local.dist (at LOCALBASE) as fatal errors. These should not be removed in the plist. @comment lines are not considered for this; they will not ignore an error. ===> Checking for directories owned by dependencies or MTREEs Error: Owned by dependency: @dirrmtry share/locale/af/LC_MESSAGES Error: Owned by dependency: @dirrmtry share/locale/af Error: Owned by dependency: @dirrmtry %%PERL5_MAN3%% - Detect files in plist that do not exist in the stagedir. Pkgng already did this, but now we have it unified with this check. @comment lines are not considered for this; they will not ignore an error. ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: foo Error: Missing: @dirrmtry bar - Change orphaned output due to several new errors introduced: ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: foo - Send errors to stderr check_leftovers.sh: - Prefer longer values for PLIST_SUB. bsd.options.mk: - Fix NOPORTDOCS/WITHOUT_NLS/NOPORTEXAMPLES not unsetting their respective OPTIONS. - Mark NOPORTDOCS/NOPORTEXAMPLES deprecated and hook them into the OPTIONS_WARNING to tell users the new format. - check-stagedir.sh refactoring: - Switch to using new PLIST_SUB_SED - Use ! instead of , in sed(1) regex to allow files/dirs with ',' - Rework PORTEXAMPLES/PORTDOCS handling so it acts on PLIST_SUB_SED'd value and not absolutes. Also simplify the regex for these a bit to allow reuse. - No longer need DOCSDIRS/EXAMPLESDIR in env - Wrap long lines - Unset some vars in env when they are done being used to free space for larger sed vars - Cleanup redundant sed regexes - Add a Scripts/plist_sub_sed_sort.sh to prefer longer values when substituting over shorter values. - To make check-plist ignore a file *as an orphan* do one of the following: 1. Install it 2. post-install: ${RM} ${STAGEDIR}file 3. Put the file behind an OPTION with a PLIST_SUB: %%OPTION%%file 4. Add to plist as a @comment [2]: @comment file @comment @dirrmtry dir Reviewed by: mat (much earlier version) Discussed with: mat, antoine, bapt, swills (various bits) With hat: portmgr PR: ports/185561 [1] Reported By: Alexander Yerenkow <yerenkow@gmail.com> [1] Tested with: pkg and pkg_install Reported by: many (false-positives) [2] This is a partial solution, we may still need a plist.ignore too. It doesn't make much sense to add files in main pkg-plist we don't care about, but maybe it does since you'll see and reconsider them being ignored someday. @comment is used as all the OPTION PLIST_SUB deactivations use @comment instead of something like @ignore.
2014-04-19 06:44:56 +00:00
WITHOUT+= DOCS
OPTIONS_WARNINGS_UNSET+= DOCS
.endif
.if !defined(WITHOUT_NLS)
PORT_OPTIONS+= NLS
- Rename check-orphans to check-plist. Keep the old for backwards-compat. - Bug fixes: makeplist/check-plist: - Fix showing directories owned by RUN_DEPENDS/LIB_DEPENDS [1] - Use proper "rmdir PATH" syntax, not "rmdir >/dev/null... PATH" which pkg will not recognize. - Never consider base /etc/mtree/BSD.usr.dist or LOCLABASE Templates/BSD.local.dist as needing @dirrm handling. check-plist: - Fix showing PORTDOCS/PORTEXAMPLES files when the OPTIONS are not set. makeplist will still suggest them. - Fix showing files installed through unselected OPTIONS as orphans, by considering "@comment file" to be ignored. [2] - Fix @sample, @fc, @fcfontsdir, @fontsdir support - Fix return status when orphans are found to be non-zero - Add note when PREFIX=!LOCALBASE - Be more clear when orphans/no orphans are found. - Add a whitelist mechanism for globally approved ignores. - Add *.bak/*.orig to orphan whitelist for now. - Fix false-positive with dirs installed to /, such as with archivers/dpkg creating /var/db/dpkg - Fix false-positive with @dirrm ending in /, such as with ports-mgmt/poudriere with a @dirrmtry share/zsh/ - There are likely still some false-positives. I fixed as many as I could find. Please let me know of others. * One in particular that is not easily fixable is installing a file into a directory owned by another port where that other port is not a run-time dependency. So the leaf port may create all of the parent dirs and never clean them up. Cleaning them up is not proper unless no other package is depending on them. This will be addressed by pkg(8) once pkg_install is EOL, or sooner. - Consider @dirrm of directories owned by run-time dependencies, or /etc/mtree/* or Templates/BSD.local.dist (at LOCALBASE) as fatal errors. These should not be removed in the plist. @comment lines are not considered for this; they will not ignore an error. ===> Checking for directories owned by dependencies or MTREEs Error: Owned by dependency: @dirrmtry share/locale/af/LC_MESSAGES Error: Owned by dependency: @dirrmtry share/locale/af Error: Owned by dependency: @dirrmtry %%PERL5_MAN3%% - Detect files in plist that do not exist in the stagedir. Pkgng already did this, but now we have it unified with this check. @comment lines are not considered for this; they will not ignore an error. ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: foo Error: Missing: @dirrmtry bar - Change orphaned output due to several new errors introduced: ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: foo - Send errors to stderr check_leftovers.sh: - Prefer longer values for PLIST_SUB. bsd.options.mk: - Fix NOPORTDOCS/WITHOUT_NLS/NOPORTEXAMPLES not unsetting their respective OPTIONS. - Mark NOPORTDOCS/NOPORTEXAMPLES deprecated and hook them into the OPTIONS_WARNING to tell users the new format. - check-stagedir.sh refactoring: - Switch to using new PLIST_SUB_SED - Use ! instead of , in sed(1) regex to allow files/dirs with ',' - Rework PORTEXAMPLES/PORTDOCS handling so it acts on PLIST_SUB_SED'd value and not absolutes. Also simplify the regex for these a bit to allow reuse. - No longer need DOCSDIRS/EXAMPLESDIR in env - Wrap long lines - Unset some vars in env when they are done being used to free space for larger sed vars - Cleanup redundant sed regexes - Add a Scripts/plist_sub_sed_sort.sh to prefer longer values when substituting over shorter values. - To make check-plist ignore a file *as an orphan* do one of the following: 1. Install it 2. post-install: ${RM} ${STAGEDIR}file 3. Put the file behind an OPTION with a PLIST_SUB: %%OPTION%%file 4. Add to plist as a @comment [2]: @comment file @comment @dirrmtry dir Reviewed by: mat (much earlier version) Discussed with: mat, antoine, bapt, swills (various bits) With hat: portmgr PR: ports/185561 [1] Reported By: Alexander Yerenkow <yerenkow@gmail.com> [1] Tested with: pkg and pkg_install Reported by: many (false-positives) [2] This is a partial solution, we may still need a plist.ignore too. It doesn't make much sense to add files in main pkg-plist we don't care about, but maybe it does since you'll see and reconsider them being ignored someday. @comment is used as all the OPTION PLIST_SUB deactivations use @comment instead of something like @ignore.
2014-04-19 06:44:56 +00:00
.else
WITHOUT+= NLS
.endif
.if !defined(NOPORTEXAMPLES)
PORT_OPTIONS+= EXAMPLES
- Rename check-orphans to check-plist. Keep the old for backwards-compat. - Bug fixes: makeplist/check-plist: - Fix showing directories owned by RUN_DEPENDS/LIB_DEPENDS [1] - Use proper "rmdir PATH" syntax, not "rmdir >/dev/null... PATH" which pkg will not recognize. - Never consider base /etc/mtree/BSD.usr.dist or LOCLABASE Templates/BSD.local.dist as needing @dirrm handling. check-plist: - Fix showing PORTDOCS/PORTEXAMPLES files when the OPTIONS are not set. makeplist will still suggest them. - Fix showing files installed through unselected OPTIONS as orphans, by considering "@comment file" to be ignored. [2] - Fix @sample, @fc, @fcfontsdir, @fontsdir support - Fix return status when orphans are found to be non-zero - Add note when PREFIX=!LOCALBASE - Be more clear when orphans/no orphans are found. - Add a whitelist mechanism for globally approved ignores. - Add *.bak/*.orig to orphan whitelist for now. - Fix false-positive with dirs installed to /, such as with archivers/dpkg creating /var/db/dpkg - Fix false-positive with @dirrm ending in /, such as with ports-mgmt/poudriere with a @dirrmtry share/zsh/ - There are likely still some false-positives. I fixed as many as I could find. Please let me know of others. * One in particular that is not easily fixable is installing a file into a directory owned by another port where that other port is not a run-time dependency. So the leaf port may create all of the parent dirs and never clean them up. Cleaning them up is not proper unless no other package is depending on them. This will be addressed by pkg(8) once pkg_install is EOL, or sooner. - Consider @dirrm of directories owned by run-time dependencies, or /etc/mtree/* or Templates/BSD.local.dist (at LOCALBASE) as fatal errors. These should not be removed in the plist. @comment lines are not considered for this; they will not ignore an error. ===> Checking for directories owned by dependencies or MTREEs Error: Owned by dependency: @dirrmtry share/locale/af/LC_MESSAGES Error: Owned by dependency: @dirrmtry share/locale/af Error: Owned by dependency: @dirrmtry %%PERL5_MAN3%% - Detect files in plist that do not exist in the stagedir. Pkgng already did this, but now we have it unified with this check. @comment lines are not considered for this; they will not ignore an error. ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: foo Error: Missing: @dirrmtry bar - Change orphaned output due to several new errors introduced: ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: foo - Send errors to stderr check_leftovers.sh: - Prefer longer values for PLIST_SUB. bsd.options.mk: - Fix NOPORTDOCS/WITHOUT_NLS/NOPORTEXAMPLES not unsetting their respective OPTIONS. - Mark NOPORTDOCS/NOPORTEXAMPLES deprecated and hook them into the OPTIONS_WARNING to tell users the new format. - check-stagedir.sh refactoring: - Switch to using new PLIST_SUB_SED - Use ! instead of , in sed(1) regex to allow files/dirs with ',' - Rework PORTEXAMPLES/PORTDOCS handling so it acts on PLIST_SUB_SED'd value and not absolutes. Also simplify the regex for these a bit to allow reuse. - No longer need DOCSDIRS/EXAMPLESDIR in env - Wrap long lines - Unset some vars in env when they are done being used to free space for larger sed vars - Cleanup redundant sed regexes - Add a Scripts/plist_sub_sed_sort.sh to prefer longer values when substituting over shorter values. - To make check-plist ignore a file *as an orphan* do one of the following: 1. Install it 2. post-install: ${RM} ${STAGEDIR}file 3. Put the file behind an OPTION with a PLIST_SUB: %%OPTION%%file 4. Add to plist as a @comment [2]: @comment file @comment @dirrmtry dir Reviewed by: mat (much earlier version) Discussed with: mat, antoine, bapt, swills (various bits) With hat: portmgr PR: ports/185561 [1] Reported By: Alexander Yerenkow <yerenkow@gmail.com> [1] Tested with: pkg and pkg_install Reported by: many (false-positives) [2] This is a partial solution, we may still need a plist.ignore too. It doesn't make much sense to add files in main pkg-plist we don't care about, but maybe it does since you'll see and reconsider them being ignored someday. @comment is used as all the OPTION PLIST_SUB deactivations use @comment instead of something like @ignore.
2014-04-19 06:44:56 +00:00
.else
2014-06-18 07:13:26 +00:00
OPTIONS_WARNINGS+= "NOPORTEXAMPLES"
- Rename check-orphans to check-plist. Keep the old for backwards-compat. - Bug fixes: makeplist/check-plist: - Fix showing directories owned by RUN_DEPENDS/LIB_DEPENDS [1] - Use proper "rmdir PATH" syntax, not "rmdir >/dev/null... PATH" which pkg will not recognize. - Never consider base /etc/mtree/BSD.usr.dist or LOCLABASE Templates/BSD.local.dist as needing @dirrm handling. check-plist: - Fix showing PORTDOCS/PORTEXAMPLES files when the OPTIONS are not set. makeplist will still suggest them. - Fix showing files installed through unselected OPTIONS as orphans, by considering "@comment file" to be ignored. [2] - Fix @sample, @fc, @fcfontsdir, @fontsdir support - Fix return status when orphans are found to be non-zero - Add note when PREFIX=!LOCALBASE - Be more clear when orphans/no orphans are found. - Add a whitelist mechanism for globally approved ignores. - Add *.bak/*.orig to orphan whitelist for now. - Fix false-positive with dirs installed to /, such as with archivers/dpkg creating /var/db/dpkg - Fix false-positive with @dirrm ending in /, such as with ports-mgmt/poudriere with a @dirrmtry share/zsh/ - There are likely still some false-positives. I fixed as many as I could find. Please let me know of others. * One in particular that is not easily fixable is installing a file into a directory owned by another port where that other port is not a run-time dependency. So the leaf port may create all of the parent dirs and never clean them up. Cleaning them up is not proper unless no other package is depending on them. This will be addressed by pkg(8) once pkg_install is EOL, or sooner. - Consider @dirrm of directories owned by run-time dependencies, or /etc/mtree/* or Templates/BSD.local.dist (at LOCALBASE) as fatal errors. These should not be removed in the plist. @comment lines are not considered for this; they will not ignore an error. ===> Checking for directories owned by dependencies or MTREEs Error: Owned by dependency: @dirrmtry share/locale/af/LC_MESSAGES Error: Owned by dependency: @dirrmtry share/locale/af Error: Owned by dependency: @dirrmtry %%PERL5_MAN3%% - Detect files in plist that do not exist in the stagedir. Pkgng already did this, but now we have it unified with this check. @comment lines are not considered for this; they will not ignore an error. ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: foo Error: Missing: @dirrmtry bar - Change orphaned output due to several new errors introduced: ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: foo - Send errors to stderr check_leftovers.sh: - Prefer longer values for PLIST_SUB. bsd.options.mk: - Fix NOPORTDOCS/WITHOUT_NLS/NOPORTEXAMPLES not unsetting their respective OPTIONS. - Mark NOPORTDOCS/NOPORTEXAMPLES deprecated and hook them into the OPTIONS_WARNING to tell users the new format. - check-stagedir.sh refactoring: - Switch to using new PLIST_SUB_SED - Use ! instead of , in sed(1) regex to allow files/dirs with ',' - Rework PORTEXAMPLES/PORTDOCS handling so it acts on PLIST_SUB_SED'd value and not absolutes. Also simplify the regex for these a bit to allow reuse. - No longer need DOCSDIRS/EXAMPLESDIR in env - Wrap long lines - Unset some vars in env when they are done being used to free space for larger sed vars - Cleanup redundant sed regexes - Add a Scripts/plist_sub_sed_sort.sh to prefer longer values when substituting over shorter values. - To make check-plist ignore a file *as an orphan* do one of the following: 1. Install it 2. post-install: ${RM} ${STAGEDIR}file 3. Put the file behind an OPTION with a PLIST_SUB: %%OPTION%%file 4. Add to plist as a @comment [2]: @comment file @comment @dirrmtry dir Reviewed by: mat (much earlier version) Discussed with: mat, antoine, bapt, swills (various bits) With hat: portmgr PR: ports/185561 [1] Reported By: Alexander Yerenkow <yerenkow@gmail.com> [1] Tested with: pkg and pkg_install Reported by: many (false-positives) [2] This is a partial solution, we may still need a plist.ignore too. It doesn't make much sense to add files in main pkg-plist we don't care about, but maybe it does since you'll see and reconsider them being ignored someday. @comment is used as all the OPTION PLIST_SUB deactivations use @comment instead of something like @ignore.
2014-04-19 06:44:56 +00:00
WITHOUT+= EXAMPLES
OPTIONS_WARNINGS_UNSET+= EXAMPLES
.endif
PORT_OPTIONS+= IPV6
# Add per arch options
.for opt in ${OPTIONS_DEFINE_${ARCH}}
.if empty(OPTIONS_DEFINE:M${opt})
OPTIONS_DEFINE+= ${opt}
.endif
.endfor
# Add per arch defaults
OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${ARCH}}
# Remove options the port maintainer doesn't want
.for opt in ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} ${OPTIONS_SLAVE} \
${OPTIONS_EXCLUDE_${OPSYS}}
OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:N${opt}}
OPTIONS_DEFINE:= ${OPTIONS_DEFINE:N${opt}}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
2013-06-10 09:19:38 +00:00
. for otype in SINGLE RADIO MULTI GROUP
. for m in ${OPTIONS_${otype}}
OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
. endfor
. endfor
.endfor
# Remove empty SINGLE/GROUP/RADIO/MULTI
# Can be empty because of exclude/slaves
2013-06-10 09:19:38 +00:00
.for otype in SINGLE RADIO MULTI GROUP
. for m in ${OPTIONS_${otype}}
. if empty(OPTIONS_${otype}_${m})
OPTIONS_${otype}:= ${OPTIONS_${otype}:N${m}}
. endif
. endfor
.endfor
# Sort options
ALL_OPTIONS:= ${OPTIONS_DEFINE:O:u}
OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:O:u}
# complete list
COMPLETE_OPTIONS_LIST= ${ALL_OPTIONS}
2013-06-10 09:27:19 +00:00
.for otype in SINGLE RADIO MULTI GROUP
. for m in ${OPTIONS_${otype}}
COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
. endfor
.endfor
## Now create the list of activated options
.if defined(OPTIONS_OVERRIDE)
# Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
# before
NEW_OPTIONS=
PORT_OPTIONS:= ${OPTIONS_OVERRIDE}
.else
NEW_OPTIONS= ${COMPLETE_OPTIONS_LIST}
## Set default options defined by the port maintainer
PORT_OPTIONS+= ${OPTIONS_DEFAULT}
## Set system-wide defined options (set by user in make.conf)
. for opt in ${OPTIONS_SET}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Remove the options excluded system-wide (set by user in make.conf)
. for opt in ${OPTIONS_UNSET}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
# XXX To remove once UNIQUENAME will be removed
## Set the options specified per-port (set by user in make.conf)
. for opt in ${${UNIQUENAME}_SET}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Unset the options excluded per-port (set by user in make.conf)
. for opt in ${${UNIQUENAME}_UNSET}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
# XXX To remove once UNIQUENAME will be removed
## Set the options specified per-port (set by user in make.conf)
. for opt in ${${OPTIONS_NAME}_SET}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Unset the options excluded per-port (set by user in make.conf)
. for opt in ${${OPTIONS_NAME}_UNSET}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
# XXX to remove once UNIQUENAME is removed
## options files (from dialog)
. if exists(${OPTIONSFILE}) && !make(rmconfig)
. include "${OPTIONSFILE}"
. endif
. sinclude "${OPTIONSFILE}.local"
# XXX to remove once UNIQUENAME is removed
## options files (from dialog)
. if exists(${OPTIONS_FILE}) && !make(rmconfig)
. include "${OPTIONS_FILE}"
. endif
. sinclude "${OPTIONS_FILE}.local"
### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
# XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
.for opt in ${ALL_OPTIONS:NDEBUG}
.if defined(WITH_${opt})
OPTIONS_WARNINGS+= "WITH_${opt}"
OPTIONS_WARNINGS_SET+= ${opt}
PORT_OPTIONS+= ${opt}
.endif
.if defined(WITHOUT_${opt})
OPTIONS_WARNINGS+= "WITHOUT_${opt}"
OPTIONS_WARNINGS_UNSET+= ${opt}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
.endif
.endfor
.if defined(OPTIONS_WARNINGS)
WARNING+= "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
WARNING+= "If you added them on the command line, you should replace them by"
WARNING+= "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
WARNING+= ""
WARNING+= "If they are global options set in your make.conf, you should replace them with:"
.if defined(OPTIONS_WARNINGS_SET)
WARNING+= "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
.endif
.if defined(OPTIONS_WARNINGS_UNSET)
WARNING+= "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
.endif
WARNING+= ""
WARNING+= "If they are local to this port, you should use:"
.if defined(OPTIONS_WARNINGS_SET)
WARNING+= "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
.endif
.if defined(OPTIONS_WARNINGS_UNSET)
WARNING+= "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
.endif
.endif
## Finish by using the options set by the port config dialog, if any
. for opt in ${OPTIONS_FILE_SET}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
.for opt in ${OPTIONS_FILE_UNSET}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
.endfor
.endif
## FORCE
## Set system-wide defined options (set by user in make.conf)
. for opt in ${OPTIONS_SET_FORCE}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Remove the options excluded system-wide (set by user in make.conf)
. for opt in ${OPTIONS_UNSET_FORCE}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
# XXX To remove once UNIQUENAME will be removed
## Set the options specified per-port (set by user in make.conf)
. for opt in ${${UNIQUENAME}_SET_FORCE}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Unset the options excluded per-port (set by user in make.conf)
. for opt in ${${UNIQUENAME}_UNSET_FORCE}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
# XXX To remove once UNIQUENAME will be removed
## Set the options specified per-port (set by user in make.conf)
. for opt in ${${OPTIONS_NAME}_SET_FORCE}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
. endfor
## Unset the options excluded per-port (set by user in make.conf)
. for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endfor
## Cmdline always win over the rest
.for opt in ${WITH}
. if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+= ${opt}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
. endif
.endfor
.for opt in ${WITHOUT}
PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
.endfor
# Finally, add options required by slave ports
PORT_OPTIONS+= ${OPTIONS_SLAVE}
# Sort options and eliminate duplicates
PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
## Now some compatibility
.if empty(PORT_OPTIONS:MDOCS)
NOPORTDOCS= yes
.endif
.if empty(PORT_OPTIONS:MEXAMPLES)
NOPORTEXAMPLES= yes
.endif
2014-03-28 11:04:54 +00:00
.if ${PORT_OPTIONS:MDEBUG}
WITH_DEBUG= yes
.endif
.if defined(NO_OPTIONS_SORT)
ALL_OPTIONS= ${OPTIONS_DEFINE}
.endif
.for target in ${_OPTIONS_TARGETS:C/:.*//:u}
_OPTIONS_${target}?=
.endfor
.for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
# PLIST_SUB
PLIST_SUB?=
SUB_LIST?=
. if defined(OPTIONS_SUB)
. if ! ${PLIST_SUB:M${opt}=*}
. if ${PORT_OPTIONS:M${opt}}
PLIST_SUB:= ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
. else
PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
. endif
. endif
. if ! ${SUB_LIST:M${opt}=*}
. if ${PORT_OPTIONS:M${opt}}
SUB_LIST:= ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
. else
SUB_LIST:= ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
. endif
. endif
. endif
. if ${PORT_OPTIONS:M${opt}}
. if defined(${opt}_USE)
. for option in ${${opt}_USE}
_u= ${option:C/=.*//g}
USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
. endfor
. endif
. if defined(${opt}_CONFIGURE_ENABLE)
. for iopt in ${${opt}_CONFIGURE_ENABLE}
CONFIGURE_ARGS+= --enable-${iopt}
. endfor
. endif
. if defined(${opt}_CONFIGURE_WITH)
. for iopt in ${${opt}_CONFIGURE_WITH}
CONFIGURE_ARGS+= --with-${iopt}
. endfor
. endif
. for configure in CONFIGURE CMAKE QMAKE
. if defined(${opt}_${configure}_ON)
${configure}_ARGS+= ${${opt}_${configure}_ON}
. endif
. endfor
. for flags in ${_OPTIONS_FLAGS}
. if defined(${opt}_${flags})
${flags}+= ${${opt}_${flags}}
. endif
. endfor
. for deptype in ${_OPTIONS_DEPENDS}
. if defined(${opt}_${deptype}_DEPENDS)
${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS}
. endif
. endfor
. for target in ${_OPTIONS_TARGETS}
_target= ${target:C/:.*//}
_prio= ${target:C/.*:(.*):.*/\1/}
_type= ${target:C/.*://}
_OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-on
. endfor
. else
. if defined(${opt}_USE_OFF)
. for option in ${${opt}_USE_OFF}
_u= ${option:C/=.*//g}
USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
. endfor
. endif
. if defined(${opt}_CONFIGURE_ENABLE)
. for iopt in ${${opt}_CONFIGURE_ENABLE}
CONFIGURE_ARGS+= --disable-${iopt:C/=.*//}
. endfor
. endif
. if defined(${opt}_CONFIGURE_WITH)
. for iopt in ${${opt}_CONFIGURE_WITH}
CONFIGURE_ARGS+= --without-${iopt:C/=.*//}
. endfor
. endif
. for configure in CONFIGURE CMAKE QMAKE
. if defined(${opt}_${configure}_OFF)
${configure}_ARGS+= ${${opt}_${configure}_OFF}
. endif
. endfor
. for flags in ${_OPTIONS_FLAGS}
. if defined(${opt}_${flags}_OFF)
${flags}+= ${${opt}_${flags}_OFF}
. endif
. endfor
. for deptype in ${_OPTIONS_DEPENDS}
. if defined(${opt}_${deptype}_DEPENDS_OFF)
${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS_OFF}
. endif
. endfor
. for target in ${_OPTIONS_TARGETS}
_target= ${target:C/:.*//}
_prio= ${target:C/.*:(.*):.*/\1/}
_type= ${target:C/.*://}
_OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-off
. endfor
. endif
.endfor
.endif