summaryrefslogtreecommitdiff
path: root/lang/rust
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2019-07-11 10:24:14 +0000
committernia <nia@pkgsrc.org>2019-07-11 10:24:14 +0000
commit903738014a1a0f2396c720378550473bff0cf142 (patch)
tree4d5c6b3f5a60677d6315835f6128279f447a267c /lang/rust
parente0f29c9d085283179f7ab3b8c2c5d1558e8bc5f4 (diff)
downloadpkgsrc-903738014a1a0f2396c720378550473bff0cf142.tar.gz
rust: Make building the internal LLVM optional for everyone
(not just Darwin and SunOS). This was posted to tech-pkg@ a while ago with no objections, I've been using it for a while too.
Diffstat (limited to 'lang/rust')
-rw-r--r--lang/rust/Makefile17
-rw-r--r--lang/rust/options.mk28
2 files changed, 31 insertions, 14 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index 8207f7c03f8..128c751eb18 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.107 2019/07/08 15:16:40 he Exp $
+# $NetBSD: Makefile,v 1.108 2019/07/11 10:24:14 nia Exp $
DISTNAME= rustc-1.36.0-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -14,8 +14,6 @@ USE_GCC_RUNTIME= yes
USE_LANGUAGES= c c++11
USE_LIBTOOL= yes
USE_TOOLS+= bash ggrep gmake perl:build pkg-config
-# For internal llvm
-BUILD_DEPENDS+= cmake-[0-9]*:../../devel/cmake
# The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't
# build on 7). Mark earlier versions as broken.
@@ -124,18 +122,8 @@ CHECK_SSP_SUPPORTED= no
CHECK_PORTABILITY_SKIP+= src/vendor/openssl-src/openssl/.travis-create-release.sh
-# Required for LLVM (-std=c++11)
-GCC_REQD+= 4.8
-
.include "../../mk/bsd.prefs.mk"
-# The bundled LLVM current has issues building on SunOS.
-.if ${OPSYS} == "Darwin" || ${OPSYS} == "SunOS"
-.include "../../lang/llvm/buildlink3.mk"
-CONFIGURE_ARGS+= --enable-llvm-link-shared
-CONFIGURE_ARGS+= --llvm-root=${BUILDLINK_PREFIX.llvm}
-.endif
-
#
# Under NetBSD, do not use DT_RUNPATH
#
@@ -457,6 +445,8 @@ stage0-bootstrap: install
${GTAR} -zcf ${PKGNAME_NOREV}-${RUST_ARCH}.tar.gz ${PKGNAME_NOREV}-${RUST_ARCH})
.endif
+.include "options.mk"
+
# These dependencies currently use the bundled sources as they require
# development features not yet available in released versions.
#
@@ -465,7 +455,6 @@ stage0-bootstrap: install
#.include "../../www/curl/buildlink3.mk"
#.include "../../www/http-parser/buildlink3.mk"
-.include "../../devel/cmake/buildlink3.mk"
#.include "../../devel/jemalloc/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
diff --git a/lang/rust/options.mk b/lang/rust/options.mk
new file mode 100644
index 00000000000..fb4a227ce10
--- /dev/null
+++ b/lang/rust/options.mk
@@ -0,0 +1,28 @@
+# $NetBSD: options.mk,v 1.1 2019/07/11 10:24:14 nia Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.rust
+PKG_SUPPORTED_OPTIONS+= rust-llvm
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+# The bundled LLVM current has issues building on SunOS.
+.if ${OPSYS} != "SunOS" && ${OPSYS} != "Darwin"
+PKG_SUGGESTED_OPTIONS+= rust-llvm
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+#
+# Use the internal copy of LLVM.
+# This contains some extra optimizations.
+#
+.if !empty(PKG_OPTIONS:Mrust-llvm)
+# LLVM uses -std=c++11
+GCC_REQD+= 4.8
+BUILD_DEPENDS+= cmake-[0-9]*:../../devel/cmake
+.include "../../devel/cmake/buildlink3.mk"
+.else
+.include "../../lang/llvm/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-llvm-link-shared
+CONFIGURE_ARGS+= --llvm-root=${BUILDLINK_PREFIX.llvm}
+.endif