Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2009 01:21:41 +0100 (CET)
From:      olli hauer <ohauer@gmx.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        ohauer@gmx.de
Subject:   ports/140983: [patch] port Mk/bsd.port.mk + bsd.rrd.mk
Message-ID:  <20091129002141.C5B8E2614B@u18-124.dsl.vianetworks.de>
Resent-Message-ID: <200911290030.nAT0U1T0065350@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         140983
>Category:       ports
>Synopsis:       [patch] Mk/bsd.port.mk + bsd.rrd.mk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 29 00:30:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     olli hauer <ohauer@gmx.de>
>Release:        
>Organization:
>Environment:


>Description:
Within the last RRD update to version 1.3.x a lot of depencies (most X) have to build.
Most of the ports running fine even with rrdtool10 but this can not be configured without
modify everytime port database/rrdtool (replace with older version) or patching every port
to include anouther version.

A solution is maybe to make this configurable with a USE_RRD variable in the port self.

To make this work I wrote bsd.rrd.mk and extend bsd.ports.mk, so a port which use RRD
can now be written in this form (see sample modification from mail/mailgraph)
It is only important to set USE_RRD after RUN_DEPENDS!

(hope I can attach more than one file)

--
olli hauer


>How-To-Repeat:
compair build on fresh between rrdtool12 and rrdtool(13)

>Fix:

--- sample_for_rewritten_mail_mailgraph_Makefile.txt begins here ---
--- mail/mailgraph/Makefile.orig	2008-06-24 14:34:52.000000000 +0200
+++ mail/mailgraph/Makefile	2009-11-29 00:39:38.000000000 +0100
@@ -15,11 +15,11 @@
 MAINTAINER=	rafan@FreeBSD.org
 COMMENT=	A RRDtool frontend for Postfix statistics
 
-RUN_DEPENDS=	${SITE_PERL}/RRDp.pm:${PORTSDIR}/databases/rrdtool	\
-		${SITE_PERL}/File/Tail.pm:${PORTSDIR}/devel/p5-File-Tail
+RUN_DEPENDS=	${SITE_PERL}/File/Tail.pm:${PORTSDIR}/devel/p5-File-Tail
 
 NO_BUILD=	yes
 USE_PERL5=	yes
+USE_RRD=	10+
 
 CGIDIR?=	${PREFIX}/www/cgi-bin
 DATADIR?=	/var/db/mailgraph
--- sample_for_rewritten_mail_mailgraph_Makefile.txt ends here ---


--- patch_Mk_bsd.port.mk.txt begins here ---
--- Mk/bsd.port.mk
+++ Mk/bsd.port.mk
@@ -1583,6 +1583,10 @@
 .include "${PORTSDIR}/Mk/bsd.kde4.mk"
 .endif
 
+.if defined(USE_RRD)
+.include "${PORTSDIR}/Mk/bsd.rrd.mk"
+.endif
+
 # You can force skipping these test by defining IGNORE_PATH_CHECKS
 .if !defined(IGNORE_PATH_CHECKS)
 .if (${PREFIX:C,(^.).*,\1,} != "/")
@@ -2076,6 +2080,10 @@
 .include "${PORTSDIR}/Mk/bsd.cmake.mk"
 .endif
 
+.if defined(USE_RRD)
+.include "${PORTSDIR}/Mk/bsd.rrd.mk"
+.endif
+
 .if exists(${PORTSDIR}/../Makefile.inc)
 .include "${PORTSDIR}/../Makefile.inc"
 USE_SUBMAKE=	yes
--- patch_MK_bsd.port.mk.txt ends here ---


