summaryrefslogtreecommitdiff
path: root/lang
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
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')
-rw-r--r--lang/mozjs68/Makefile7
-rw-r--r--lang/rust-bin/Makefile9
-rw-r--r--lang/rust-bin/buildlink3.mk13
-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
7 files changed, 81 insertions, 53 deletions
diff --git a/lang/mozjs68/Makefile b/lang/mozjs68/Makefile
index a88863cc889..95c9a30d1a4 100644
--- a/lang/mozjs68/Makefile
+++ b/lang/mozjs68/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/06/02 08:22:45 adam Exp $
+# $NetBSD: Makefile,v 1.5 2020/06/14 15:33:28 nia Exp $
DISTNAME= mozjs68_68.6.0.orig
PKGNAME= ${DISTNAME:S/_/-/:S/.orig//}
@@ -66,9 +66,8 @@ post-install:
BUILDLINK_DEPMETHOD.clang= build
.include "../../lang/clang/buildlink3.mk"
-BUILDLINK_DEPMETHOD.rust= build
-BUILDLINK_API_DEPENDS.rust+= rust>=1.34.0
-.include "../../lang/rust/buildlink3.mk"
+RUST_TYPE= 1.34.0
+.include "../../lang/rust/rust.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../textproc/icu/buildlink3.mk"
diff --git a/lang/rust-bin/Makefile b/lang/rust-bin/Makefile
index d228e6b150f..33705891a04 100644
--- a/lang/rust-bin/Makefile
+++ b/lang/rust-bin/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.8 2020/06/09 15:58:05 nia Exp $
+# $NetBSD: Makefile,v 1.9 2020/06/14 15:33:28 nia Exp $
DISTNAME= rust-1.44.0
+PKGNAME= ${DISTNAME:S/rust/rust-bin/1}
CATEGORIES= lang
MASTER_SITES= https://static.rust-lang.org/dist/
@@ -9,11 +10,7 @@ HOMEPAGE= https://rust-lang.org/
COMMENT= Safe, concurrent, practical language (official binaries)
LICENSE= mit OR apache-2.0
-.include "../../lang/rust/type.mk"
-
-.if ${RUST_TYPE} != "bin"
-PKG_SKIP_REASON+= "Rust binary package, RUST_TYPE is src"
-.endif
+CONFLICTS+= rust-[0-9]*
ONLY_FOR_PLATFORM+= Darwin-*-x86_64
ONLY_FOR_PLATFORM+= FreeBSD-*-i386
diff --git a/lang/rust-bin/buildlink3.mk b/lang/rust-bin/buildlink3.mk
new file mode 100644
index 00000000000..cb17cfc28ea
--- /dev/null
+++ b/lang/rust-bin/buildlink3.mk
@@ -0,0 +1,13 @@
+# $NetBSD: buildlink3.mk,v 1.1 2020/06/14 15:33:28 nia Exp $
+
+BUILDLINK_TREE+= rust-bin
+
+.if !defined(RUST_BIN_BUILDLINK3_MK)
+RUST_BIN_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.rust-bin+= rust-bin>=1.20.0
+BUILDLINK_PKGSRCDIR.rust-bin?= ../../lang/rust-bin
+BUILDLINK_PASSTHRU_DIRS+= ${PREFIX}/lib/rustlib
+.endif
+
+BUILDLINK_TREE+= -rust-bin
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)