aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-10-07 17:32:53 +0800
committerbapt <bapt@FreeBSD.org>2014-10-07 17:32:53 +0800
commit9cfe735b86d50bc7789d2ed73b9c82262c3623eb (patch)
tree07f5b47bd0315adc4778333b7d891c921a2c6785 /Mk/Uses
parent58ae9868c0e55a25403fbb3182e507b540c68e68 (diff)
downloadfreebsd-ports-gnome-9cfe735b86d50bc7789d2ed73b9c82262c3623eb.tar.gz
freebsd-ports-gnome-9cfe735b86d50bc7789d2ed73b9c82262c3623eb.tar.zst
freebsd-ports-gnome-9cfe735b86d50bc7789d2ed73b9c82262c3623eb.zip
Add a use to handle gperf dependency
It uses gperf from base if it exists and its version is 3.x.x Otherwise it uses gperf from ports
Diffstat (limited to 'Mk/Uses')
-rw-r--r--Mk/Uses/gperf.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/Mk/Uses/gperf.mk b/Mk/Uses/gperf.mk
new file mode 100644
index 000000000000..5f8a478c0e8b
--- /dev/null
+++ b/Mk/Uses/gperf.mk
@@ -0,0 +1,35 @@
+# $FreeBSD$
+#
+# handle dependency on gperf
+#
+# Feature: gperf
+# Usage: USES=gperf
+#
+# Take no arguments
+
+.if !defined(_INCLUDE_USES_GPERG_MK)
+_INCLUDE_USES_GPERF_MK= yes
+
+.if !exists(/usr/bin/gperf)
+BUILD_DEPENDS+= ${LOCALBASE}/bin/gperf:${PORTSDIR}/devel/gperf
+GPERF= ${LOCALBASE}/bin/gperf
+.else
+_GPERF_VERSION!= /usr/bin/gperf --version | head -1 || true
+_GPERF_MAJ_VERSION= ${_GPERF_VERSION:M[0-9].[0-9].[0-9]:C/.*([0-9]).[0-9].[0-9].*/\1/g}
+
+.if empty(_GPERF_MAJ_VERSION)
+_GPERF_MAJ_VERSION= 0
+.endif
+
+.if ${_GPERF_MAJ_VERSION} < 3
+BUILD_DEPENDS+= ${LOCALBASE}/bin/gperf:${PORTSDIR}/devel/gperf
+GPERF= ${LOCALBASE}/bin/gperf
+.else
+GPERF= /usr/bin/gperf
+.endif
+.endif
+
+CONFIGURE_ENV+= GPERF=${GPERF}
+MAKE_ENV+= GPERF=${GPERF}
+
+.endif