--- patch_Mk_bsd.rrd.mk.txt begins here ---
--- /dev/null	2009-11-29 00:52:27.000000000 +0100
+++ Mk/bsd.rrd.mk	2009-11-29 00:52:59.000000000 +0100
@@ -0,0 +1,114 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $FreeBSD$
+#
+# bsd.rrd.mk - rrdtool related macros.
+# Author: olli hauer <ohauer@gmx.de>
+#
+# Please view me with 4 column tabs!
+
+##########################################################################
+#
+# Variables definition
+# USE_RRD:	Call this script. Values can be:
+#		<version>: 1.0/10/1.2/12/1.3/1.3/1.0+/1.2+/1.3+
+#
+# Note: Setting USE_RRD to "yes" will set RRD_PORT to database/rrdtool
+#
+
+
+.if !defined(RRD_Pre_Include)
+RRD_Pre_Include=	bsd.rrd.mk
+
+#RRD_PORT= rrdtool13
+
+# Print warnings
+_ERROR_MSG=	: Error from bsd.rrd.mk.
+RRD_SUPPORTED_VERSION=	10 12 13
+RRD_DEFAULT_VERSION=	13
+
+# fallback to last version
+.if ${USE_RRD:L} == yes
+RRD_PORT?=	database/rrdtool
+USE_RRD=	${RRD_DEFAULT_VERSION}
+.endif
+
+RRD_VERSION=	${USE_RRD:C/\.//}
+RRD?=		${LOCALBASE}/bin/rrdtool
+
+.if exists(${RRD})
+RRD_INSTALLED_VERSION!=	${RRD} | ${SED} -ne 's/^RRDtool \([0-9]\)\.\([0-9]\)\.\([0-9][0-9]\).*/\1\2/p'
+.endif
+
+.if defined(RRD_PORT)
+STR_RRD_PORT=	${RRD_PORT:C/rrdtool//}
+.  if ${STR_RRD_PORT} != ""
+.    if ${STR_RRD_PORT} == "10"
+RRD_CUR_VERSION=	10
+.    elif ${STR_RRD_PORT} == "12"
+RRD_CUR_VERSION=	12
+.    elif ${STR_RRD_PORT} == "${RRD_DEFAULT_VERSION}"
+RRD_CUR_VERSION=	${RRD_DEFAULT_VERSION}
+.    endif
+.  else
+# only "rrdtool" is defined (without numeric prefix)
+RRD_CUR_VERSION=	${RRD_DEFAULT_VERSION}
+.  endif
+.endif
+
+# check if installed version match defined version in make.conf
+.if defined(RRD_INSTALLED_VERSION) && defined(RRD_CUR_VERSION)
+VERSION_CHECK!=		eval `${ECHO_CMD} "[ ${RRD_INSTALLED_VERSION} -eq ${RRD_CUR_VERSION} ]" | ${SED} -e 's/- -eq/ -ge/ ; s/+ -eq/ -le/' ` ; ${ECHO_CMD} $${?}
+.   if ${VERSION_CHECK} == 1
+IGNORE=		${_ERROR_MSG} rrdtool${RRD_INSTALLED_VERSION} is installed but RRD_PORT rrdtool${RRD_CUR_VERSION} is defined (maybe in make.conf)
+.   endif
+.endif
+
+# nothing defined in make.conf, use installed version
+.if defined(RRD_INSTALLED_VERSION) && !defined(RRD_CUR_VERSION)
+RRD_CUR_VERSION=	${RRD_INSTALLED_VERSION}
+.endif
+
+# check if installed version match version the port wants
+.if defined(RRD_CUR_VERSION)
+VERSION_CHECK!=		eval `${ECHO_CMD} "[ ${RRD_VERSION} -eq ${RRD_CUR_VERSION} ]" | ${SED} -e 's/- -eq/ -ge/ ; s/+ -eq/ -le/' ` ; ${ECHO_CMD} $${?}
+.   if ${VERSION_CHECK} == 1
+IGNORE=		${_ERROR_MSG} rrdtool${RRD_CUR_VERSION} is installed (or RRD_PORT is defined) and port requires ${USE_RRD}
+.   endif
+RRD_VERSION=	${RRD_CUR_VERSION}
+.else
+RRD_CUR_VERSION=	none
+.   if !defined(RRD_PORT)
+#Fallback to smallest version...
+RRD_VERSION=	${USE_RRD:C/\+//}
+.   endif
+.endif
+
+# map RRD version to ports directory
+.if ${RRD_VERSION} == 10
+RRD_PORT?=	database/rrdttol${RRD_VERSION}
+RUN_DEPENDS+=	rrdtool10:${PORTSDIR}/databases/rrdtool10
+
+.elif ${RRD_VERSION} == 12
+RRD_PORT?=	database/rrdttol${RRD_VERSION}
+RUN_DEPENDS+=	rrdtool12:${PORTSDIR}/databases/rrdtool12
+
+.elif ${RRD_VERSION} == ${RRD_DEFAULT_VERSION}
+RRD_PORT?=	database/rrdttol
+RUN_DEPENDS+=	rrdtool:${PORTSDIR}/databases/rrdtool
+
+.elif ${RRD_VERSION} >= ${RRD_DEFAULT_VERSION}
+RRD_PORT?=	database/rrdttol
+RUN_DEPENDS+=	rrdtool:${PORTSDIR}/databases/rrdtool
+
+.else
+RRD_PORT?=	database/rrdttol
+RUN_DEPENDS+=	rrdtool:${PORTSDIR}/databases/rrdtool
+.endif
+
+.endif #!defined(RRD_Pre_Include)
+
+.if defined(_POSTMKINCLUDED) && !defined(RRD_Post_Include)
+RRD_Post_Include=                    bsd.rrd.mk
+.endif          # defined(_POSTMKINCLUDED) && !defined(RRD_Post_Include)
--- patch_MK_bsd.rrd.mk.txt ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091129002141.C5B8E2614B>