Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/rust rust: Add support for cross-compiling illumos.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c594ffeafe57
branches:  trunk
changeset: 435500:c594ffeafe57
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Jul 08 14:46:14 2020 +0000

description:
rust: Add support for cross-compiling illumos.

It's not really cross-compiled, it's just a different target name, but is
treated the same way.  Once stabilised and crate support catches up we'll
switch over to it by default from x86_64-sun-solaris.  Until then I'll
build bootstrap kits for both natively.

While here fix up a bunch of obvious pkglint warnings.

diffstat:

 lang/rust/Makefile                                       |  29 +++++++-
 lang/rust/buildlink3.mk                                  |   3 +-
 lang/rust/cross.mk                                       |  20 ++++-
 lang/rust/distinfo                                       |  10 ++-
 lang/rust/patches/patch-src_libstd_build.rs              |  23 ++++--
 lang/rust/patches/patch-vendor_mio_src_sys_unix_mod.rs   |  19 +++++
 lang/rust/patches/patch-vendor_mio_src_sys_unix_ready.rs |  42 +++++++++++++
 lang/rust/patches/patch-vendor_net2_src_ext.rs           |  14 ++++
 lang/rust/patches/patch-vendor_net2_src_lib.rs           |  15 ++++
 lang/rust/patches/patch-vendor_net2_src_sys_unix_mod.rs  |  33 ++++++++++
 lang/rust/patches/patch-vendor_time_src_sys.rs           |  51 ++++++++++++++++
 lang/rust/rust.mk                                        |   4 +-
 12 files changed, 237 insertions(+), 26 deletions(-)

diffs (truncated from 407 to 300 lines):

diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/Makefile
--- a/lang/rust/Makefile        Wed Jul 08 14:46:08 2020 +0000
+++ b/lang/rust/Makefile        Wed Jul 08 14:46:14 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.186 2020/07/07 10:44:02 he Exp $
+# $NetBSD: Makefile,v 1.187 2020/07/08 14:46:14 jperkin Exp $
 
 DISTNAME=      rustc-1.44.1-src
 PKGNAME=       ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -125,7 +125,7 @@
 .  endif
 
 # Open PRs
-# 
+#
 # Broken package with PREFIX not /usr/pkg:
 #   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54453
 #
@@ -136,7 +136,7 @@
 #   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=55368
 
 # Stale PRs (a reason to believe they no longer apply)
-# 
+#
 # NetBSD 8.1 sparc64: bootstrap fails with libssl.so.14 missing
 #   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54622
 
@@ -322,11 +322,28 @@
 CKSUMS+=       51a9ca7a4576822dc4fa01b31bc4bbed21817777abb304f605ef5951f68c3ed2
 CKSUMS+=       807c3aa4b5a62a70ba790df151e9ecf19f4bb562f2858575d690908751262db3
 
-# Contain identical checksums
 CKSUM_CRATES+= vendor/rand-0.6.1
 CKSUMS+=       1e732c2e3b4bd1561f11e0979bf9d20669a96eae7afe0deff9dfbb980ee47bf1
 CKSUMS+=       bc03f2345d7cfa7000f9da817120b6afa073359789c21a9a790ebd8676c50cca
 
+CKSUM_CRATES+= vendor/mio
+CKSUMS+=       62331824b1f5022e372b875faad41a970abb13e63c15e3fae9af948a2b06e4e1
+CKSUMS+=       6fc27e48d0c7275588da244c372994ef442bc4ecd78264cc5337a55b79798f62
+CKSUMS+=       bf76f97c0dc9dfe870b8e865ea03ebbdfa939494a6fea809ac530d8055a56ec0
+CKSUMS+=       f4d143c57f3b87e4af6381ea33cb81c3c3577aa717bf7690e0a5c1eea73d2baa
+
+CKSUM_CRATES+= vendor/net2
+CKSUMS+=       b9300ae246e9ac451889f146ece8bb6ed4a95482edf806373de5af759cd09360
+CKSUMS+=       762a881d936363f4140bc6befc516f9b3f321ef0a6eb9f3f812aa15ab32b56c0
+CKSUMS+=       bb28a7275eac021132b01206d134802902d616c0be3e82100b45a3ff1eba4c02
+CKSUMS+=       baa97a46744047bef086334ed9a63b340e4aba85e6471493780fc99d8e6445ed
+CKSUMS+=       8d8a171090b75e86e7505921460fba072db0077942edd11c4a3c8a70e9164eef
+CKSUMS+=       7ad3b486020bd652ad7c5af752f039c30ee0099c86ff6b6f336587db7a2bc523
+
+CKSUM_CRATES+= vendor/time
+CKSUMS+=       4f6bc5c6300c2d49da7d21615152872e16d53c0f02540824f48c45edd4d3140f
+CKSUMS+=       6d460b1899de033f625ccb13b1e3ba28cd338980a8c88c518a18749a079bafc3
+
 SUBST_CLASSES+=                cksum
 SUBST_STAGE.cksum=     pre-configure
 .for crate in ${CKSUM_CRATES}
