aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2013-10-10 07:01:54 +0800
committerbdrewery <bdrewery@FreeBSD.org>2013-10-10 07:01:54 +0800
commit040bd32f923f8e3bf6a723028bd2228b7c2032fe (patch)
treea4a6840d8ec88a6592dad37e7320ab196f3a823b /Mk
parentfc3705b3a2a293d0712c39e41e3b267148dc1058 (diff)
downloadfreebsd-ports-graphics-040bd32f923f8e3bf6a723028bd2228b7c2032fe.tar.gz
freebsd-ports-graphics-040bd32f923f8e3bf6a723028bd2228b7c2032fe.tar.zst
freebsd-ports-graphics-040bd32f923f8e3bf6a723028bd2228b7c2032fe.zip
- Move dialog4ports.sh to more appropriate new directory Mk/Scripts as
it is related to infrastructure/framework and a required portmgr- maintained script With hat: portmgr
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/dialog4ports.sh48
-rw-r--r--Mk/bsd.port.mk2
2 files changed, 49 insertions, 1 deletions
diff --git a/Mk/Scripts/dialog4ports.sh b/Mk/Scripts/dialog4ports.sh
new file mode 100644
index 00000000000..18897a267d8
--- /dev/null
+++ b/Mk/Scripts/dialog4ports.sh
@@ -0,0 +1,48 @@
+#! /bin/sh
+# $FreeBSD$
+# Maintainer: portmgr@FreeBSD.org
+set -e
+
+if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then
+ echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&2
+ exit 1
+fi
+
+: ${DIALOGPORT:=ports-mgmt/dialog4ports}
+: ${DIALOGNAME:=dialog4ports}
+
+OPTIONSFILE="$1"
+
+if ! [ -e $DIALOG4PORTS ]; then
+ # If INSTALL_AS_USER is set then just build and use the WRKDIR version
+ # Also do this if PREFIX!=LOCALBASE to avoid missing file or double
+ # installs
+ if [ -n "${INSTALL_AS_USER}" -o "${PREFIX}" != "${LOCALBASE}" ]; then
+ if ! [ -d "${PORTSDIR}/${DIALOGPORT}" ]; then
+ echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&2
+ exit 1
+ fi
+ DIALOG4PORTS=$(${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -V DIALOG4PORTS)
+ if ! [ -e "${DIALOG4PORTS}" ]; then
+ echo "===> Building ${DIALOGNAME} as it is required for the config dialog"
+ ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean build
+ fi
+ else
+ # Build+install through su-install as normal
+ echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog"
+ ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean install
+ # Need to clean again as it can't run twice in 1 call above
+ ${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean
+ fi
+fi
+
+# Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]).
+# Clear environment of PKGNAME or the dialog will show on older versions
+# that do not understand -v.
+if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then
+ exec $DIALOG4PORTS > $OPTIONSFILE 2>&1
+fi
+
+# Newer versions use stderr to work around a jail issue
+# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html
+exec $DIALOG4PORTS 2> $OPTIONSFILE
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 87eb92d263a..bfb09dde03f 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -6273,7 +6273,7 @@ do-config:
.endif
@TMPOPTIONSFILE=$$(mktemp -t portoptions); \
trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
- ${SETENV} ${D4P_ENV} ${SH} ${PORTSDIR}/Tools/scripts/dialog4ports.sh $${TMPOPTIONSFILE} || { \
+ ${SETENV} ${D4P_ENV} ${SH} ${SCRIPTSDIR}/dialog4ports.sh $${TMPOPTIONSFILE} || { \
${RM} -f $${TMPOPTIONSFILE}; \
${ECHO_MSG} "===> Options unchanged"; \
exit 0; \