diff options
author | nia <nia@pkgsrc.org> | 2020-05-18 16:17:20 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2020-05-18 16:17:20 +0000 |
commit | e0f068173539c267c86b9a92471163db419c4415 (patch) | |
tree | bb206ee521fdb3b44997e7993294b1e2f84a4e69 /lang | |
parent | 5d4353a4d8c4311949e93f340ad1e2eecfae9d4d (diff) | |
download | pkgsrc-e0f068173539c267c86b9a92471163db419c4415.tar.gz |
lang: Add rust-bin.
Dumb package that selects and installs a binary rust distribution
based on its guess of your platform (FreeBSD, NetBSD, Linux x86_64 are
all supported). These binaries are the official ones provided by
rust upstream and are the same as those provided by the `rustup` tool.
You can choose to use a binary rust distribution by setting:
RUST_TYPE=bin in mk.conf
(or source distribution with RUST_TYPE=src).
Currently, RUST_TYPE=bin by default ONLY for NetBSD-x86_64. This is
because TNF has been shown to _repeatedly_ be unable and _unwilling_ to
ensure that rust-dependent packages build properly on their
infrastructure, and NetBSD users are all suffering for it.
This was based on minskim's work in pkgsrc-wip.
It was tested by building librsvg and firefox-esr with the resulting
binaries.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/Makefile | 3 | ||||
-rw-r--r-- | lang/rust-bin/DESCR | 15 | ||||
-rw-r--r-- | lang/rust-bin/Makefile | 137 | ||||
-rw-r--r-- | lang/rust-bin/distinfo | 39 | ||||
-rw-r--r-- | lang/rust-bin/patches/patch-install.sh | 24 | ||||
-rw-r--r-- | lang/rust/buildlink3.mk | 8 | ||||
-rw-r--r-- | lang/rust/cargo.mk | 8 | ||||
-rw-r--r-- | lang/rust/type.mk | 28 |
8 files changed, 259 insertions, 3 deletions
diff --git a/lang/Makefile b/lang/Makefile index c9a10358ff5..11d2d55e26a 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.563 2020/05/18 15:19:31 wiz Exp $ +# $NetBSD: Makefile,v 1.564 2020/05/18 16:17:20 nia Exp $ # COMMENT= Programming languages @@ -262,6 +262,7 @@ SUBDIR+= ruby27 SUBDIR+= ruby27-base SUBDIR+= runawk SUBDIR+= rust +SUBDIR+= rust-bin SUBDIR+= sablevm SUBDIR+= sablevm-classpath SUBDIR+= sablevm-classpath-gui diff --git a/lang/rust-bin/DESCR b/lang/rust-bin/DESCR new file mode 100644 index 00000000000..2b669376946 --- /dev/null +++ b/lang/rust-bin/DESCR @@ -0,0 +1,15 @@ +Rust is a systems programming language focused on three goals: safety, +speed, and concurrency. It maintains these goals without having a +garbage collector, making it a useful language for a number of use cases +other languages aren't good at: embedding in other languages, programs +with specific space and time requirements, and writing low-level code, +like device drivers and operating systems. + +It improves on current languages targeting this space by having a number +of compile-time safety checks that produce no runtime overhead, while +eliminating all data races. Rust also aims to achieve "zero-cost +abstractions" even though some of these abstractions feel like those of +a high-level language. Even then, Rust still allows precise control +like a low-level language would. + +This package installs a released binary. diff --git a/lang/rust-bin/Makefile b/lang/rust-bin/Makefile new file mode 100644 index 00000000000..2cbde15e292 --- /dev/null +++ b/lang/rust-bin/Makefile @@ -0,0 +1,137 @@ +# $NetBSD: Makefile,v 1.1 2020/05/18 16:17:21 nia Exp $ + +DISTNAME= rust-1.42.0 +CATEGORIES= lang +MASTER_SITES= https://static.rust-lang.org/dist/ + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://rust-lang.org/ +COMMENT= Safe, concurrent, practical language +LICENSE= mit OR apache-2.0 + +ONLY_FOR_PLATFORM+= Darwin-*-x86_64 +ONLY_FOR_PLATFORM+= FreeBSD-*-i386 +ONLY_FOR_PLATFORM+= FreeBSD-*-x86_64 +ONLY_FOR_PLATFORM+= NetBSD-*-x86_64 +ONLY_FOR_PLATFORM+= Linux-*-aarch64 +ONLY_FOR_PLATFORM+= Linux-*-i386 +ONLY_FOR_PLATFORM+= Linux-*-x86_64 + +# The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't +# build on 7). Mark earlier versions as broken. +BROKEN_ON_PLATFORM+= NetBSD-[1-7].*-* + +NO_BUILD= yes +USE_TOOLS+= bash +WRKSRC= ${WRKDIR}/${DISTFILES:S/.tar.gz//} + +GENERATE_PLIST+= find ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \ + sed 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ; + +INSTALLATION_DIRS= bin ${PKGMANDIR} share/doc/cargo/bash_completion.d + +.include "../../mk/bsd.prefs.mk" + +DISTFILES:= # empty + +.if !empty(MACHINE_PLATFORM:MDarwin-*-x86_64) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= x86_64-apple-darwin +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if !empty(MACHINE_PLATFORM:MFreeBSD-*-x86_64) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= x86_64-unknown-freebsd +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if !empty(MACHINE_PLATFORM:MFreeBSD-*-i386) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= i686-unknown-freebsd +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if !empty(MACHINE_PLATFORM:MLinux-*-i386) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= i686-unknown-linux-gnu +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if (!empty(MACHINE_PLATFORM:MLinux-*-aarch64) && !empty(GLIBC_VERSION)) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= aarch64-unknown-linux-gnu +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if (!empty(MACHINE_PLATFORM:MLinux-*-x86_64) && !empty(GLIBC_VERSION)) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= x86_64-unknown-linux-gnu +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if (!empty(MACHINE_PLATFORM:MLinux-*-x86_64) && empty(GLIBC_VERSION)) || make(distinfo) || make(makesum) || make(mdi) +RUST_ARCH:= x86_64-unknown-linux-musl +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif +.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || make(distinfo) || make(makesum) || make(mdi) +DEPENDS+= compat80-[0-9]*:../../emulators/compat80 +RUST_ARCH:= x86_64-unknown-netbsd +DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz +.endif + +do-install: + cd ${WRKSRC} && env PKGMANDIR=${PKGMANDIR} bash ./install.sh \ + --destdir=${DESTDIR} --prefix=${PREFIX} + ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/install.log + ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/manifest-* + ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/uninstall.sh + +.if ${OPSYS} == "Darwin" +.PHONY: fix-darwin-install-name +post-install: fix-darwin-install-name +fix-darwin-install-name: +. for bin in cargo-miri clippy-driver miri rls rustc rustdoc + otool -XL ${DESTDIR}${PREFIX}/bin/${bin} \ + | ${GREP} '@rpath' | while read rpath rest; do \ + install_name_tool -change $$rpath \ + `${ECHO} $$rpath | ${SED} -e 's,@rpath,${PREFIX}/lib,g'` \ + ${DESTDIR}${PREFIX}/bin/${bin}; \ + done +. endfor +. for bin in lldb lldb-mi llvm-nm llvm-objcopy llvm-objdump \ + llvm-profdata llvm-readobj llvm-size llvm-strip + otool -XL ${DESTDIR}${PREFIX}/lib/rustlib/${RUST_ARCH}/bin/${bin} \ + | ${GREP} '@rpath' | while read rpath rest; do \ + install_name_tool -change $$rpath \ + `${ECHO} $$rpath | ${SED} -e 's,@rpath,${PREFIX}/lib/rustlib/${RUST_ARCH}/lib,g'` \ + ${DESTDIR}${PREFIX}/lib/rustlib/${RUST_ARCH}/bin/${bin}; \ + done +. endfor +. for lib in lib lib/rustlib/${RUST_ARCH}/lib lib/rustlib/${RUST_ARCH}/codegen-backends + for f in ${DESTDIR}${PREFIX}/${lib}/lib*.dylib; do \ + [ ! -f $$f ] && continue; \ + install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \ + otool -XL $$f | grep '@rpath' | while read rpath rest; do \ + install_name_tool -change $$rpath \ + `${ECHO} $$rpath | ${SED} -e 's,@rpath,${PREFIX}/lib,g'` \ + $$f; \ + done; \ + done + install_name_tool -id ${PREFIX}/lib/rustlib/${RUST_ARCH}/lib/python2.7/site-packages/lldb/_lldb.so \ + ${DESTDIR}${PREFIX}/lib/rustlib/${RUST_ARCH}/lib/python2.7/site-packages/lldb/_lldb.so +. endfor +.else +TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf + +.PHONY: fix-relative-rpath +post-install: fix-relative-rpath +fix-relative-rpath: +. for bin in cargo-miri clippy-driver miri rls rustc rustdoc + ${PREFIX}/bin/patchelf --set-rpath \ + ${PREFIX}/lib ${DESTDIR}${PREFIX}/bin/${bin} +. endfor +. for bin in llvm-nm llvm-objcopy llvm-objdump llvm-profdata \ + llvm-readobj llvm-size llvm-strip + ${PREFIX}/bin/patchelf --set-rpath \ + ${PREFIX}/lib/rustlib/${RUST_ARCH}/lib \ + ${DESTDIR}${PREFIX}/lib/rustlib/${RUST_ARCH}/bin/${bin} +. endfor +. for lib in lib lib/rustlib/${RUST_ARCH}/lib \ + lib/rustlib/${RUST_ARCH}/codegen-backends + for f in ${DESTDIR}${PREFIX}/${lib}/lib*.so; do \ + [ ! -f $$f ] && continue; \ + ${PREFIX}/bin/patchelf --set-rpath ${PREFIX}/lib $$f; \ + done +. endfor +.endif + +.include "../../mk/bsd.pkg.mk" diff --git a/lang/rust-bin/distinfo b/lang/rust-bin/distinfo new file mode 100644 index 00000000000..820a50ef940 --- /dev/null +++ b/lang/rust-bin/distinfo @@ -0,0 +1,39 @@ +$NetBSD: distinfo,v 1.1 2020/05/18 16:17:21 nia Exp $ + +SHA1 (rust-1.42.0-aarch64-unknown-linux-gnu.tar.gz) = f5b32a30b6b744834be4ceed1c4eac5873dc9a4f +RMD160 (rust-1.42.0-aarch64-unknown-linux-gnu.tar.gz) = 5c313e75fe27707240772e316cf8b2b61eea5165 +SHA512 (rust-1.42.0-aarch64-unknown-linux-gnu.tar.gz) = ac4c9c21103b12e122f3f277424e74ee2572daf62da3476ed6710910fa4ecf843cb6464b05338ae50aa35e9844ad04a8c09746af8f03602c643da3673dc60d06 +Size (rust-1.42.0-aarch64-unknown-linux-gnu.tar.gz) = 153531604 bytes +SHA1 (rust-1.42.0-i686-unknown-freebsd.tar.gz) = 47c98dcff8988d8466ede45ffe4299cd293fb2b3 +RMD160 (rust-1.42.0-i686-unknown-freebsd.tar.gz) = 175cfd391535b332d658a2bdfb81895f7bfac8e5 +SHA512 (rust-1.42.0-i686-unknown-freebsd.tar.gz) = 096dee142161d669f88498b68f00e881c56fbf8ec8295e1924b70ab69f9db28e6f0faf763b9b5532333aca4ef1fd0d84c1ef0e4914c4b781fc80be299fcc9fda +Size (rust-1.42.0-i686-unknown-freebsd.tar.gz) = 120349647 bytes +SHA1 (rust-1.42.0-i686-unknown-linux-gnu.tar.gz) = e477282ac75019e0012ae062f58459affbdccae4 +RMD160 (rust-1.42.0-i686-unknown-linux-gnu.tar.gz) = 655fde440160d3a2db730148d5453b2d46f12d36 +SHA512 (rust-1.42.0-i686-unknown-linux-gnu.tar.gz) = 55ba536b2c75a48320899a79a4487db40f5a0ab54543c1eb4b19cf7600e2d6b4343ce1bcb3b77094f8885441bd1056c28afe7dd05ea751eced2071b8f07804ca +Size (rust-1.42.0-i686-unknown-linux-gnu.tar.gz) = 201205399 bytes +SHA1 (rust-1.42.0-powerpc64le-unknown-linux-gnu.tar.gz) = 479f31aa1dac6a274b9f77b927a2695e930d7edb +RMD160 (rust-1.42.0-powerpc64le-unknown-linux-gnu.tar.gz) = 152414c88625b8a2dbd622dde03e3a7695aa6612 +SHA512 (rust-1.42.0-powerpc64le-unknown-linux-gnu.tar.gz) = b9028b8aaec11c48a3d4af6a2a726ba64fcdf0e953299293a139a809db598bb9ef564febeb14b3cdb20b64bf73c14be373b6d5aacc52ae140f812ce62b4cb64f +Size (rust-1.42.0-powerpc64le-unknown-linux-gnu.tar.gz) = 171741051 bytes +SHA1 (rust-1.42.0-x86_64-apple-darwin.tar.gz) = 232c1d8d14cebef81cc6e8507ed9b5a337041237 +RMD160 (rust-1.42.0-x86_64-apple-darwin.tar.gz) = 19e4313c4cd862acb521e73b5269a25683091042 +SHA512 (rust-1.42.0-x86_64-apple-darwin.tar.gz) = 373940c7a2d2d921ca3d21c7a649c3014b1de8e04822f56c8de313ba6f610a70a559f106f7aa049bf5eaf333dde46089b2cf8e71961801788cd8eb515342cb84 +Size (rust-1.42.0-x86_64-apple-darwin.tar.gz) = 170080422 bytes +SHA1 (rust-1.42.0-x86_64-unknown-freebsd.tar.gz) = 97ce4299110d7a1c2b326980435d4b7de8cded2b +RMD160 (rust-1.42.0-x86_64-unknown-freebsd.tar.gz) = 340f704051498f718a57b70e90a06cd259bfffc0 +SHA512 (rust-1.42.0-x86_64-unknown-freebsd.tar.gz) = f9dda7103adc60c8b7c096474be7615605fa9ddf15ae035702ee8d6628b359da45f448b872bfe64c4aa2a576ca61f149f8e526b5cb608fc41120263f1b4e138c +Size (rust-1.42.0-x86_64-unknown-freebsd.tar.gz) = 120581969 bytes +SHA1 (rust-1.42.0-x86_64-unknown-linux-gnu.tar.gz) = 9f8c44701393d8c536d35d1aed5b6c72d75c7865 +RMD160 (rust-1.42.0-x86_64-unknown-linux-gnu.tar.gz) = 099d892ec9013f3492c4c3056fe53ddec6a28638 +SHA512 (rust-1.42.0-x86_64-unknown-linux-gnu.tar.gz) = 924e6a814a04ecfd566427779429eb0b27beabe854569f2df6d3e768b8b88808e41ccb7dc26484b9dde3bccfe8dbbc2018b414008bd3bdc9e5f6dd51963757af +Size (rust-1.42.0-x86_64-unknown-linux-gnu.tar.gz) = 185229723 bytes +SHA1 (rust-1.42.0-x86_64-unknown-linux-musl.tar.gz) = ca2c0ab49fd4d3b6891efa33292643293dccaa3c +RMD160 (rust-1.42.0-x86_64-unknown-linux-musl.tar.gz) = 7e1ff0b7562f4bd3a994cd22173d906389db4d10 +SHA512 (rust-1.42.0-x86_64-unknown-linux-musl.tar.gz) = 30ecf6915e22c49ec67e5c613c07c445995a81eacd4399424ecbc28bcb010cd078ee85fb46aaa29c6707e94d1b8512db4a6cbeb9124fae9df56fc47a43d6710e +Size (rust-1.42.0-x86_64-unknown-linux-musl.tar.gz) = 144668656 bytes +SHA1 (rust-1.42.0-x86_64-unknown-netbsd.tar.gz) = da70b4b20d20baa675b3400ab18751cfcd5337a9 +RMD160 (rust-1.42.0-x86_64-unknown-netbsd.tar.gz) = 5856fbf266a33e16d1446d06a1729bcbd9027e35 +SHA512 (rust-1.42.0-x86_64-unknown-netbsd.tar.gz) = 849054ed8db2181e291652ecd3a927dbc42884d5c6796a0a4d72387b5e48f371d82426c418f6e5e09dfb4dc0fc185cbe5b9c39fe3d7e133ee8739b9f5327f325 +Size (rust-1.42.0-x86_64-unknown-netbsd.tar.gz) = 125750204 bytes +SHA1 (patch-install.sh) = 4dc4edcbda3c9d2b60ea51b5f83cadd5992ba786 diff --git a/lang/rust-bin/patches/patch-install.sh b/lang/rust-bin/patches/patch-install.sh new file mode 100644 index 00000000000..ca9af7ad80f --- /dev/null +++ b/lang/rust-bin/patches/patch-install.sh @@ -0,0 +1,24 @@ +$NetBSD: patch-install.sh,v 1.1 2020/05/18 16:17:21 nia Exp $ + +Fix installation paths for pkgsrc. + +--- install.sh.orig 2018-07-31 00:07:25.000000000 +0000 ++++ install.sh +@@ -562,7 +562,7 @@ install_components() { + if echo "$_file" | grep "^etc/" > /dev/null + then + local _f="$(echo "$_file" | sed 's/^etc\///')" +- _file_install_path="$CFG_SYSCONFDIR/$_f" ++ _file_install_path="$CFG_DESTDIR_PREFIX/share/doc/cargo/$_f" + fi + + if echo "$_file" | grep "^bin/" > /dev/null +@@ -586,7 +586,7 @@ install_components() { + if echo "$_file" | grep "^share/man/" > /dev/null + then + local _f="$(echo "$_file" | sed 's/^share\/man\///')" +- _file_install_path="$CFG_MANDIR/$_f" ++ _file_install_path="$CFG_DESTDIR_PREFIX/$PKGMANDIR/$_f" + fi + + # HACK: Try to support overriding --docdir. Paths with the form diff --git a/lang/rust/buildlink3.mk b/lang/rust/buildlink3.mk index 4339573d3e8..05a2de1f275 100644 --- a/lang/rust/buildlink3.mk +++ b/lang/rust/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.3 2017/09/30 04:42:43 ryoon Exp $ +# $NetBSD: buildlink3.mk,v 1.4 2020/05/18 16:17:20 nia Exp $ BUILDLINK_TREE+= rust @@ -6,7 +6,13 @@ BUILDLINK_TREE+= rust RUST_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.rust+= rust>=1.20.0 + +.include "../../lang/rust/type.mk" +.if ${RUST_TYPE} != "bin" BUILDLINK_PKGSRCDIR.rust?= ../../lang/rust +.else +BUILDLINK_PKGSRCDIR.rust?= ../../lang/rust-bin +.endif BUILDLINK_PASSTHRU_DIRS+= ${PREFIX}/lib/rustlib .endif diff --git a/lang/rust/cargo.mk b/lang/rust/cargo.mk index 82fc0f533c9..0da62a8b8c0 100644 --- a/lang/rust/cargo.mk +++ b/lang/rust/cargo.mk @@ -1,4 +1,4 @@ -# $NetBSD: cargo.mk,v 1.11 2020/01/19 16:53:10 maya Exp $ +# $NetBSD: cargo.mk,v 1.12 2020/05/18 16:17:20 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,7 +22,13 @@ 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 USE_TOOLS+= bsdtar digest CARGO_VENDOR_DIR= ${WRKDIR}/vendor diff --git a/lang/rust/type.mk b/lang/rust/type.mk new file mode 100644 index 00000000000..01b3236a13f --- /dev/null +++ b/lang/rust/type.mk @@ -0,0 +1,28 @@ +# $NetBSD: type.mk,v 1.1 2020/05/18 16:17:20 nia 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) |