@@ -461,7 +478,7 @@
                   libssh2.so.1 libunistring.so.2; do \
                ${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
        done
-       for f in ${BOOTSTRAP_TMPDIR}/bin/{cargo*,clippy*,miri,rls,rustc,rustdoc,rustfmt}; do \
+       for f in ${BOOTSTRAP_TMPDIR}/bin/{cargo*,clippy*,rls,rustc,rustdoc,rustfmt}; do \
                ${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \
        done
        for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \
@@ -470,7 +487,7 @@
        for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
                ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \
        done
-       for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/${RUST_ARCH}/*/*.so*; do \
+       for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \
                ${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \
        done
        (cd ${WRKDIR}; \
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/buildlink3.mk
--- a/lang/rust/buildlink3.mk   Wed Jul 08 14:46:08 2020 +0000
+++ b/lang/rust/buildlink3.mk   Wed Jul 08 14:46:14 2020 +0000
@@ -1,9 +1,8 @@
-# $NetBSD: buildlink3.mk,v 1.5 2020/06/14 15:38:18 nia Exp $
+# $NetBSD: buildlink3.mk,v 1.6 2020/07/08 14:46:14 jperkin Exp $
 
 #
 # DO NOT include this directly! Use rust.mk instead.
 #
-
 BUILDLINK_TREE+=       rust
 
 .if !defined(RUST_BUILDLINK3_MK)
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/cross.mk
--- a/lang/rust/cross.mk        Wed Jul 08 14:46:08 2020 +0000
+++ b/lang/rust/cross.mk        Wed Jul 08 14:46:14 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: cross.mk,v 1.1 2020/07/06 19:09:29 he Exp $
+# $NetBSD: cross.mk,v 1.2 2020/07/08 14:46:14 jperkin Exp $
 
 # These settings may be used to cross-build rust.
 #
@@ -32,11 +32,11 @@
 # the ultimate target to built for, as well as the
 # host the compiler is supposed to run on.
 # Rust's target designation
-#TARGET=               armv7-unknown-netbsd-eabihf
-#TARGET=               sparc64-unknown-netbsd
-#TARGET=               powerpc-unknown-netbsd
-#TARGET=               aarch64-unknown-netbsd
-#TARGET=               i686-unknown-netbsd
+#TARGET=               armv7-unknown-netbsd-eabihf
+#TARGET=               sparc64-unknown-netbsd
+#TARGET=               powerpc-unknown-netbsd
+#TARGET=               aarch64-unknown-netbsd
+#TARGET=               i686-unknown-netbsd
 #
 #SCRIPTS=              ${WRKDIR}/scripts
 #CONFIGURE_ARGS+=      --host=${TARGET}
@@ -48,3 +48,11 @@
 
 # May be required when cross-building on NetBSD
 #MAKE_ENV+=            OPENSSL_DIR=/usr
+
+#
+# Cross-compile illumos target.  The host is identical, it's just the target that
+# has been renamed.
+#
+#CONFIGURE_ARGS+=      --set=target.x86_64-unknown-illumos.llvm-config=${BUILDLINK_PREFIX.llvm}/bin/llvm-config
+#CONFIGURE_ARGS+=      --host=x86_64-unknown-illumos
+#CONFIGURE_ARGS+=      --target=x86_64-unknown-illumos
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/distinfo
--- a/lang/rust/distinfo        Wed Jul 08 14:46:08 2020 +0000
+++ b/lang/rust/distinfo        Wed Jul 08 14:46:14 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.116 2020/07/07 10:44:02 he Exp $
+$NetBSD: distinfo,v 1.117 2020/07/08 14:46:14 jperkin Exp $
 
 SHA1 (rust-1.41.1-i686-apple-darwin.tar.gz) = 5a778b77fc88b19f1c668316e3bf677c60f8ead1
 RMD160 (rust-1.41.1-i686-apple-darwin.tar.gz) = ae61f32a4d27a760e6f2b79f4042ed0cf385f784
@@ -112,7 +112,7 @@
 SHA1 (patch-src_librustc__llvm_build.rs) = 7cc2aa0568aa2cbf4eb1fdbb00922b10df0b3ff6
 SHA1 (patch-src_librustc__target_spec_solaris__base.rs) = 63bf74e64f01e918db0860c43eefe50185c9a0c2
 SHA1 (patch-src_librustc__target_spec_x86__64__sun__solaris.rs) = f6ad33b41906bbf83a1cbd0e2fe13a4da37266fa
-SHA1 (patch-src_libstd_build.rs) = 8d9508a3c8931f280e5b8031413672a485094872
+SHA1 (patch-src_libstd_build.rs) = eb8faae53e997c14a40c0d35615f4ca5e316e7cc
 SHA1 (patch-src_libstd_sys_unix_thread.rs) = 2554f1a42afaa0ddce5053860f4dabecdf6c527a
 SHA1 (patch-src_libunwind_build.rs) = 723ded63580812f74d04c447f90925725ae9bfc9
 SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = d49503d19c30a64d571eb7fa79e7aad7038cd427
@@ -130,4 +130,10 @@
 SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 804ea03be546fef0d2bd37d7f8abb26d38a7892b
 SHA1 (patch-vendor_libssh2-sys_libssh2_Makefile.am) = 5343adcf044eeed1f325cd29d28964e209a50058
 SHA1 (patch-vendor_lzma-sys_config.h) = ab963fc8d7a847715e0e0dc2928333efe38e923f
+SHA1 (patch-vendor_mio_src_sys_unix_mod.rs) = ebc40c32ee5a709cce986304c493cb852aee642e
+SHA1 (patch-vendor_mio_src_sys_unix_ready.rs) = 2479285f60290c3669df84b6a6ce9f5fd0c5edc7
+SHA1 (patch-vendor_net2_src_ext.rs) = d390377f3ba98b9a38c9460c2b320af5b26901b6
+SHA1 (patch-vendor_net2_src_lib.rs) = dc3595a88f1322f39049de23755ef54f340eb054
+SHA1 (patch-vendor_net2_src_sys_unix_mod.rs) = 368b05d524edbaf3bb4f72b7066086aa876e2b9a
 SHA1 (patch-vendor_rand__os_src_netbsd.rs) = 049df63c904abd81cb92f33fa0882f5c81cae51a
+SHA1 (patch-vendor_time_src_sys.rs) = 9684a60cb9c6fb6a0f3eed3d6101a76986a38d8d
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/patches/patch-src_libstd_build.rs
--- a/lang/rust/patches/patch-src_libstd_build.rs       Wed Jul 08 14:46:08 2020 +0000
+++ b/lang/rust/patches/patch-src_libstd_build.rs       Wed Jul 08 14:46:14 2020 +0000
@@ -1,10 +1,9 @@
-$NetBSD: patch-src_libstd_build.rs,v 1.8 2020/07/06 13:56:32 he Exp $
+$NetBSD: patch-src_libstd_build.rs,v 1.9 2020/07/08 14:46:14 jperkin Exp $
 
-SunOS support:
- - Support PKGSRC_USE_SSP (ugly for now).
- - Add libexecinfo for backtrace().
+- Support PKGSRC_USE_SSP (ugly for now).
+- Add libexecinfo for backtrace().
 
---- src/libstd/build.rs.orig   2019-08-13 06:27:22.000000000 +0000
+--- src/libstd/build.rs.orig   2020-06-01 15:44:16.000000000 +0000
 +++ src/libstd/build.rs
 @@ -16,6 +16,7 @@ fn main() {
          println!("cargo:rustc-link-lib=execinfo");
@@ -14,12 +13,20 @@
          println!("cargo:rustc-link-lib=pthread");
          println!("cargo:rustc-link-lib=rt");
      } else if target.contains("dragonfly") || target.contains("openbsd") {
-@@ -31,6 +32,8 @@ fn main() {
+@@ -25,12 +26,16 @@ fn main() {
+         println!("cargo:rustc-link-lib=posix4");
+         println!("cargo:rustc-link-lib=pthread");
+         println!("cargo:rustc-link-lib=resolv");
++        println!("cargo:rustc-link-lib=nsl");
++        println!("cargo:rustc-link-lib=ssp");
++        println!("cargo:rustc-link-lib=umem");
+     } else if target.contains("illumos") {
+         println!("cargo:rustc-link-lib=socket");
+         println!("cargo:rustc-link-lib=posix4");
          println!("cargo:rustc-link-lib=pthread");
          println!("cargo:rustc-link-lib=resolv");
          println!("cargo:rustc-link-lib=nsl");
-+      // pkgsrc hack until I can figure out how to pass it through properly
-+      println!("cargo:rustc-link-lib=ssp");
++        println!("cargo:rustc-link-lib=ssp");
          // Use libumem for the (malloc-compatible) allocator
          println!("cargo:rustc-link-lib=umem");
      } else if target.contains("apple-darwin") {
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/patches/patch-vendor_mio_src_sys_unix_mod.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_mio_src_sys_unix_mod.rs    Wed Jul 08 14:46:14 2020 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-vendor_mio_src_sys_unix_mod.rs,v 1.1 2020/07/08 14:46:14 jperkin Exp $
+
+Support illumos.
+
+--- vendor/mio/src/sys/unix/mod.rs.orig        2020-06-01 17:45:25.000000000 +0000
++++ vendor/mio/src/sys/unix/mod.rs
+@@ -3,10 +3,10 @@ use libc::{self, c_int};
+ #[macro_use]
+ pub mod dlsym;
+ 
+-#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
++#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris", target_os = "illumos"))]
+ mod epoll;
+ 
+-#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
++#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris", target_os = "illumos"))]
+ pub use self::epoll::{Events, Selector};
+ 
+ #[cfg(any(target_os = "bitrig", target_os = "dragonfly",
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/patches/patch-vendor_mio_src_sys_unix_ready.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_mio_src_sys_unix_ready.rs  Wed Jul 08 14:46:14 2020 +0000
@@ -0,0 +1,42 @@
+$NetBSD: patch-vendor_mio_src_sys_unix_ready.rs,v 1.1 2020/07/08 14:46:14 jperkin Exp $
+
+Support illumos.
+
+--- vendor/mio/src/sys/unix/ready.rs.orig      2020-06-01 17:45:25.000000000 +0000
++++ vendor/mio/src/sys/unix/ready.rs
+@@ -110,7 +110,7 @@ const LIO: usize   = 0b100000;
+ const LIO: usize   = 0b000000;
+ 
+ 
+-#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
++#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris", target_os = "illumos"))]
+ const PRI: usize = ::libc::EPOLLPRI as usize;
+ 
+ 
+@@ -241,7 +241,7 @@ impl UnixReady {
+     /// [`Poll`]: struct.Poll.html
+     #[inline]
+     #[cfg(any(target_os = "linux",
+-        target_os = "android", target_os = "solaris"))]
++        target_os = "android", target_os = "solaris", target_os = "illumos"))]
+     pub fn priority() -> UnixReady {
+         UnixReady(ready_from_usize(PRI))
+     }
+@@ -368,7 +368,7 @@ impl UnixReady {
+     /// [`Poll`]: struct.Poll.html
+     #[inline]
+     #[cfg(any(target_os = "linux",
+-        target_os = "android", target_os = "solaris"))]
++        target_os = "android", target_os = "solaris", target_os = "illumos"))]
+     pub fn is_priority(&self) -> bool {
+         self.contains(ready_from_usize(PRI))
+     }
+@@ -459,7 +459,7 @@ impl fmt::Debug for UnixReady {
+             #[allow(deprecated)]
+             (UnixReady::aio(), "Aio"),
+             #[cfg(any(target_os = "linux",
+-                target_os = "android", target_os = "solaris"))]
++                target_os = "android", target_os = "solaris", target_os = "illumos"))]
+             (UnixReady::priority(), "Priority"),
+         ];
+ 
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/patches/patch-vendor_net2_src_ext.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_net2_src_ext.rs    Wed Jul 08 14:46:14 2020 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-vendor_net2_src_ext.rs,v 1.1 2020/07/08 14:46:14 jperkin Exp $
+
+Support illumos.
+
+--- vendor/net2/src/ext.rs.orig        2020-06-01 17:45:25.000000000 +0000
++++ vendor/net2/src/ext.rs
+@@ -28,6 +28,7 @@ cfg_if! {
+                  target_os = "netbsd",
+                  target_os = "openbsd",
+                  target_os = "solaris",
++                 target_os = "illumos",
+                  target_env = "uclibc"))] {
+         use libc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
+         use libc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
diff -r 8e198ba2ecef -r c594ffeafe57 lang/rust/patches/patch-vendor_net2_src_lib.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_net2_src_lib.rs    Wed Jul 08 14:46:14 2020 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-vendor_net2_src_lib.rs,v 1.1 2020/07/08 14:46:14 jperkin Exp $
+
+Support illumos.
+
+--- vendor/net2/src/lib.rs.orig        2020-06-01 17:45:25.000000000 +0000
++++ vendor/net2/src/lib.rs
+@@ -63,7 +63,7 @@ mod utils;
+ #[cfg(target_os="redox")] #[path = "sys/redox/mod.rs"] mod sys;
+ #[cfg(unix)] #[path = "sys/unix/mod.rs"] mod sys;
+ #[cfg(windows)] #[path = "sys/windows/mod.rs"] mod sys;
+-#[cfg(all(unix, not(any(target_os = "solaris"))))] pub mod unix;



Home | Main Index | Thread Index | Old Index