summaryrefslogtreecommitdiff
path: root/lang/rust
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2020-06-14 15:33:27 +0000
committernia <nia@pkgsrc.org>2020-06-14 15:33:27 +0000
commit6126f20f213effac25d2b477408cb022d7795aae (patch)
tree883c3889f85a9a0b583726a3b6ffaa4cf9123229 /lang/rust
parent8ee5b232965adfd9937fc7cf874314933b58a950 (diff)
downloadpkgsrc-6126f20f213effac25d2b477408cb022d7795aae.tar.gz
Rename rust-bin's PKGNAME to rust-bin. Add rust.mk for rust packages.
This allows rust-bin and rust to coexist in bulk builds (for testing, etc), but the packages still may not be installed at the same time. rust.mk as a solution for picking the correct rust variant was suggested by gdt@. It is intended to be included directly by packages that do not use cargo.mk, and indirectly by packages that do use cargo.mk. rust.mk provides one user-settable variable: RUST_TYPE as before, whether to bootstrap rust from source or use official binaries. may be "src" or "bin" And two package-settable variables: RUST_REQ the minimum version of Rust required by the package. defaults to "1.20.0" RUST_RUNTIME whether Rust is a runtime dependency, may be "yes" or "no"
Diffstat (limited to 'lang/rust')
-rw-r--r--lang/rust/Makefile10
-rw-r--r--lang/rust/cargo.mk10
-rw-r--r--lang/rust/rust.mk57
-rw-r--r--lang/rust/type.mk28
4 files changed, 62 insertions, 43 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 08aa2f9088d..71ab6239349 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.179 2020/06/14 14:29:25 gdt Exp $
+# $NetBSD: Makefile,v 1.180 2020/06/14 15:33:27 nia Exp $
DISTNAME= rustc-1.43.1-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -11,6 +11,8 @@ HOMEPAGE= https://www.rust-lang.org/
COMMENT= Safe, concurrent, practical language
LICENSE= mit OR apache-2.0
+CONFLICTS+= rust-bin-[0-9]*
+
USE_GCC_RUNTIME= yes
USE_LANGUAGES= c c++11
USE_LIBTOOL= yes
@@ -20,12 +22,6 @@ USE_TOOLS+= bash ggrep gmake perl:build pkg-config
# build on 7). Mark earlier versions as broken.
BROKEN_ON_PLATFORM+= NetBSD-[1-7].*-*
-.include "type.mk"
-
-.if ${RUST_TYPE} != "src"
-PKG_SKIP_REASON+= "Rust source package, RUST_TYPE is bin"
-.endif
-
HAS_CONFIGURE= yes
PYTHON_FOR_BUILD_ONLY= yes
CONFIG_SHELL= ${PYTHONBIN}
diff --git a/lang/rust/cargo.mk b/lang/rust/cargo.mk
index abba173d573..3195eca1206 100644
--- a/lang/rust/cargo.mk
+++ b/lang/rust/cargo.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cargo.mk,v 1.16 2020/06/14 11:19:34 rillig Exp $
+# $NetBSD: cargo.mk,v 1.17 2020/06/14 15:33:27 nia Exp $
#
# Common logic that can be used by packages that depend on cargo crates
# from crates.io. This lets existing pkgsrc infrastructure fetch and verify
@@ -22,13 +22,7 @@
MASTER_SITES?= -${MASTER_SITE_CRATESIO}${PKGBASE}/${PKGVERSION_NOREV}/download
-.include "type.mk"
-
-.if ${RUST_TYPE} != "bin"
-BUILD_DEPENDS+= rust-[0-9]*:../../lang/rust
-.else
-BUILD_DEPENDS+= rust-[0-9]*:../../lang/rust-bin
-.endif
+.include "../../lang/rust/rust.mk"
USE_TOOLS+= bsdtar digest
CARGO_VENDOR_DIR= ${WRKDIR}/vendor
diff --git a/lang/rust/rust.mk b/lang/rust/rust.mk
new file mode 100644
index 00000000000..f683026a1ad
--- /dev/null
+++ b/lang/rust/rust.mk
@@ -0,0 +1,57 @@
+# $NetBSD: rust.mk,v 1.1 2020/06/14 15:33:27 nia Exp $
+#
+# This file determines the type of rust package to use.
+#
+# === User-settable variables ===
+#
+# RUST_TYPE
+# The preferred type of Rust release to use -
+# either bootstrap-from-source or an official binary.
+#
+# Official Rust binaries are only published for certain platforms,
+# including Darwin, Linux, and NetBSD x86_64.
+#
+# Possible values: src bin
+# Default: src
+#
+# === Package-settable variables ===
+#
+# RUST_REQ
+# The minimum version of Rust required by the package.
+# Binary Rust is only published for certain platforms.
+#
+# Default: 1.20.0
+#
+# RUST_RUNTIME
+# Whether rust is a runtime dependency.
+# Usually it is only needed to build.
+#
+# Possible values: yes no
+# Default: no
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+RUST_REQ?= 1.20.0
+RUST_RUNTIME?= no
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64)
+RUST_TYPE?= bin
+.else
+RUST_TYPE?= src
+.endif
+
+.if ${RUST_TYPE} == "bin"
+. if ${RUST_RUNTIME} != "no"
+BUILDLINK_DEPMETHOD.rust-bin?= build
+. endif
+BUILDLINK_API_DEPENDS.rust-bin+= rust-bin>=${RUST_REQ}
+. include "../../lang/rust-bin/buildlink3.mk"
+.endif
+
+.if ${RUST_TYPE} == "src"
+. if ${RUST_RUNTIME} != "no"
+BUILDLINK_DEPMETHOD.rust?= build
+. endif
+BUILDLINK_API_DEPENDS.rust+= rust>=${RUST_REQ}
+. include "../../lang/rust/buildlink3.mk"
+.endif
diff --git a/lang/rust/type.mk b/lang/rust/type.mk
deleted file mode 100644
index d2267eebb36..00000000000
--- a/lang/rust/type.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# $NetBSD: type.mk,v 1.2 2020/05/18 16:33:44 wiz Exp $
-#
-# This file determines the type of rust package to use -
-# binary (as via rustup) or a source bootstrap.
-#
-# Rust only publishes binaries for specific platforms in specific
-# tiers.
-#
-# === User-settable variables ===
-#
-# RUST_TYPE
-# The preferred Rust type to use.
-#
-# Possible values: src bin
-# Default: src
-
-.if !defined(RUST_TYPE)
-. include "../../mk/bsd.fast.prefs.mk"
-
-# The Rust bootstrapping process is often particularly slow
-# and unreliable on NetBSD due to ld.so bugs
-. if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64)
-RUST_TYPE?= bin
-. else
-RUST_TYPE?= src
-. endif
-
-.endif # !defined(RUST_TYPE)