pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc librsvg: Add available.mk and tool.mk mk fragments



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a9fb9b887451
branches:  trunk
changeset: 396738:a9fb9b887451
user:      leot <leot%pkgsrc.org@localhost>
date:      Sat Jun 08 19:51:38 2019 +0000

description:
librsvg: Add available.mk and tool.mk mk fragments

Rename LIBRSVG_USE_RUST to LIBRSVG_TYPE.

Isolate the LIBRSVG_TYPE logic in available.mk mk fragments in
order that can be used by other librsvg mk (e.g. tool.mk) or by
other package to check the preferred librsvg implementation to be
used. (e.g. devel/pango, fonts/harfbuzz and misc/libreoffice).

Add a tool.mk mk fragment in order to be able to specify librsvg
as a tool dependency honoring user's LIBRSVG_TYPE.
Thanks to <wiz> for suggesting that!

Discussed on tech-pkg@:

 <https://mail-index.NetBSD.org/tech-pkg/2019/06/05/msg021393.html>

diffstat:

 graphics/librsvg/available.mk  |  27 +++++++++++++++++++++++++++
 graphics/librsvg/buildlink3.mk |  12 ++++++------
 graphics/librsvg/tool.mk       |  18 ++++++++++++++++++
 mk/defaults/mk.conf            |   7 ++++---
 4 files changed, 55 insertions(+), 9 deletions(-)

diffs (108 lines):

diff -r c33331fd0166 -r a9fb9b887451 graphics/librsvg/available.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/librsvg/available.mk     Sat Jun 08 19:51:38 2019 +0000
@@ -0,0 +1,27 @@
+# $NetBSD: available.mk,v 1.1 2019/06/08 19:51:38 leot Exp $
+#
+# This mk fragment define LIBRSVG_TYPE variable used in other librsvg mk
+# fragments.
+#
+# User-settable variables:
+#
+# LIBRSVG_TYPE
+#      Type of used librsvg implementation.
+#
+#      Possible values: c rust
+#      Default: rust on platforms were Rust is supported
+#
+
+.if !defined(LIBRSVG_AVAILABLE_MK)
+LIBRSVG_AVAILABLE_MK=  defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.include "../../lang/rust/platform.mk"
+.if !empty(PLATFORM_SUPPORTS_RUST:M[Yy][Ee][Ss])
+LIBRSVG_TYPE?= rust
+.else
+LIBRSVG_TYPE?= c
+.endif
+
+.endif # LIBRSVG_AVAILABLE_MK
diff -r c33331fd0166 -r a9fb9b887451 graphics/librsvg/buildlink3.mk
--- a/graphics/librsvg/buildlink3.mk    Sat Jun 08 14:24:21 2019 +0000
+++ b/graphics/librsvg/buildlink3.mk    Sat Jun 08 19:51:38 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.48 2019/06/01 13:55:31 wiz Exp $
+# $NetBSD: buildlink3.mk,v 1.49 2019/06/08 19:51:38 leot Exp $
 
 BUILDLINK_TREE+=       librsvg
 
@@ -10,16 +10,16 @@
 
 .include "../../mk/bsd.fast.prefs.mk"
 
-# default to rust version on platforms where pkgsrc supports lang/rust
-.include "../../lang/rust/platform.mk"
-LIBRSVG_USE_RUST?=     ${PLATFORM_SUPPORTS_RUST}
+.include "../../graphics/librsvg/available.mk"
 
-.if ${LIBRSVG_USE_RUST} == "yes"
+.if ${LIBRSVG_TYPE} == "rust"
 BUILDLINK_PKGSRCDIR.librsvg?=          ../../graphics/librsvg
 BUILDLINK_API_DEPENDS.librsvg+=                librsvg>=2.41
-.else
+.elif ${LIBRSVG_TYPE} == "c"
 BUILDLINK_PKGSRCDIR.librsvg?=          ../../graphics/librsvg-c
 BUILDLINK_API_DEPENDS.librsvg+=                librsvg<2.41
+.else
+PKG_FAIL_REASON+=       "[graphics/librsvg/buildlink3.mk] Invalid value ${LIBRSVG_TYPE} for LIBRSVG_TYPE."
 .endif
 
 .include "../../devel/pango/buildlink3.mk"
diff -r c33331fd0166 -r a9fb9b887451 graphics/librsvg/tool.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/librsvg/tool.mk  Sat Jun 08 19:51:38 2019 +0000
@@ -0,0 +1,18 @@
+# $NetBSD: tool.mk,v 1.1 2019/06/08 19:51:38 leot Exp $
+#
+# This mk fragment can be included by all packages that need librsvg as a tool
+# dependency (e.g. for rsvg-convert).
+#
+
+.if !defined(LIBRSVG_TOOL_MK)
+LIBRSVG_TOOL_MK=       defined
+
+.include "../../graphics/librsvg/available.mk"
+
+.if ${LIBRSVG_TYPE} == "rust"
+TOOL_DEPENDS+= librsvg-[0-9]*:../../graphics/librsvg
+.else
+TOOL_DEPENDS+= librsvg-[0-9]*:../../graphics/librsvg-c
+.endif
+
+.endif # LIBRSVG_TOOL_MK
diff -r c33331fd0166 -r a9fb9b887451 mk/defaults/mk.conf
--- a/mk/defaults/mk.conf       Sat Jun 08 14:24:21 2019 +0000
+++ b/mk/defaults/mk.conf       Sat Jun 08 19:51:38 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.304 2019/06/05 21:05:00 wiz Exp $
+# $NetBSD: mk.conf,v 1.305 2019/06/08 19:51:38 leot Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -1293,11 +1293,12 @@
 # Default: news
 # Note: default is the same as INN_GROUP
 
-#LIBRSVG_USE_RUST?=    yes
+#LIBRSVG_TYPE?=        rust
 # Used by dependencies of graphics/librsvg to decide if the outdated
 # librsvg-2.40.xx should be used, which is plain C, or if the latest
 # version should be used, which is partially written in rust.
-# Default: yes on operating systems supported by lang/rust
+# Possible: c rust
+# Default: rust on operating systems supported by lang/rust
 
 LINUX_LOCALES?=                                                                \
        af ar bg br ca cs cy da de el en eo es et eu fi fo fr ga gl     \



Home | Main Index | Thread Index | Old Index