aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2015-08-17 21:31:25 +0800
committermat <mat@FreeBSD.org>2015-08-17 21:31:25 +0800
commiteeed34950a53f69e83651e52b9f913d1588dc2fe (patch)
tree15b8ce30f8e7f1a99871e40ce43b8bd49254597d /Mk/Uses
parenta048c020efc0bd78ac1b2afaa03313e655202200 (diff)
downloadfreebsd-ports-graphics-eeed34950a53f69e83651e52b9f913d1588dc2fe.tar.gz
freebsd-ports-graphics-eeed34950a53f69e83651e52b9f913d1588dc2fe.tar.zst
freebsd-ports-graphics-eeed34950a53f69e83651e52b9f913d1588dc2fe.zip
Rewrite the target ordering code.
The targets now have priority assigned to them, and, when the dependency ordering magic is done at the end of bsd.port.mk, they are sorted according to their priority. This allows USES to add targets easily and have them run whenever they want without touching bsd.port.mk. To add a target that runs just before post-configure run, do: _USES_configure+= 695:my-post-configure my-post-configure: do something To fine tune when the target is ran, look at the values in the *_SEQ variables at the end of bsd.port.mk, and the other USES. Allow ports Makefiles to override the priority of targets with the TARGET_ORDER_OVERRIDE variable. For example, to get post-install running earlier, (its default is 700) do: TARGET_ORDER_OVERRIDE= 650:post-install While there, add options target helpers for the do-* targets when they exist. Reviewed by: antoine, bapt Exp-run by: antoine Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D3099
Diffstat (limited to 'Mk/Uses')
-rw-r--r--Mk/Uses/autoreconf.mk1
-rw-r--r--Mk/Uses/charsetfix.mk1
-rw-r--r--Mk/Uses/cran.mk5
-rw-r--r--Mk/Uses/display.mk6
-rw-r--r--Mk/Uses/dos2unix.mk1
-rw-r--r--Mk/Uses/erlang.mk21
-rw-r--r--Mk/Uses/kmod.mk2
-rw-r--r--Mk/Uses/libtool.mk2
-rw-r--r--Mk/Uses/ncurses.mk3
-rw-r--r--Mk/Uses/pathfix.mk1
-rw-r--r--Mk/Uses/perl5.mk1
-rw-r--r--Mk/Uses/shebangfix.mk1
-rw-r--r--Mk/Uses/uniquefiles.mk2
-rw-r--r--Mk/Uses/webplugin.mk1
-rw-r--r--Mk/Uses/zope.mk3
15 files changed, 26 insertions, 25 deletions
diff --git a/Mk/Uses/autoreconf.mk b/Mk/Uses/autoreconf.mk
index 5cb691805dd..de92a6788f6 100644
--- a/Mk/Uses/autoreconf.mk
+++ b/Mk/Uses/autoreconf.mk
@@ -70,6 +70,7 @@ BUILD_DEPENDS+= libtoolize:${PORTSDIR}/devel/libtool
_INCLUDE_USES_AUTORECONF_POST_MK= yes
.if ! ${autoreconf_ARGS:Mbuild}
+_USES_configure+= 470:do-autoreconf
do-autoreconf:
.for f in AUTHORS ChangeLog INSTALL NEWS README
# Don't modify time stamps if the files already exist
diff --git a/Mk/Uses/charsetfix.mk b/Mk/Uses/charsetfix.mk
index 33c4f13ab80..7f99da0e6c3 100644
--- a/Mk/Uses/charsetfix.mk
+++ b/Mk/Uses/charsetfix.mk
@@ -17,6 +17,7 @@ IGNORE= USES=charsetfix does not require args
CHARSETFIX_MAKEFILEIN?= Makefile.in
+_USES_patch+= 600:charsetfix-post-patch
charsetfix-post-patch:
@${FIND} ${WRKSRC} -name "${CHARSETFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} \
-e 's|need_charset_alias=true|need_charset_alias=false|g ; \
diff --git a/Mk/Uses/cran.mk b/Mk/Uses/cran.mk
index 350a2300187..dd600640933 100644
--- a/Mk/Uses/cran.mk
+++ b/Mk/Uses/cran.mk
@@ -70,11 +70,10 @@ do-install:
.endif
.if ${cran_ARGS:Mauto-plist}
-.if !target(post-install-script)
-post-install-script:
+_USES_install+= 750:cran-auto-plist
+cran-auto-plist:
@${FIND} -ds ${STAGEDIR}${PREFIX}/${R_MOD_DIR} \( -type f -or -type l \) -print | \
${SED} -E -e 's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST}
.endif
-.endif
.endif #_INCLUDE_USES_CRAN_MK
diff --git a/Mk/Uses/display.mk b/Mk/Uses/display.mk
index b3aec5a49f3..de7e1bc42b2 100644
--- a/Mk/Uses/display.mk
+++ b/Mk/Uses/display.mk
@@ -26,11 +26,7 @@ XVFBPORT!= port=0; while test -S /tmp/.X11-unix/X$${port} ; do port=$$(( port +
XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}.pid
MAKE_ENV+= DISPLAY=":${XVFBPORT}"
-.PHONY: start-display stop-display
-pre-${display_ARGS}: start-display
-
-post-${display_ARGS}: stop-display
-
+_USES_${display_ARGS}+= 290:start-display 860:stop-display
start-display:
daemon -p ${XVFBPIDFILE} Xvfb :${XVFBPORT}
diff --git a/Mk/Uses/dos2unix.mk b/Mk/Uses/dos2unix.mk
index a6c9994cdb1..7a5e83ea7e9 100644
--- a/Mk/Uses/dos2unix.mk
+++ b/Mk/Uses/dos2unix.mk
@@ -15,6 +15,7 @@ _INCLUDE_USES_DOS2UNIX_MK= yes
_DOS2UNIX_ALL= yes
.endif
+_USES_patch+= 200:dos2unix
dos2unix:
@${ECHO_MSG} "===> Converting DOS text files to UNIX text files"
.if defined(_DOS2UNIX_ALL)
diff --git a/Mk/Uses/erlang.mk b/Mk/Uses/erlang.mk
index ac22d99da6d..c81499e4edf 100644
--- a/Mk/Uses/erlang.mk
+++ b/Mk/Uses/erlang.mk
@@ -65,18 +65,7 @@ ERLANG_COMPILE= ${REBAR_CMD}
ERLANG_COMPILE= ${REBAR3_CMD}
.endif
-.if !target(post-patch)
-post-patch: post-patch-erlang
-.endif
-
-.if !target(do-build)
-do-build: do-build-erlang
-.endif
-
-.if !target(do-install)
-do-install: do-install-erlang
-.endif
-
+_USES_patch+= 650:post-patch-erlang
post-patch-erlang:
@${FIND} ${WRKSRC} -name .gitignore -delete
# Attempt to remove all traces of {vsn, ....}; replace with actual PORTVERSION
@@ -99,7 +88,8 @@ post-patch-erlang:
fi
@${RM} -f ${WRKSRC}/src/*.orig ${WRKSRC}/include/*.orig
-do-build-erlang:
+.if !target(do-build)
+do-build:
# This will cause calls to local rebar and rebar3 to fail; makes it easier to spot them
@${RM} -f ${WRKSRC}/rebar ${WRKSRC}/rebar3
.for target in ${REBAR_TARGETS}
@@ -107,8 +97,10 @@ do-build-erlang:
@${RM} ${WRKSRC}/rebar.lock
@cd ${WRKSRC} && REBAR_PROFILE=${REBAR_PROFILE} ${ERLANG_COMPILE} ${target}
.endfor
+.endif # !target(do-build)
-do-install-erlang:
+.if !target(do-install)
+do-install:
@${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}
@${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/src
cd ${WRKSRC}/src && ${COPYTREE_SHARE} \* ${STAGEDIR}${ERL_APP_ROOT}/src
@@ -141,5 +133,6 @@ do-install-erlang:
@${MKDIR} ${STAGEDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
.endif
+.endif # !target(do-install)
.endif #!defined(_INCLUDE_USES_ERLANG_MK)
diff --git a/Mk/Uses/kmod.mk b/Mk/Uses/kmod.mk
index ce37c117184..f9aa4be155f 100644
--- a/Mk/Uses/kmod.mk
+++ b/Mk/Uses/kmod.mk
@@ -39,7 +39,7 @@ STRIP_CMD+= --strip-debug # do not strip kernel symbols
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_KMOD_POST_MK)
_INCLUDE_USES_KMOD_POST_MK= yes
-pre-install: ${STAGEDIR}${KMODDIR}
+_USES_install+= 290:${STAGEDIR}${KMODDIR}
${STAGEDIR}${KMODDIR}:
@${MKDIR} ${.TARGET}
diff --git a/Mk/Uses/libtool.mk b/Mk/Uses/libtool.mk
index 3149cd75fa3..96596278dc3 100644
--- a/Mk/Uses/libtool.mk
+++ b/Mk/Uses/libtool.mk
@@ -25,6 +25,7 @@ BUILD_DEPENDS+= libtool:${PORTSDIR}/devel/libtool
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_LIBTOOL_POST_MK)
_INCLUDE_USES_LIBTOOL_POST_MK= yes
+_USES_configure+= 480:patch-libtool
patch-libtool:
@${FIND} ${WRKDIR} \( -name configure -or -name ltconfig \) \
-type f | while read i; do ${SED} -i.libtool.bak \
@@ -66,6 +67,7 @@ patch-libtool:
-e '/if.*prog.*linkmode.*relink = .*mode/s/||.*;/;/' \
-e 's/|-p|-pg|/|-B*|-fstack-protector*|-p|-pg|/'
+_USES_stage+= 790:patch-lafiles
patch-lafiles:
.if ${libtool_ARGS:Mkeepla}
@${FIND} ${STAGEDIR} -type f -name '*.la' | \
diff --git a/Mk/Uses/ncurses.mk b/Mk/Uses/ncurses.mk
index 413a8f8132a..8e740016050 100644
--- a/Mk/Uses/ncurses.mk
+++ b/Mk/Uses/ncurses.mk
@@ -39,7 +39,8 @@ NCURSESBASE= /usr
NCURSESINC= ${NCURSESBASE}/include
. if exists(${LOCALBASE}/lib/libncurses.so)
-check-depends::
+_USES_sanity+= 400:check-depends-ncurses
+check-depends-ncurses:
@${ECHO_CMD} "Dependency error: this port wants the ncurses library from the FreeBSD"
@${ECHO_CMD} "base system. You can't build against it, while a newer"
@${ECHO_CMD} "version is installed by a port."
diff --git a/Mk/Uses/pathfix.mk b/Mk/Uses/pathfix.mk
index adc1b8beb2e..6db22811ffc 100644
--- a/Mk/Uses/pathfix.mk
+++ b/Mk/Uses/pathfix.mk
@@ -18,6 +18,7 @@ IGNORE= USES=pathfix does not require args
PATHFIX_MAKEFILEIN?= Makefile.in
+_USES_patch+= 190:pathfix
pathfix:
@${FIND} ${WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \
's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \
diff --git a/Mk/Uses/perl5.mk b/Mk/Uses/perl5.mk
index 93d01d041c9..bb1454ea1ca 100644
--- a/Mk/Uses/perl5.mk
+++ b/Mk/Uses/perl5.mk
@@ -274,6 +274,7 @@ PACKLIST_DIR?= ${PREFIX}/${SITE_ARCH_REL}/auto
# In all those, don't use - before the command so that the user does
# not wonder what has been ignored by this message "*** Error code 1 (ignored)"
+_USES_install+= 560:fix-perl-things
fix-perl-things:
# Remove STAGEDIR from .packlist and add the file to the plist.
@(if [ -d ${STAGEDIR}${PACKLIST_DIR} ] ; then \
diff --git a/Mk/Uses/shebangfix.mk b/Mk/Uses/shebangfix.mk
index 14443dc32a7..df3634be12d 100644
--- a/Mk/Uses/shebangfix.mk
+++ b/Mk/Uses/shebangfix.mk
@@ -64,6 +64,7 @@ IGNORE+= missing definition for ${lang}_OLD_CMD
_SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${${lang}_OLD_CMD}|\#!${${lang}_CMD}|"
.endfor
+_USES_patch+= 210:fix-shebang
fix-shebang:
@cd ${WRKSRC}; \
${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS}
diff --git a/Mk/Uses/uniquefiles.mk b/Mk/Uses/uniquefiles.mk
index c29fe9d0067..8285a4fa6d6 100644
--- a/Mk/Uses/uniquefiles.mk
+++ b/Mk/Uses/uniquefiles.mk
@@ -101,6 +101,7 @@ _DO_CONDITIONAL_SYMLINK= \
_DO_CONDITIONAL_SYMLINK= ${DO_NADA}
.endif
+_USES_stage+= 775:move-uniquefiles
move-uniquefiles:
.if ${UNIQUE_PREFIX_FILES} || ${UNIQUE_FIND_PREFIX_FILES}
@${ECHO_MSG} "===> Creating unique files: Move files needing PREFIX";
@@ -166,6 +167,7 @@ move-uniquefiles:
# Using .if exists(${_UNIQUEPKGPLIST} below instead of the sh test
# does not work in poudriere. It works fine on the CLI, though...
+_USES_stage+= 950:move-uniquefiles-plist
move-uniquefiles-plist:
@if [ -e ${_UNIQUEPKGLIST} ]; then \
orgIFS=$$IFS; IFS=":"; while read command entry newentry; do \
diff --git a/Mk/Uses/webplugin.mk b/Mk/Uses/webplugin.mk
index 4108ceccf2a..0d19b70d8d8 100644
--- a/Mk/Uses/webplugin.mk
+++ b/Mk/Uses/webplugin.mk
@@ -167,6 +167,7 @@ PLIST_FILES+= ${d}/${l}
.endfor
.endfor
+_USES_install+= 600:webplugin-post-install
webplugin-post-install:
.for d in ${_WEBPLUGIN_LINKFARMS}
${MKDIR} ${STAGEDIR}${d}
diff --git a/Mk/Uses/zope.mk b/Mk/Uses/zope.mk
index b58c8b85eeb..5165c89abb6 100644
--- a/Mk/Uses/zope.mk
+++ b/Mk/Uses/zope.mk
@@ -79,7 +79,8 @@ IGNORE+= Zope requires Python ${_PYTHON_VER_REQUIRED}.\
.if ${ZOPE_VERSION} == ${_ZOPE_PORTBRANCH}
RUN_DEPENDS+= zope213>0:${PORTSDIR}/www/zope213
.else
-check-makevars::
+_USES_sanity+= 300:check-makevars-zope
+check-makevars-zope:
@${ECHO} "Makefile error: bad value for ZOPE_VERSION: ${ZOPE_VERSION}."
@${ECHO} "Legal values are: ${_ZOPE_PORTBRANCH} (default)"
@${FALSE}