diff options
author | he <he@pkgsrc.org> | 2021-06-12 20:43:41 +0000 |
---|---|---|
committer | he <he@pkgsrc.org> | 2021-06-12 20:43:41 +0000 |
commit | 7acffb3c0ac6819f7abade3b67a54c241aec2620 (patch) | |
tree | 55ff8f4aa0e7f3f73e88ad7d5921e1c0b978e434 /lang | |
parent | f0e3703a332a470ac64d67a3ab15d466821a3b26 (diff) | |
download | pkgsrc-7acffb3c0ac6819f7abade3b67a54c241aec2620.tar.gz |
Update the NetBSD binaries to ones not including the "docs" part.
Also, pull over the patched install.sh script from the main package,
for quite a lot faster installation, also for the benefit of the
upstream-delivered binaries. (Fix submitted upstream.)
Use the nb1 version suffix on the NetBSD binaries (one-time job for
1.52.1, to be removed on next go-around), but they still extract to
the non-nb1 work directory, so some adjustment needed for that.
Bump PKGREVISION.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/rust-bin/Makefile | 37 | ||||
-rw-r--r-- | lang/rust-bin/distinfo | 46 | ||||
-rwxr-xr-x | lang/rust-bin/files/install.sh | 971 | ||||
-rw-r--r-- | lang/rust-bin/patches/patch-install.sh | 24 |
4 files changed, 1020 insertions, 58 deletions
diff --git a/lang/rust-bin/Makefile b/lang/rust-bin/Makefile index aa732ab8de8..a899601d202 100644 --- a/lang/rust-bin/Makefile +++ b/lang/rust-bin/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.21 2021/06/12 09:10:53 nia Exp $ +# $NetBSD: Makefile,v 1.22 2021/06/12 20:43:41 he Exp $ DISTNAME= rust-1.52.1 PKGNAME= ${DISTNAME:S/rust/rust-bin/1} +PKGREVISION= 1 CATEGORIES= lang MASTER_SITES= https://static.rust-lang.org/dist/ DIST_SUBDIR= ${PKGNAME_NOREV} @@ -91,42 +92,52 @@ DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz .if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64) || make(distinfo) || make(makesum) || make(mdi) RUST_ARCH:= aarch64-unknown-netbsd -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} .endif .if !empty(MACHINE_PLATFORM:MNetBSD-*-earmv7hf) || make(distinfo) || make(makesum) || make(mdi) RUST_ARCH:= armv7-unknown-netbsd-eabihf -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} .endif .if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || make(distinfo) || make(makesum) || make(mdi) RUST_ARCH:= i586-unknown-netbsd -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} .endif .if !empty(MACHINE_PLATFORM:MNetBSD-*-powerpc) || make(distinfo) || make(makesum) || make(mdi) RUST_ARCH:= powerpc-unknown-netbsd90 -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} . if !empty(OS_VERSION:M8.*) RUST_ARCH:= powerpc-unknown-netbsd -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} . endif .endif .if !empty(MACHINE_PLATFORM:MNetBSD-*-sparc64) || make(distinfo) || make(makesum) || make(mdi) RUST_ARCH:= sparc64-unknown-netbsd -DISTFILES:= ${DISTFILES} ${DISTNAME}-${RUST_ARCH}.tar.gz -SITES.${DISTNAME}-${RUST_ARCH}.tar.gz= \ +DN:= ${DISTNAME}nb${PKGREVISION} +DISTFILES:= ${DISTFILES} ${DN}-${RUST_ARCH}.tar.gz +SITES.${DN}-${RUST_ARCH}.tar.gz= \ ${NETBSD_REPO} .endif +# Binary still extracts to plain non-nb'ed directory +WRKSRC:= ${WRKSRC:C/nb[0-9]*//} + do-install: + cd ${.CURDIR}/files; pax -rw install.sh ${WRKSRC} cd ${WRKSRC} && env PKGMANDIR=${PKGMANDIR} bash ./install.sh \ --destdir=${DESTDIR} --prefix=${PREFIX} ${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/${RUST_ARCH}/bin/rust-llvm-dwp diff --git a/lang/rust-bin/distinfo b/lang/rust-bin/distinfo index 574eccb83eb..c70655fe7c0 100644 --- a/lang/rust-bin/distinfo +++ b/lang/rust-bin/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2021/06/12 09:10:53 nia Exp $ +$NetBSD: distinfo,v 1.10 2021/06/12 20:43:41 he Exp $ SHA1 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-gnu.tar.gz) = ed140baee577a96b162a163f07f13b37229eda8e RMD160 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-gnu.tar.gz) = 84eeea0d870663d092ca5666fc21237ce8fa8628 @@ -8,30 +8,10 @@ SHA1 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-musl.tar.gz) = 37107ca39 RMD160 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-musl.tar.gz) = e3c6ea628f544c9039d7861d2c284f01552d08ed SHA512 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-musl.tar.gz) = 53fb5d85664ca65ad021706fe1a072e91689ceacb23c2531ac404b146fcbc195546bd9a4c7b660d3cd21f4aea0d7ff04c9946ec0aa2febaa53ea314589f85ea8 Size (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-linux-musl.tar.gz) = 327097199 bytes -SHA1 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-netbsd.tar.gz) = bf0893cf5ce90431f317585078e630b3d3d2d8ca -RMD160 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-netbsd.tar.gz) = 2111acc0a157b61225d67ebdf28d843fcd1fe31d -SHA512 (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-netbsd.tar.gz) = 8ae86a711756cfb5ea58095e7aa2b0ca9e5548da62b703f8e30847b4543035a461594a14a8b791b21d06f5109d6ceea128f6262221350e0fa24a9f62e66cf719 -Size (rust-bin-1.52.1/rust-1.52.1-aarch64-unknown-netbsd.tar.gz) = 292520308 bytes -SHA1 (rust-bin-1.52.1/rust-1.52.1-armv7-unknown-netbsd-eabihf.tar.gz) = 54fc1e53a1876006d10f9b6e5d136e3e7506a727 -RMD160 (rust-bin-1.52.1/rust-1.52.1-armv7-unknown-netbsd-eabihf.tar.gz) = 27c190370f1000ccd7171c9d049d71279ebc7947 -SHA512 (rust-bin-1.52.1/rust-1.52.1-armv7-unknown-netbsd-eabihf.tar.gz) = 858161a6814f42807af54a746a29ed72f8a7c8dc835c129e95f36e395dfbd0adaf23a8a80749b46d147cca063d1344206675eca060bac391ba04d5c87b5cdd1b -Size (rust-bin-1.52.1/rust-1.52.1-armv7-unknown-netbsd-eabihf.tar.gz) = 262615033 bytes -SHA1 (rust-bin-1.52.1/rust-1.52.1-i586-unknown-netbsd.tar.gz) = e881f30abeac680e2ab4003bf10644f42ab209d6 -RMD160 (rust-bin-1.52.1/rust-1.52.1-i586-unknown-netbsd.tar.gz) = ea6d0aeaba69e5b4ec9fb7f734baf026d8cfebf2 -SHA512 (rust-bin-1.52.1/rust-1.52.1-i586-unknown-netbsd.tar.gz) = 835028d58b64140619d72561e989f13dba20fc1c89dcb67bdf0b013952832e92904b2a5e8f48104dd835b5f3037565828dc1708c26ba43c403bedcd0fea6fb7e -Size (rust-bin-1.52.1/rust-1.52.1-i586-unknown-netbsd.tar.gz) = 310872131 bytes SHA1 (rust-bin-1.52.1/rust-1.52.1-i686-unknown-linux-gnu.tar.gz) = 9f02af06cfd735305be5c29d584e555bc57172e7 RMD160 (rust-bin-1.52.1/rust-1.52.1-i686-unknown-linux-gnu.tar.gz) = 64d94d3bfffeb6617ff2f64d60143e56ae584450 SHA512 (rust-bin-1.52.1/rust-1.52.1-i686-unknown-linux-gnu.tar.gz) = 335336cbf935cdfd3da3823f5523fbea54dc5658f7235fc0f14cb22947de435dc29d78bc80a8eb599caa66c6593494796743d8fb0ec58bbcbbfea2d1e8c7f16a Size (rust-bin-1.52.1/rust-1.52.1-i686-unknown-linux-gnu.tar.gz) = 353110704 bytes -SHA1 (rust-bin-1.52.1/rust-1.52.1-powerpc-unknown-netbsd90.tar.gz) = b45d3192e275297c844117b9d615f2ac55730640 -RMD160 (rust-bin-1.52.1/rust-1.52.1-powerpc-unknown-netbsd90.tar.gz) = 787f30b61573ef4ef1255c6b552b200a5cafa2a4 -SHA512 (rust-bin-1.52.1/rust-1.52.1-powerpc-unknown-netbsd90.tar.gz) = f765b3b4dde602aa1032f58fa505cf8900a3d1b7d90c9347d2129efa6ea9311a499adc0dc2578723b9234d6f27aa2c9acdb4aff65208a6ced0580a97c7874efb -Size (rust-bin-1.52.1/rust-1.52.1-powerpc-unknown-netbsd90.tar.gz) = 329947399 bytes -SHA1 (rust-bin-1.52.1/rust-1.52.1-sparc64-unknown-netbsd.tar.gz) = 97f71cbebf4f6828323d541c1d89ab68632b7678 -RMD160 (rust-bin-1.52.1/rust-1.52.1-sparc64-unknown-netbsd.tar.gz) = 2983cc880b7fa14cef2cd9dc70ca2cfd16119be5 -SHA512 (rust-bin-1.52.1/rust-1.52.1-sparc64-unknown-netbsd.tar.gz) = e3804bfa6a082ac209eb75f3a43925f24e31be22e0c4e15992639dbc9d2b6f23b42755c5e76f8cd35531463a217f58fdf63463fe57ba464fcefecb4b6f9b4c0b -Size (rust-bin-1.52.1/rust-1.52.1-sparc64-unknown-netbsd.tar.gz) = 305837361 bytes SHA1 (rust-bin-1.52.1/rust-1.52.1-x86_64-apple-darwin.tar.gz) = da14a9222e1c83319c21811c2e29b4957a808ff4 RMD160 (rust-bin-1.52.1/rust-1.52.1-x86_64-apple-darwin.tar.gz) = eb4c0205e6ecde8046a56098e94854d0f38dd68e SHA512 (rust-bin-1.52.1/rust-1.52.1-x86_64-apple-darwin.tar.gz) = aade41eab3a6cb975d2a9f2420757dfe656b35c5590f1e11bd4f16cd22e2981fde9656178d7050993aa0c153e792aa7a97d4778727c1f387432c72120b24169e @@ -52,4 +32,28 @@ SHA1 (rust-bin-1.52.1/rust-1.52.1-x86_64-unknown-netbsd.tar.gz) = 5dc3b8c124615a RMD160 (rust-bin-1.52.1/rust-1.52.1-x86_64-unknown-netbsd.tar.gz) = 3d40e80290be1bd84881c5fb450a75b5c036fc89 SHA512 (rust-bin-1.52.1/rust-1.52.1-x86_64-unknown-netbsd.tar.gz) = 249177e68fdda71d546250e497585785a6ccbec84ed459076e4ab00abe6ad851e399baa7a125f63ea9a232abc597b6454b731bae433d64fcbf755757712dbd18 Size (rust-bin-1.52.1/rust-1.52.1-x86_64-unknown-netbsd.tar.gz) = 263726416 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-aarch64-unknown-netbsd.tar.gz) = c7b918498f7d45bd55cf49e7856321f8523b632e +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-aarch64-unknown-netbsd.tar.gz) = 86efe4b8676e1ccfc188d4229640a1a0cd726496 +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-aarch64-unknown-netbsd.tar.gz) = e0205156c81bbc8b96c6618b9caa6b1352b8373bd9c985076b7255658cf0c42d1a68c39053c63aa6616ad775b544a7aaab740b948080176ddabbe04c2ed5849a +Size (rust-bin-1.52.1/rust-1.52.1nb1-aarch64-unknown-netbsd.tar.gz) = 239658624 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-armv7-unknown-netbsd-eabihf.tar.gz) = a620cb984e18539561fef38d871860f3d927bae1 +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-armv7-unknown-netbsd-eabihf.tar.gz) = 3c1c2cf9c38454c330e3d4edef5c6caefa154976 +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-armv7-unknown-netbsd-eabihf.tar.gz) = 9281b41d2c10abf9fd4a19eee50c9d08bee5974ee4c9759b706e9087f5e5e124a27ba290ce0784d6095939501a318a0c8c8e2b9b73167e23ab7457adc0a93e3d +Size (rust-bin-1.52.1/rust-1.52.1nb1-armv7-unknown-netbsd-eabihf.tar.gz) = 209595846 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-i586-unknown-netbsd.tar.gz) = 89aa576964b0a9b6574bb9dab855c69f9448fd67 +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-i586-unknown-netbsd.tar.gz) = 50909e13bd907678c01095a5021c8ae12d686143 +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-i586-unknown-netbsd.tar.gz) = 847d100ac7a60c2ddbcc02917d181b0fae80dd93d34cbfce879c99d3bc8b9501d35bbd36f65b5ddc4e67696b6e60f814e53abf7af6159262084caf9660cbd799 +Size (rust-bin-1.52.1/rust-1.52.1nb1-i586-unknown-netbsd.tar.gz) = 258075867 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd.tar.gz) = f811b465bfc35b5a1078f876bab7b5f654f22465 +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd.tar.gz) = f580a4d9e36ca875a39ce643848b39c239ff41a1 +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd.tar.gz) = f22a52bc0812da42678c3bf22a194acefdf9ae677700a47bd4c75ca14f83f930d417865d9cef08b5830d05c9ca59e0ae7c4e72270de9fc7a259b43c1370ec801 +Size (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd.tar.gz) = 271857078 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd90.tar.gz) = 3f2e87796d505ed9b7a85e773cd03496ef1e9823 +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd90.tar.gz) = e60ea885d1f8eb61d63243e32f24673406f6c42e +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd90.tar.gz) = 480a2075e2cb75aade32d82689c2c4e3b47c0afb9dbb5d48b134187beaad356c4f40936f83800ad5c16f54058b85c7ff17bed3ae8e6b8c027fe2e3e3cb3a61fc +Size (rust-bin-1.52.1/rust-1.52.1nb1-powerpc-unknown-netbsd90.tar.gz) = 277174470 bytes +SHA1 (rust-bin-1.52.1/rust-1.52.1nb1-sparc64-unknown-netbsd.tar.gz) = ffd0edec58f7a02ebb195fb28ebf590e24a67236 +RMD160 (rust-bin-1.52.1/rust-1.52.1nb1-sparc64-unknown-netbsd.tar.gz) = 7f6aaf7c8207b061bdf258cede8e9a1cc9b82647 +SHA512 (rust-bin-1.52.1/rust-1.52.1nb1-sparc64-unknown-netbsd.tar.gz) = 5602c5a00b4cacb254fea76fcd346f0c4ff4aec6b317e760870252048e444440e501c219278e6b37da71a26cce2a598c97be9b99e9bf3b30cae177004c79b355 +Size (rust-bin-1.52.1/rust-1.52.1nb1-sparc64-unknown-netbsd.tar.gz) = 253026549 bytes SHA1 (patch-install.sh) = 4dc4edcbda3c9d2b60ea51b5f83cadd5992ba786 diff --git a/lang/rust-bin/files/install.sh b/lang/rust-bin/files/install.sh new file mode 100755 index 00000000000..c8e88a4c7eb --- /dev/null +++ b/lang/rust-bin/files/install.sh @@ -0,0 +1,971 @@ +#!/bin/bash +# Copyright 2014 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# No undefined variables +set -u + +init_logging() { + local _abs_libdir="$1" + local _logfile="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/install.log" + LOGFILE="$_logfile" +} + +log_line() { + local _line="$1" + +} + +msg() { + local _line="install: ${1-}" + echo "$_line" + log_line "$_line" +} + +verbose_msg() { + if [ -n "${CFG_VERBOSE-}" ]; then + msg "${1-}" + else + log_line "install: ${1-}" + fi +} + +step_msg() { + msg + msg "$1" + msg +} + +verbose_step_msg() { + if [ -n "${CFG_VERBOSE-}" ]; then + msg + msg "$1" + msg + else + log_line "" + log_line "install: $1" + log_line "" + fi +} + +warn() { + local _line="install: WARNING: $1" + echo "$_line" >&2 + log_line "$_line" +} + +err() { + local _line="install: error: $1" + echo "$_line" >&2 + log_line "$_line" + exit 1 +} + +# A non-user error that is likely to result in a corrupted install +critical_err() { + local _line="install: error: $1. see logs at '${LOGFILE-}'" + echo "$_line" >&2 + log_line "$_line" + exit 1 +} + +need_ok() { + if [ $? -ne 0 ] + then + err "$1" + fi +} + +critical_need_ok() { + if [ $? -ne 0 ] + then + critical_err "$1" + fi +} + +want_ok() { + if [ $? -ne 0 ]; then + warn "$1" + fi +} + +assert_nz() { + if [ -z "$1" ]; then err "assert_nz $2"; fi +} + +need_cmd() { + if command -v $1 >/dev/null 2>&1 + then verbose_msg "found $1" + else err "need $1" + fi +} + +run() { + local _line="\$ $*" + "$@" + local _retval=$? + log_line "$_line" + return $_retval +} + +write_to_file() { + local _msg="$1" + local _file="$2" + local _line="$ echo \"$_msg\" > \"$_file\"" + echo "$_msg" > "$_file" + local _retval=$? + log_line "$_line" + return $_retval +} + +append_to_file() { + local _msg="$1" + local _file="$2" + local _line="$ echo \"$_msg\" >> \"$_file\"" + echo "$_msg" >> "$_file" + local _retval=$? + log_line "$_line" + return $_retval +} + +make_dir_recursive() { + local _dir="$1" + local _line="$ umask 022 && mkdir -p \"$_dir\"" + umask 022 && mkdir -p "$_dir" + local _retval=$? + log_line "$_line" + return $_retval +} + +putvar() { + local t + local tlen + eval t=\$$1 + eval tlen=\${#$1} +} + +valopt() { + VAL_OPTIONS="$VAL_OPTIONS $1" + + local op=$1 + local default=$2 + shift + shift + local doc="$*" + if [ $HELP -eq 0 ] + then + local uop=$(echo $op | tr 'a-z-' 'A-Z_') + local v="CFG_${uop}" + eval $v="$default" + for arg in $CFG_ARGS + do + if echo "$arg" | grep -q -- "--$op=" + then + local val=$(echo "$arg" | cut -f2 -d=) + eval $v=$val + fi + done + putvar $v + else + if [ -z "$default" ] + then + default="<none>" + fi + op="${op}=[${default}]" + printf " --%-30s %s\n" "$op" "$doc" + fi +} + +opt() { + BOOL_OPTIONS="$BOOL_OPTIONS $1" + + local op=$1 + local default=$2 + shift + shift + local doc="$*" + local flag="" + + if [ $default -eq 0 ] + then + flag="enable" + else + flag="disable" + doc="don't $doc" + fi + + if [ $HELP -eq 0 ] + then + for arg in $CFG_ARGS + do + if [ "$arg" = "--${flag}-${op}" ] + then + op=$(echo $op | tr 'a-z-' 'A-Z_') + flag=$(echo $flag | tr 'a-z' 'A-Z') + local v="CFG_${flag}_${op}" + eval $v=1 + putvar $v + fi + done + else + if [ ! -z "${META-}" ] + then + op="$op=<$META>" + fi + printf " --%-30s %s\n" "$flag-$op" "$doc" + fi +} + +flag() { + BOOL_OPTIONS="$BOOL_OPTIONS $1" + + local op=$1 + shift + local doc="$*" + + if [ $HELP -eq 0 ] + then + for arg in $CFG_ARGS + do + if [ "$arg" = "--${op}" ] + then + op=$(echo $op | tr 'a-z-' 'A-Z_') + local v="CFG_${op}" + eval $v=1 + putvar $v + fi + done + else + if [ ! -z "${META-}" ] + then + op="$op=<$META>" + fi + printf " --%-30s %s\n" "$op" "$doc" + fi +} + +validate_opt () { + for arg in $CFG_ARGS + do + local is_arg_valid=0 + for option in $BOOL_OPTIONS + do + if test --disable-$option = $arg + then + is_arg_valid=1 + fi + if test --enable-$option = $arg + then + is_arg_valid=1 + fi + if test --$option = $arg + then + is_arg_valid=1 + fi + done + for option in $VAL_OPTIONS + do + if echo "$arg" | grep -q -- "--$option=" + then + is_arg_valid=1 + fi + done + if [ "$arg" = "--help" ] + then + echo + echo "No more help available for Configure options," + echo "check the Wiki or join our IRC channel" + break + else + if test $is_arg_valid -eq 0 + then + err "Option '$arg' is not recognized" + fi + fi + done +} + +absolutify() { + local file_path="$1" + local file_path_dirname="$(dirname "$file_path")" + local file_path_basename="$(basename "$file_path")" + local file_abs_path="$(abs_path "$file_path_dirname")" + local file_path="$file_abs_path/$file_path_basename" + # This is the return value + RETVAL="$file_path" +} + +# Prints the absolute path of a directory to stdout +abs_path() { + local path="$1" + # Unset CDPATH because it causes havok: it makes the destination unpredictable + # and triggers 'cd' to print the path to stdout. Route `cd`'s output to /dev/null + # for good measure. + (unset CDPATH && cd "$path" > /dev/null && pwd) +} + +uninstall_legacy() { + local _abs_libdir="$1" + + local _uninstalled_something=false + + # Replace commas in legacy manifest list with spaces + _legacy_manifest_dirs=`echo "$TEMPLATE_LEGACY_MANIFEST_DIRS" | sed "s/,/ /g"` + + # Uninstall from legacy manifests + local _md + for _md in $_legacy_manifest_dirs; do + # First, uninstall from the installation prefix. + # Errors are warnings - try to rm everything in the manifest even if some fail. + if [ -f "$_abs_libdir/$_md/manifest" ] + then + + # iterate through installed manifest and remove files + local _p; + while read _p; do + # the installed manifest contains absolute paths + msg "removing legacy file $_p" + if [ -f "$_p" ] + then + run rm -f "$_p" + want_ok "failed to remove $_p" + else + warn "supposedly installed file $_p does not exist!" + fi + done < "$_abs_libdir/$_md/manifest" + + # If we fail to remove $md below, then the + # installed manifest will still be full; the installed manifest + # needs to be empty before install. + msg "removing legacy manifest $_abs_libdir/$_md/manifest" + run rm -f "$_abs_libdir/$_md/manifest" + # For the above reason, this is a hard error + need_ok "failed to remove installed manifest" + + # Remove $template_rel_manifest_dir directory + msg "removing legacy manifest dir $_abs_libdir/$_md" + run rm -R "$_abs_libdir/$_md" + want_ok "failed to remove $_md" + + _uninstalled_something=true + fi + done + + RETVAL="$_uninstalled_something" +} + +uninstall_components() { + local _abs_libdir="$1" + local _dest_prefix="$2" + local _components="$3" + + # We're going to start by uninstalling existing components. This + local _uninstalled_something=false + + # First, try removing any 'legacy' manifests from before + # rust-installer + uninstall_legacy "$_abs_libdir" + assert_nz "$RETVAL", "RETVAL" + if [ "$RETVAL" = true ]; then + _uninstalled_something=true; + fi + + # Load the version of the installed installer + local _installed_version= + if [ -f "$abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/rust-installer-version" ]; then + _installed_version=`cat "$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/rust-installer-version"` + + # Sanity check + if [ ! -n "$_installed_version" ]; then critical_err "rust installer version is empty"; fi + fi + + # If there's something installed, then uninstall + if [ -n "$_installed_version" ]; then + # Check the version of the installed installer + case "$_installed_version" in + + # If this is a previous version, then upgrade in place to the + # current version before uninstalling. + 2 ) + # The only change between version 2 -> 3 is that components are placed + # in subdirectories of the installer tarball. There are no changes + # to the installed data format, so nothing to do. + ;; + + # This is the current version. Nothing need to be done except uninstall. + "$TEMPLATE_RUST_INSTALLER_VERSION") + ;; + + # If this is an unknown (future) version then bail. + * ) + echo "The copy of $TEMPLATE_PRODUCT_NAME at $_dest_prefix was installed using an" + echo "unknown version ($_installed_version) of rust-installer." + echo "Uninstall it first with the installer used for the original installation" + echo "before continuing." + exit 1 + ;; + esac + + local _md="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR" + local _installed_components="$(cat "$_md/components")" + + # Uninstall (our components only) before reinstalling + local _available_component + for _available_component in $_components; do + local _installed_component + for _installed_component in $_installed_components; do + if [ "$_available_component" = "$_installed_component" ]; then + msg "uninstalling component '$_available_component'" + local _component_manifest="$_md/manifest-$_installed_component" + + # Sanity check: there should be a component manifest + if [ ! -f "$_component_manifest" ]; then + critical_err "installed component '$_installed_component' has no manifest" + fi + + # Iterate through installed component manifest and remove files + local _directive + while read _directive; do + + local _command=${_directive%%:*} + local _file=${_directive#*:} + + # Sanity checks + if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi + if [ ! -n "$_file" ]; then critical_err "malformed installation directive"; fi + + case "$_command" in + file) + verbose_msg "removing file $_file" + if [ -f "$_file" ]; then + run rm -f "$_file" + want_ok "failed to remove $_file" + else + warn "supposedly installed file $_file does not exist!" + fi + ;; + + dir) + verbose_msg "removing directory $_file" + run rm -r "$_file" + want_ok "unable to remove directory $_file" + ;; + + *) + critical_err "unknown installation directive" + ;; + esac + + done < "$_component_manifest" + + # Remove the installed component manifest + verbose_msg "removing component manifest $_component_manifest" + run rm "$_component_manifest" + # This is a hard error because the installation is unrecoverable + critical_need_ok "failed to remove installed manifest for component '$_installed_component'" + + # Update the installed component list + local _modified_components="$(sed "/^$_installed_component\$/d" "$_md/components")" + write_to_file "$_modified_components" "$_md/components" + critical_need_ok "failed to update installed component list" + fi + done + done + + # If there are no remaining components delete the manifest directory, + # but only if we're doing an uninstall - if we're doing an install, + # then leave the manifest directory around to hang onto the logs, + # and any files not managed by the installer. + if [ -n "${CFG_UNINSTALL-}" ]; then + local _remaining_components="$(cat "$_md/components")" + if [ ! -n "$_remaining_components" ]; then + verbose_msg "removing manifest directory $_md" + run rm -r "$_md" + want_ok "failed to remove $_md" + + maybe_unconfigure_ld + fi + fi + + _uninstalled_something=true + fi + + # There's no installed version. If we were asked to uninstall, then that's a problem. + if [ -n "${CFG_UNINSTALL-}" -a "$_uninstalled_something" = false ] + then + err "unable to find installation manifest at $CFG_LIBDIR/$TEMPLATE_REL_MANIFEST_DIR" + fi +} + +install_components() { + local _src_dir="$1" + local _abs_libdir="$2" + local _dest_prefix="$3" + local _components="$4" + + local _component + for _component in $_components; do + + msg "installing component '$_component'" + + # The file name of the manifest we're installing from + local _input_manifest="$_src_dir/$_component/manifest.in" + + # Sanity check: do we have our input manifests? + if [ ! -f "$_input_manifest" ]; then + critical_err "manifest for $_component does not exist at $_input_manifest" + fi + + # The installed manifest directory + local _md="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR" + + # The file name of the manifest we're going to create during install + local _installed_manifest="$_md/manifest-$_component" + + # Create the installed manifest, which we will fill in with absolute file paths + touch "$_installed_manifest" + critical_need_ok "failed to create installed manifest" + + # Add this component to the installed component list + append_to_file "$_component" "$_md/components" + critical_need_ok "failed to update components list for $_component" + + # Now install, iterate through the new manifest and copy files + local _directive + while read _directive; do + + local _command=${_directive%%:*} + local _file=${_directive#*:} + + # Sanity checks + if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi + if [ ! -n "$_file" ]; then critical_err "malformed installation directive"; fi + + # Decide the destination of the file + local _file_install_path="$_dest_prefix/$_file" + + case "$_file" in + etc/*) + local _f=${_file#"etc/"} + _file_install_path="$CFG_DESTDIR_PREFIX/share/doc/cargo/$_f" + ;; + bin/*) + local _f=${_file#"bin/"} + _file_install_path="$CFG_BINDIR/$_f" + ;; + lib/*) + local _f=${_file#"lib/"} + _file_install_path="$CFG_LIBDIR/$_f" + ;; + share/man/*) + local _f=${_file#"share/man/"} + _file_install_path="$CFG_DESTDIR_PREFIX/$PKGMANDIR/$_f" + ;; + share/doc/*) + # HACK: Try to support overriding --docdir. Paths with the form + # "share/doc/$product/" can be redirected to a single --docdir + # path. If the following detects that --docdir has been specified + # then it will replace everything preceeding the "$product" path + # component. The problem here is that the combined rust installer + # contains two "products": rust and cargo; so the contents of those + # directories will both be dumped into the same directory; and the + # contents of those directories are _not_ disjoint. Since this feature + # is almost entirely to support 'make install' anyway I don't expect + # this problem to be a big deal in practice. + if [ "$CFG_DOCDIR" != "<default>" ]; then + local _f=${_file#"share/doc/"} + _file_install_path="$CFG_DOCDIR/$_f" + fi + ;; + share/*) + local _f=${_file#"share/"} + _file_install_path="$CFG_DATADIR/$_f" + ;; + esac + + + # Make sure there's a directory for it + make_dir_recursive "$(dirname "$_file_install_path")" + critical_need_ok "directory creation failed" + + # Make the path absolute so we can uninstall it later without + # starting from the installation cwd + absolutify "$_file_install_path" + _file_install_path="$RETVAL" + assert_nz "$_file_install_path" "file_install_path" + + case "$_command" in + file ) + + verbose_msg "copying file $_file_install_path" + + maybe_backup_path "$_file_install_path" + + local mode=644 + if test -x "$_src_dir/$_component/$_file"; then + mode=755 + fi + case "$_file" in + bin/*) mode=755 + ;; + esac + run cp "$_src_dir/$_component/$_file" "$_file_install_path" + run chmod $mode "$_file_install_path" + critical_need_ok "file creation failed" + + # Update the manifest + append_to_file "file:$_file_install_path" "$_installed_manifest" + critical_need_ok "failed to update manifest" + + ;; + + dir ) + + verbose_msg "copying directory $_file_install_path" + + maybe_backup_path "$_file_install_path" + + run cp -R "$_src_dir/$_component/$_file" "$_file_install_path" + critical_need_ok "failed to copy directory" + + # Set permissions. 0755 for dirs, 644 for files + run chmod -R u+rwX,go+rX,go-w "$_file_install_path" + critical_need_ok "failed to set permissions on directory" + + # Update the manifest + append_to_file "dir:$_file_install_path" "$_installed_manifest" + critical_need_ok "failed to update manifest" + ;; + + *) + critical_err "unknown installation directive" + ;; + esac + done < "$_input_manifest" + + done +} + +maybe_configure_ld() { + local _abs_libdir="$1" + + local _ostype="$(uname -s)" + assert_nz "$_ostype" "ostype" + + if [ "$_ostype" = "Linux" -a ! -n "${CFG_DISABLE_LDCONFIG-}" ]; then + + # Fedora-based systems do not configure the dynamic linker to look + # /usr/local/lib, which is our default installation directory. To + # make things just work, try to put that directory in + # /etc/ld.so.conf.d/rust-installer-v1 so ldconfig picks it up. + # Issue #30. + # + # This will get rm'd when the last component is uninstalled in + # maybe_unconfigure_ld. + if [ "$_abs_libdir" = "/usr/local/lib" -a -d "/etc/ld.so.conf.d" ]; then + echo "$_abs_libdir" > "/etc/ld.so.conf.d/rust-installer-v1-$TEMPLATE_REL_MANIFEST_DIR.conf" + if [ $? -ne 0 ]; then + # This shouldn't happen if we've gotten this far + # installing to /usr/local + warn "failed to update /etc/ld.so.conf.d. this is unexpected" + fi + fi + + verbose_msg "running ldconfig" + if [ -n "${CFG_VERBOSE-}" ]; then + ldconfig + else + ldconfig 2> /dev/null + fi + if [ $? -ne 0 ] + then + warn "failed to run ldconfig. this may happen when not installing as root. run with --verbose to see the error" + fi + fi +} + +maybe_unconfigure_ld() { + local _ostype="$(uname -s)" + assert_nz "$_ostype" "ostype" + + if [ "$_ostype" != "Linux" ]; then + return 0 + fi + + rm "/etc/ld.so.conf.d/rust-installer-v1-$TEMPLATE_REL_MANIFEST_DIR.conf" 2> /dev/null + # Above may fail since that file may not have been created on install +} + +# Doing our own 'install'-like backup that is consistent across platforms +maybe_backup_path() { + local _file_install_path="$1" + + if [ -e "$_file_install_path" ]; then + msg "backing up existing file at $_file_install_path" + run mv -f "$_file_install_path" "$_file_install_path.old" + critical_need_ok "failed to back up $_file_install_path" + fi +} + +install_uninstaller() { + local _src_dir="$1" + local _src_basename="$2" + local _abs_libdir="$3" + + local _uninstaller="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/uninstall.sh" + msg "creating uninstall script at $_uninstaller" + run cp "$_src_dir/$_src_basename" "$_uninstaller" + critical_need_ok "unable to install uninstaller" +} + +do_preflight_sanity_checks() { + local _src_dir="$1" + local _dest_prefix="$2" + + # Sanity check: can we can write to the destination? + verbose_msg "verifying destination is writable" + make_dir_recursive "$CFG_LIBDIR" + need_ok "can't write to destination. consider \`sudo\`." + touch "$CFG_LIBDIR/rust-install-probe" > /dev/null + if [ $? -ne 0 ] + then + err "can't write to destination. consider \`sudo\`." + fi + rm "$CFG_LIBDIR/rust-install-probe" + need_ok "failed to remove install probe" + + # Sanity check: don't install to the directory containing the installer. + # That would surely cause chaos. + verbose_msg "verifying destination is not the same as source" + local _prefix_dir="$(abs_path "$dest_prefix")" + if [ "$_src_dir" = "$_dest_prefix" -a "${CFG_UNINSTALL-}" != 1 ]; then + err "cannot install to same directory as installer" + fi +} + +verbose_msg "looking for install programs" +verbose_msg + +need_cmd mkdir +need_cmd printf +need_cmd cut +need_cmd grep +need_cmd uname +need_cmd tr +need_cmd sed +need_cmd chmod +need_cmd env +need_cmd pwd + +CFG_ARGS="${@:-}" + +HELP=0 +if [ "${1-}" = "--help" ] +then + HELP=1 + shift + echo + echo "Usage: $0 [options]" + echo + echo "Options:" + echo +else + verbose_step_msg "processing arguments" +fi + +OPTIONS="" +BOOL_OPTIONS="" +VAL_OPTIONS="" + +flag uninstall "only uninstall from the installation prefix" +valopt destdir "" "set installation root" +valopt prefix "/usr/local" "set installation prefix" + +# Avoid prepending an extra / to the prefix path if there's no destdir +# NB: CFG vars here are undefined when passing --help +if [ -z "${CFG_DESTDIR-}" ]; then + CFG_DESTDIR_PREFIX="${CFG_PREFIX-}" +else + CFG_DESTDIR_PREFIX="$CFG_DESTDIR/$CFG_PREFIX" +fi + +# NB This isn't quite the same definition as in `configure`. +# just using 'lib' instead of configure's CFG_LIBDIR_RELATIVE +valopt without "" "comma-separated list of components to not install" +valopt components "" "comma-separated list of components to install" +flag list-components "list available components" +valopt sysconfdir "$CFG_DESTDIR_PREFIX/etc" "install system configuration files" +valopt bindir "$CFG_DESTDIR_PREFIX/bin" "install binaries" +valopt libdir "$CFG_DESTDIR_PREFIX/lib" "install libraries" +valopt datadir "$CFG_DESTDIR_PREFIX/share" "install data" +# NB We repeat datadir default value because we don't set CFG_DATADIR in --help +valopt mandir "${CFG_DATADIR-"$CFG_DESTDIR_PREFIX/share"}/man" "install man pages in PATH" +# NB See the docdir handling in install_components for an explanation of this +# weird <default> string +valopt docdir "\<default\>" "install documentation in PATH" +opt ldconfig 1 "run ldconfig after installation (Linux only)" +opt verify 1 "obsolete" +flag verbose "run with verbose output" + +if [ $HELP -eq 1 ] +then + echo + exit 0 +fi + +verbose_step_msg "validating arguments" +validate_opt + +# Template configuration. +# These names surrounded by '%%` are replaced by sed when generating install.sh +# FIXME: Might want to consider loading this from a file and not generating install.sh + +# Rust or Cargo +TEMPLATE_PRODUCT_NAME='Rust' +# rustlib or cargo +TEMPLATE_REL_MANIFEST_DIR=rustlib +# 'Rust is ready to roll.' or 'Cargo is cool to cruise.' +TEMPLATE_SUCCESS_MESSAGE='rust installed.' +# Locations to look for directories containing legacy, pre-versioned manifests +TEMPLATE_LEGACY_MANIFEST_DIRS='rustlib,cargo' +# The installer version +TEMPLATE_RUST_INSTALLER_VERSION='3' + +# OK, let's get installing ... + +# This is where we are installing from +src_dir="$(abs_path $(dirname "$0"))" + +# The name of the script +src_basename="$(basename "$0")" + +# If we've been run as 'uninstall.sh' (from the existing installation) +# then we're doing a full uninstall, as opposed to the --uninstall flag +# which just means 'uninstall my components'. +if [ "$src_basename" = "uninstall.sh" ]; then + if [ "${*:-}" != "" ]; then + # Currently don't know what to do with arguments in this mode + err "uninstall.sh does not take any arguments" + fi + CFG_UNINSTALL=1 + CFG_DESTDIR_PREFIX="$(abs_path "$src_dir/../../")" + CFG_LIBDIR="$(abs_path "$src_dir/../")" +fi + +# This is where we are installing to +dest_prefix="$CFG_DESTDIR_PREFIX" + +# Open the components file to get the list of components to install. +# NB: During install this components file is read from the installer's +# source dir, during a full uninstall it's read from the manifest dir, +# and thus contains all installed components. +components=`cat "$src_dir/components"` + +# Sanity check: do we have components? +if [ ! -n "$components" ]; then + err "unable to find installation components" +fi + +# If the user asked for a component list, do that and exit +if [ -n "${CFG_LIST_COMPONENTS-}" ]; then + echo + echo "# Available components" + echo + for component in $components; do + echo "* $component" + done + echo + exit 0 +fi + +# If the user specified which components to install/uninstall, +# then validate that they exist and select them for installation +if [ -n "$CFG_COMPONENTS" ]; then + # Remove commas + user_components="$(echo "$CFG_COMPONENTS" | sed "s/,/ /g")" + for user_component in $user_components; do + found=false + for my_component in $components; do + if [ "$user_component" = "$my_component" ]; then + found=true + fi + done + if [ "$found" = false ]; then + err "unknown component: $user_component" + fi + done + components="$user_components" +fi + +if [ -n "$CFG_WITHOUT" ]; then + without_components="$(echo "$CFG_WITHOUT" | sed "s/,/ /g")" + for without_component in $without_components; do + components="$(echo "$components" | sed "s/$without_component//" | sed "s/$without_component//")" + done +fi + +if [ -z "$components" ]; then + if [ -z "${CFG_UNINSTALL-}" ]; then + err "no components selected for installation" + else + err "no components selected for uninstallation" + fi +fi + +do_preflight_sanity_checks "$src_dir" "$dest_prefix" + +# Using an absolute path to libdir in a few places so that the status +# messages are consistently using absolute paths. +absolutify "$CFG_LIBDIR" +abs_libdir="$RETVAL" +assert_nz "$abs_libdir" "abs_libdir" + +# Create the manifest directory, where we will put our logs +make_dir_recursive "$abs_libdir/$TEMPLATE_REL_MANIFEST_DIR" +need_ok "failed to create $TEMPLATE_REL_MANIFEST_DIR" + +# Log messages and commands +init_logging "$abs_libdir" + +# First do any uninstallation, including from legacy manifests. This +# will also upgrade the metadata of existing installs. +uninstall_components "$abs_libdir" "$dest_prefix" "$components" + +# If we're only uninstalling then exit +if [ -n "${CFG_UNINSTALL-}" ] +then + echo + echo " $TEMPLATE_PRODUCT_NAME is uninstalled." + echo + exit 0 +fi + +# Create the manifest directory again! uninstall_legacy +# may have deleted it. +make_dir_recursive "$abs_libdir/$TEMPLATE_REL_MANIFEST_DIR" +need_ok "failed to create $TEMPLATE_REL_MANIFEST_DIR" + +# Drop the version number into the manifest dir +write_to_file "$TEMPLATE_RUST_INSTALLER_VERSION" "$abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/rust-installer-version" +critical_need_ok "failed to write installer version" + +# Install the uninstaller + +# Install each component +install_components "$src_dir" "$abs_libdir" "$dest_prefix" "$components" + +# Make dynamic libraries available to the linker +maybe_configure_ld "$abs_libdir" + +echo +echo " $TEMPLATE_SUCCESS_MESSAGE" +echo + + diff --git a/lang/rust-bin/patches/patch-install.sh b/lang/rust-bin/patches/patch-install.sh deleted file mode 100644 index ca9af7ad80f..00000000000 --- a/lang/rust-bin/patches/patch-install.sh +++ /dev/null @@ -1,24 +0,0 @@ -$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 |