rust: Restore SunOS support. Switch back to configure script.

No changes intended on other platforms, the configure script arguments
should be identical to those previously found in config.toml.  Doing it
this way makes it a lot easier to have per-OS configuration.
This commit is contained in:
jperkin 2017-11-16 19:48:24 +00:00
parent e67089735e
commit f217fd513f
6 changed files with 103 additions and 62 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.17 2017/11/04 15:51:43 tnn Exp $
# $NetBSD: Makefile,v 1.18 2017/11/16 19:48:24 jperkin Exp $
DISTNAME= rustc-1.21.0-src
PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
@ -12,14 +12,35 @@ LICENSE= mit OR apache-2.0
USE_GCC_RUNTIME= yes
USE_LANGUAGES= c c++11
USE_LIBTOOL= yes
USE_TOOLS+= bash gmake perl:build pkg-config
HAS_CONFIGURE= yes
CONFIGURE_ARGS+= --prefix=${PREFIX}
CONFIGURE_ARGS+= --mandir=${PREFIX}/${PKGMANDIR}
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --python=${PYTHONBIN}
CONFIGURE_ARGS+= --release-channel=stable
CONFIGURE_ARGS+= --enable-local-rust
CONFIGURE_ARGS+= --local-rust-root=${RUST_BOOTSTRAP_PATH}
CONFIGURE_ARGS+= --enable-extended # Build and install cargo too.
CONFIGURE_ARGS+= --enable-rpath
CONFIGURE_ARGS+= --disable-codegen-tests
CONFIGURE_ARGS+= --disable-dist-src
CONFIGURE_ARGS+= --disable-llvm-static-stdcpp
CONFIGURE_ARGS+= --disable-ninja
# This should allow us to perform "offline" builds (so cargo doesn't fetch
# dependencies during the build stage) but this isn't hooked up yet.
CONFIGURE_ARGS+= --enable-vendor
UNLIMIT_RESOURCES+= cputime
TEST_TARGET= check
# bin/* lib/*, but names vary
CHECK_RELRO_SUPPORTED= no
CHECK_SSP_SUPPORTED= no
# Required for LLVM (-std=c++11)
GCC_REQD+= 4.8
@ -31,6 +52,17 @@ GCC_REQD+= 4.8
#
BUILDLINK_TRANSFORM.NetBSD+= rm:-Wl,--enable-new-dtags
#
# Use bundled LLVM and libumem on SunOS.
#
.if ${OPSYS} == "SunOS"
CONFIGURE_ARGS+= --disable-jemalloc
.else
CONFIGURE_ARGS+= --llvm-root=${BUILDLINK_PREFIX.llvm}
BUILDLINK_API_DEPENDS.llvm+= llvm>=4.0.1nb1
.include "../../lang/llvm/buildlink3.mk"
.endif
#
# Rust unfortunately requires itself to build. On platforms which aren't
# supported by upstream (where they offer binary bootstraps), or where we do
@ -64,12 +96,13 @@ RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
.endif
#.if !empty(MACHINE_PLATFORM:MSunOS-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
#RUST_ARCH:= x86_64-sun-solaris
#RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
#SITES.${RUST_STAGE0}= https://us-east.manta.joyent.com/pkgsrc/public/pkg-bootstraps/
#DISTFILES:= ${DISTFILES} ${RUST_STAGE0}
#.endif
.if !empty(MACHINE_PLATFORM:MSunOS-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
RUST_ARCH:= x86_64-sun-solaris
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
SITES.${RUST_STAGE0}= https://us-east.manta.joyent.com/pkgsrc/public/pkg-bootstraps/
DISTFILES:= ${DISTFILES} ${RUST_STAGE0}
RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}
.endif
.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386) || make(distinfo) || make (makesum) || make(mdi)
RUST_ARCH= i686-unknown-netbsd
RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
@ -95,29 +128,12 @@ NOT_FOR_PLATFORM+= ${MACHINE_PLATFORM}
RUST_BOOTSTRAP_PATH?= ${WRKDIR}/rust-bootstrap
.endif
OPSYSVARS+= SOEXT
SOEXT.Darwin= dylib
SOEXT.*= so
RUST_VERHASH= 63283ac5
PLIST_SUBST+= RUST_ARCH=${RUST_ARCH:Q}
PLIST_SUBST+= RUST_VERHASH=${RUST_VERHASH:Q}
PLIST_SUBST+= SOEXT=${SOEXT:Q}
PRINT_PLIST_AWK+= { gsub(/${RUST_ARCH}/, "$${RUST_ARCH}") }
PRINT_PLIST_AWK+= { gsub(/${RUST_VERHASH}/, "$${RUST_VERHASH}") }
PRINT_PLIST_AWK+= { gsub(/\.${SOEXT}/, ".$${SOEXT}") }
.if ${OPSYS} == "SunOS"
BUILD_DEPENDS+= grep>=0:../../textproc/grep
BUILD_DEPENDS+= coreutils>=0:../../sysutils/coreutils
TOOLS_PATH.grep= ${PREFIX}/bin/ggrep
TOOLS_CREATE+= md5sum
TOOLS_PATH.md5sum= ${PREFIX}/bin/gmd5sum
SUBST_CLASSES+= ranlib
SUBST_STAGE.ranlib= post-patch
SUBST_FILES.ranlib= mk/rt.mk
SUBST_SED.ranlib= -e 's,RANLIB=.* \\,RANLIB="true" \\,g'
.endif
SUBST_CLASSES+= rpath
@ -135,28 +151,20 @@ post-extract:
${TOOLS_BASH} ./install.sh --prefix=${RUST_BOOTSTRAP_PATH}; \
fi
RUSTC= ${RUST_BOOTSTRAP_PATH}/bin/rustc
CARGO= ${RUST_BOOTSTRAP_PATH}/bin/cargo
.if ${OPSYS} != "SunOS"
LD_LIBRARY_PATH= ${RUST_BOOTSTRAP_PATH}/lib
PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${LD_LIBRARY_PATH:Q}
SUBST_CLASSES+= config
SUBST_STAGE.config= post-configure
SUBST_FILES.config+= config.toml
SUBST_VARS.config+= RUSTC CARGO PREFIX PYTHONBIN RUST_ARCH
do-configure:
${CP} ${FILESDIR}/config.toml ${WRKSRC}/config.toml
.endif
do-build:
cd ${WRKSRC} \
&& env ${MAKE_ENV} \
${PYTHONBIN} ./x.py dist
${PYTHONBIN} ./x.py -v dist
do-install:
cd ${WRKSRC} \
&& env ${MAKE_ENV} ${INSTALL_ENV} \
${PYTHONBIN} ./x.py install
${PYTHONBIN} ./x.py -v install
post-install:
${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/install.log
@ -194,7 +202,7 @@ fix-darwin-install-name:
# Create a relocatable stage2 bootstrap from the bits we just built that can be
# used to build the next version of rust. Currently only tested on SmartOS.
#
BOOTSTRAP_TMPDIR= ${WRKDIR}/${PKGNAME}-${RUST_ARCH}/rustc
BOOTSTRAP_TMPDIR= ${WRKDIR}/${PKGNAME}-${RUST_ARCH}
USE_TOOLS+= gtar
stage0-bootstrap: install
@ -222,8 +230,6 @@ stage0-bootstrap: install
.include "../../devel/cmake/buildlink3.mk"
.include "../../devel/libgit2/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
BUILDLINK_API_DEPENDS.llvm+= llvm>=4.0.1nb1
.include "../../lang/llvm/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../security/libssh2/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.9 2017/11/03 22:04:10 ryoon Exp $
$NetBSD: distinfo,v 1.10 2017/11/16 19:48:24 jperkin Exp $
SHA1 (rust-1.20.0-i686-apple-darwin.tar.gz) = a6dfd1c13abe89f285979a7264a1a8b0987ccaf9
RMD160 (rust-1.20.0-i686-apple-darwin.tar.gz) = da59f39d68ae4b4b1a11e371962fba6d7cf0ef2d
@ -16,6 +16,10 @@ SHA1 (rust-1.20.0-x86_64-apple-darwin.tar.gz) = 3fd58362b30e3cb10442a77fc6b047f9
RMD160 (rust-1.20.0-x86_64-apple-darwin.tar.gz) = 458b8cc20775c7db7d691632e4ba70ebac2426f8
SHA512 (rust-1.20.0-x86_64-apple-darwin.tar.gz) = 276f75b785076045512035a98c6ec78057497340db5077bf0a1e491fe571ef63bebce6e50884a1f636f04d601c5c9e85018588c3e2bf2f4b15653fbc54b279de
Size (rust-1.20.0-x86_64-apple-darwin.tar.gz) = 129228477 bytes
SHA1 (rust-1.20.0-x86_64-sun-solaris.tar.gz) = 11a2577ec593273909e8d847e64996976c07c52e
RMD160 (rust-1.20.0-x86_64-sun-solaris.tar.gz) = 32b87d37f327d2dcbcc7b489491e9df04a7e9c34
SHA512 (rust-1.20.0-x86_64-sun-solaris.tar.gz) = f74936810faa8919ab86e2eabc83408b920bfa49ebfe0f1c033ae27abe157bec4a2350b75c2ce8a934490b58f1730b7d8dc58db48b74bd251f968b32b71d74db
Size (rust-1.20.0-x86_64-sun-solaris.tar.gz) = 148849221 bytes
SHA1 (rust-1.20.0-x86_64-unknown-linux-gnu.tar.gz) = cb015e25b4666624b7984e2d9154f1bf273c2ae7
RMD160 (rust-1.20.0-x86_64-unknown-linux-gnu.tar.gz) = 0215150d516b0b313b64d48606743e4c51061f2e
SHA512 (rust-1.20.0-x86_64-unknown-linux-gnu.tar.gz) = 709a3df5733443bd53e18f78998fbd0ff0cba38d6ef5526570f3d388414576f38019d5fbece7408ab28b5d6fbd9ceb4b830ce31352da1ff5ccfc4e2757d68d17
@ -53,5 +57,8 @@ RMD160 (rustc-1.21.0-src.tar.gz) = dfb1ca914e2042f9f92f679bf743f575d25ece47
SHA512 (rustc-1.21.0-src.tar.gz) = 47f29a5c9c926c1b209516a8546c67a24c1c6ee15c6302c8c6d340047b3e1f713cc6d09e568b67ae4b47b08cbb0befd95fc0d7a72f2ce21a5224d4e5da03b4f5
Size (rustc-1.21.0-src.tar.gz) = 52555346 bytes
SHA1 (patch-src_bootstrap_bin_rustc.rs) = 617cc7ae52d92fdf80af0aff169c17a9cec4d67c
SHA1 (patch-src_libbacktrace_configure) = b2c1e9b93a99408aad42ab9f1af27704cc81bdd8
SHA1 (patch-src_libstd_build.rs) = 32dad8a474300f9f37bce8b92acca762cf8cc4ab
SHA1 (patch-src_llvm_cmake_modules_AddLLVM.cmake) = 282d97cce8d01cfefe565185d4999c2db9ccc13f
SHA1 (patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp) = 2899771b1a23be840b9305eff7e5e5f957239ccb
SHA1 (patch-src_tools_rust-installer_install-template.sh) = 88fe49a449e219ba1e3a11766615082120fc9680

View file

@ -1,22 +0,0 @@
[build]
rustc = "@RUSTC@"
cargo = "@CARGO@"
python = "@PYTHONBIN@"
vendor = true
extended = true
verbose = 2
[install]
prefix = "@PREFIX@"
sysconfdir = ""
mandir = "man"
[rust]
channel = "stable"
rpath = true
codegen-tests = false
[dist]
src-tarball = false
[llvm]
static-libstdcpp = false
ninja = false
[target.@RUST_ARCH@]
llvm-config = "@PREFIX@/bin/llvm-config"

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_libbacktrace_configure,v 1.1 2017/11/16 19:48:24 jperkin Exp $
Use pkgsrc libtool.
--- src/libbacktrace/configure.orig 2017-10-09 20:04:51.000000000 +0000
+++ src/libbacktrace/configure
@@ -7783,7 +7783,7 @@ fi
LIBTOOL_DEPS="$ltmain"
# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+LIBTOOL='libtool'

View file

@ -0,0 +1,18 @@
$NetBSD: patch-src_libstd_build.rs,v 1.1 2017/11/16 19:48:24 jperkin Exp $
SunOS support:
- Support PKGSRC_USE_SSP (ugly for now).
- Add libumem support.
--- src/libstd/build.rs.orig 2017-10-09 20:04:51.000000000 +0000
+++ src/libstd/build.rs
@@ -46,6 +46,9 @@ fn main() {
println!("cargo:rustc-link-lib=posix4");
println!("cargo:rustc-link-lib=pthread");
println!("cargo:rustc-link-lib=resolv");
+ // pkgsrc hack until I can figure out how to pass it through properly
+ println!("cargo:rustc-link-lib=ssp");
+ println!("cargo:rustc-link-lib=umem");
} else if target.contains("apple-darwin") {
println!("cargo:rustc-link-lib=System");

View file

@ -0,0 +1,17 @@
$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.1 2017/11/16 19:48:24 jperkin Exp $
Support SunOS.
--- src/tools/rust-installer/install-template.sh.orig 2017-10-09 20:07:27.000000000 +0000
+++ src/tools/rust-installer/install-template.sh
@@ -348,6 +348,10 @@ get_host_triple() {
_ostype=unknown-openbsd
;;
+ SunOS)
+ _ostype=sun-solaris
+ ;;
+
Darwin)
_ostype=apple-darwin
;;