pkgsrc-WIP-changes archive

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

Add bits to build aarch64_be for NetBSD (9.99.82).



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Mon Apr 26 08:24:38 2021 +0200
Changeset:	c000e211c94e4401b072dcf195eb5af1645f9e19

Modified Files:
	rust/Makefile
	rust/buildlink3.mk
	rust/cargo.mk
	rust/cross.mk
	rust/distinfo
	rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
	rust/patches/patch-src_bootstrap_bootstrap.py
	rust/patches/patch-vendor_openssl-src_src_lib.rs
Added Files:
	rust/patches/patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
	rust/patches/patch-vendor_ap-rustc__target_src_spec_mod.rs
	rust/patches/patch-vendor_cc-1.0.60_src_lib.rs
	rust/patches/patch-vendor_cc_src_lib.rs
	rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
	rust/patches/patch-vendor_target-lexicon_src_targets.rs

Log Message:
Add bits to build aarch64_be for NetBSD (9.99.82).

Needs testing, this is merely sufficient to cross-build
the bootstrap kit.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c000e211c94e4401b072dcf195eb5af1645f9e19

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/Makefile                                      | 26 +++++++++++++++++----
 rust/buildlink3.mk                                 |  2 +-
 rust/cargo.mk                                      |  2 +-
 rust/cross.mk                                      | 11 +++++----
 rust/distinfo                                      | 20 +++++++++++++---
 ...target_src_spec_aarch64__be__unknown__netbsd.rs | 27 ++++++++++++++++++++++
 .../patch-compiler_rustc__target_src_spec_mod.rs   |  7 +++++-
 rust/patches/patch-src_bootstrap_bootstrap.py      | 14 ++++++++---
 .../patch-vendor_ap-rustc__target_src_spec_mod.rs  | 14 +++++++++++
 rust/patches/patch-vendor_cc-1.0.60_src_lib.rs     | 15 ++++++++++++
 rust/patches/patch-vendor_cc_src_lib.rs            | 14 +++++++++++
 rust/patches/patch-vendor_openssl-src_src_lib.rs   | 11 +++++----
 ...target_src_spec_aarch64__be__unknown__netbsd.rs | 27 ++++++++++++++++++++++
 .../patch-vendor_target-lexicon_src_targets.rs     | 14 +++++++++++
 14 files changed, 182 insertions(+), 22 deletions(-)

diffs:
diff --git a/rust/Makefile b/rust/Makefile
index a7d5b7cb0c..245f33014c 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -18,7 +18,7 @@ GCC_REQD+=	5
 USE_GCC_RUNTIME=	yes
 USE_LANGUAGES=		c c++11
 USE_LIBTOOL=		yes
-USE_TOOLS+=		bash ggrep gmake perl:build pkg-config
+USE_TOOLS+=		bash grep gmake perl:build pkg-config
 
 # The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't
 # build on 7).  Mark earlier versions as broken.
@@ -49,7 +49,7 @@ CONFIGURE_ARGS+=		--disable-ninja
 .include "cross.mk"
 
 .if !empty(rust.BUILD_TARGET)
-BUILD_TARGET=	${rust.BUILD_TARGET)
+BUILD_TARGET=	${rust.BUILD_TARGET}
 .endif
 
 .if !empty(TARGET)
@@ -73,7 +73,7 @@ MAKE_ENV+=		CARGO_BUILD_JOBS=${_MAKE_JOBS_N}
 
 CFLAGS.SunOS+=		-D_POSIX_PTHREAD_SEMANTICS
 
-UNLIMIT_RESOURCES+=	cputime datasize virtualsize
+UNLIMIT_RESOURCES+=	cputime datasize memorysize
 
 TEST_TARGET=	check
 
@@ -269,6 +269,16 @@ SITES.${RUST_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
 SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
 pre-build-fix:
 .endif
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64eb) || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.51.0
+RUST_ARCH=		aarch64_be-unknown-netbsd
+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}
+SITES.${RUST_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+pre-build-fix:
+.endif
 .if !empty(MACHINE_PLATFORM:MNetBSD-*-sparc64) || make(distinfo) || make (makesum) || make(mdi)
 RUST_STAGE0_VER=	1.50.0
 RUST_ARCH=		sparc64-unknown-netbsd
@@ -324,6 +334,14 @@ CKSUM_CRATES+=	vendor/libc
 CKSUMS+=	8d7ddc8dd25a9404f9181a49438d9506c676cfd4b6fa21dbe5c1f9969abc4b91
 CKSUMS+=	f147be95b04ea1303171dff46c5a66b08cd47ccd0a4c346d5bcec7a8aaac3fc4
 
+CKSUM_CRATES+=	vendor/cc-1.0.60
+CKSUMS+=	903c5f2f5dd0cc7d04f99f605a95e6abde8b38156fd4e73eefc58493f55a4e5a
+CKSUMS+=	e45520f4dda532240e4ec28af550fcb76f44090361f273bebcf0d07dc0807885
+
+CKSUM_CRATES+=	vendor/rustc-ap-rustc_target
+CKSUMS+=	ab83c62fab6927a47fc3d15c02eec41174ea9f3e8dce5c53adab613d48918bc5
+CKSUMS+=	01f50edc3845bd03459d525444150d03f57cdb479de2668a71c1538adf3d340a
+
 CKSUM_CRATES+=	vendor/lzma-sys
 CKSUMS+=	6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
 CKSUMS+=	5e252578b5d266f6a4c8dc9f71ca7a91536ccb8c5c7d7753b82f12ec886459ef
@@ -338,7 +356,7 @@ CKSUMS+=	9e146a847e1f726fa7d7eae224aaa925030287f99770f950a012cb398e088d12
 
 CKSUM_CRATES+=	vendor/openssl-src
 CKSUMS+=	03dcdaac7de880b860ecfe859ba2ac3e46c8f46a7bf948aa674147eebee421b0
-CKSUMS+=	58f630b56613c5ba6c03f54f21dc9cb6ee9b32960cf5b44ae25878c77f543f7e
+CKSUMS+=	580a24c5a739e688e488498b8a34e27a3284c3160e6d3aaff711a80774c35c48
 
 SUBST_CLASSES+=		cksum
 SUBST_STAGE.cksum=	pre-configure
diff --git a/rust/buildlink3.mk b/rust/buildlink3.mk
index 346f079673..398dd32b90 100644
--- a/rust/buildlink3.mk
+++ b/rust/buildlink3.mk
@@ -1,9 +1,9 @@
 # $NetBSD: buildlink3.mk,v 1.6 2020/07/08 14:46:14 jperkin Exp $
 
+BUILDLINK_TREE+=	rust
 #
 # DO NOT include this directly! Use rust.mk instead.
 #
-BUILDLINK_TREE+=	rust
 
 .if !defined(RUST_BUILDLINK3_MK)
 RUST_BUILDLINK3_MK:=
diff --git a/rust/cargo.mk b/rust/cargo.mk
index 464c1f14d9..cfd6833616 100644
--- a/rust/cargo.mk
+++ b/rust/cargo.mk
@@ -51,7 +51,7 @@ cargo-vendor-crates:
 	${RUN}${MKDIR} ${CARGO_VENDOR_DIR}
 .for crate in ${CARGO_CRATE_DEPENDS}
 	${RUN}${PRINTF} '{"package":"%s","files":{}}'	\
-	  $$(${DIGEST} sha256 < ${_DISTDIR}/${crate}.crate) \
+	  `${DIGEST} sha256 < ${_DISTDIR}/${crate}.crate` \
 	  > ${CARGO_VENDOR_DIR}/${crate}/.cargo-checksum.json
 .endfor
 
diff --git a/rust/cross.mk b/rust/cross.mk
index 95affe752d..4bec9ce21a 100644
--- a/rust/cross.mk
+++ b/rust/cross.mk
@@ -17,17 +17,19 @@
 #CROSS_ROOT=		/u/macppc
 #CROSS_ROOT=		/u/9.0-macppc
 #CROSS_ROOT=		/u/evbarm64
+#CROSS_ROOT=		/u/evbarm64eb
 #CROSS_ROOT=		/u/i386
 #CROSS_ROOT=		/
-#MAKE_ENV+=		CROSS_ROOT=${CROSS_ROOT}
+MAKE_ENV+=		CROSS_ROOT=${CROSS_ROOT}
 
 # The GNU cross target designation
 #GNU_CROSS_TARGET=	armv7--netbsdelf-eabihf
 #GNU_CROSS_TARGET=	sparc64--netbsd
-#GNU_CROSS_TARGET=	i486--netbsdelf
 #GNU_CROSS_TARGET=	powerpc--netbsd
 #GNU_CROSS_TARGET=	aarch64--netbsd
-#MAKE_ENV+=		GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
+#GNU_CROSS_TARGET=	aarch64_be--netbsd
+#GNU_CROSS_TARGET=	i486--netbsdelf
+MAKE_ENV+=		GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
 
 # To cross-build rust, you need to specify
 # the ultimate target to built for, as well as the
@@ -37,13 +39,14 @@
 #TARGET= 		sparc64-unknown-netbsd
 #TARGET= 		powerpc-unknown-netbsd
 #TARGET= 		aarch64-unknown-netbsd
+#TARGET= 		aarch64_be-unknown-netbsd
 #TARGET= 		i686-unknown-netbsd
 #TARGET= 		i586-unknown-netbsd
 #
 #SCRIPTS=		${WRKDIR}/scripts
 #CONFIGURE_ARGS+=	--host=${TARGET}
 #CONFIGURE_ARGS+=	--target=${TARGET}
-#ONFIGURE_ARGS+= 	--set=target.${TARGET}.cc=${SCRIPTS}/gcc-wrap
+#CONFIGURE_ARGS+= 	--set=target.${TARGET}.cc=${SCRIPTS}/gcc-wrap
 #CONFIGURE_ARGS+=	--set=target.${TARGET}.cxx=${SCRIPTS}/c++-wrap
 #CONFIGURE_ARGS+=	--set=target.${TARGET}.linker=${SCRIPTS}/gcc-wrap
 # Pick one:
diff --git a/rust/distinfo b/rust/distinfo
index 15d2b890a6..7d796238a5 100644
--- a/rust/distinfo
+++ b/rust/distinfo
@@ -44,6 +44,10 @@ SHA1 (rust-1.50.0-x86_64-unknown-netbsd.tar.gz) = 3a3aa685e7b999b0ec13447c6343dd
 RMD160 (rust-1.50.0-x86_64-unknown-netbsd.tar.gz) = 0e47efe8b6de2cf929739ee73134372def159882
 SHA512 (rust-1.50.0-x86_64-unknown-netbsd.tar.gz) = b603ebf2475963fdf65eeea9d8db8b9c9e68638ba492a0ed1131259c46f10bfca8868ba1c78a4ce5bde0094d0f3b0e4414dc5b80b087faf129b5aba3e0ad14c5
 Size (rust-1.50.0-x86_64-unknown-netbsd.tar.gz) = 256369818 bytes
+SHA1 (rust-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = 932c1196a3f0a23871d62735459c36c8148c87a9
+RMD160 (rust-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = 5f1568e535101c81e76092943465836c6375b2a2
+SHA512 (rust-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = df7fe373f729393ee4fa3f353f8c30f232134b5eda37d5b798f64f2ae4e1ffb6e83f74d13443aa0334db12dd047de5408a0c6da4fa32a5245b667ccd30b0d841
+Size (rust-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = 291158227 bytes
 SHA1 (rust-1.51.0-i586-unknown-netbsd.tar.gz) = e549fb7465f954027ef20d8314d4b0af3e42af28
 RMD160 (rust-1.51.0-i586-unknown-netbsd.tar.gz) = 81c1f80a64babbc34b728c4c605d06d47b0b7d58
 SHA512 (rust-1.51.0-i586-unknown-netbsd.tar.gz) = 91903a1c852f71033130b90f196a584878270d367969aaa7350a205b1f1dbc4f6b943f853905fd5c7887d1191c3689d823ee6e143c5d6775e2e00db4a93e82ca
@@ -88,6 +92,10 @@ SHA1 (rust-std-1.50.0-x86_64-unknown-netbsd.tar.gz) = f2eb537fe359fca0533a1b90ea
 RMD160 (rust-std-1.50.0-x86_64-unknown-netbsd.tar.gz) = bbb1ea37aa484119b07f4a53d69a993c498b1eea
 SHA512 (rust-std-1.50.0-x86_64-unknown-netbsd.tar.gz) = 19af8459daa06434a9cb71f379cb43d5e2c3805c040f0afef804327f920fa55c6dc5dcce634f12c7e9e334d491df679e98ddec4f7ded5167b0ba5959eefdc6be
 Size (rust-std-1.50.0-x86_64-unknown-netbsd.tar.gz) = 39808048 bytes
+SHA1 (rust-std-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = 41f73af8de21bfe699fcc7cafe2ffa3bb17a1803
+RMD160 (rust-std-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = b1de4dbaf139bbfc490a965bf4b39b571548ecdc
+SHA512 (rust-std-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = b0040c31da01b7daabf93f69f83fbdabe4dd6194ff8b32e739a4205e637ef8d686f31e8967c4dc8acb432ef8053d991bd7b2ff29c7531fdb82f7c3a04719dea7
+Size (rust-std-1.51.0-aarch64_be-unknown-netbsd.tar.gz) = 25834344 bytes
 SHA1 (rust-std-1.51.0-i586-unknown-netbsd.tar.gz) = 2369f4c131a31f4e4a85a4ea194f74ff99966211
 RMD160 (rust-std-1.51.0-i586-unknown-netbsd.tar.gz) = 52ff1a6a489e5f48791c2838a2736d31876203ca
 SHA512 (rust-std-1.51.0-i586-unknown-netbsd.tar.gz) = 3d4f03f9cc8be0e739bde279006e5fc4b2b67e7bff97ed496c12d54acd0d327d22ca7df7bc91e13d545d0b73f2b70ea5f2374f4953ace9956061015b9156c732
@@ -98,15 +106,16 @@ SHA512 (rustc-1.51.0-src.tar.gz) = 694189c7d48537b29fdf39e1b4cac58166c72d8e5adef
 Size (rustc-1.51.0-src.tar.gz) = 160954811 bytes
 SHA1 (patch-compiler_rustc__codegen__ssa_src_back_linker.rs) = ce864839b3bce0755b950d914164e707a3f4eb68
 SHA1 (patch-compiler_rustc__llvm_build.rs) = b5157022f0f1942ae2db1ab78145af1526780b18
+SHA1 (patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 2270c285d71ab21ab3f5426518908a32076e3536
 SHA1 (patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs) = 8016df2ef0cf1e82b62d18ef156da9806988cb79
-SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = ddeea167481f6e09b9d927091a3452eb3699e8be
+SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = cfd6584417d4d07ec6326aaf597aa211eac2645f
 SHA1 (patch-compiler_rustc__target_src_spec_netbsd__base.rs) = b0254ca5a13deb345716338b01f04f0a063a3902
 SHA1 (patch-compiler_rustc__target_src_spec_solaris__base.rs) = f0b41a3a5685ae33d037f8ded0b1fa6f1acb0867
 SHA1 (patch-library_backtrace_crates_backtrace-sys_src_libbacktrace_configure) = 5dc1cfc843894156b513c86453db5032917a5529
 SHA1 (patch-library_std_src_sys_unix_mod.rs) = 927b03f3f34bd21a81bd2a8b6bcf30fe241e2d32
 SHA1 (patch-library_std_src_sys_unix_thread.rs) = f3af869fba5bc0ab8d28042f55fe830f93b8ef54
 SHA1 (patch-library_unwind_build.rs) = ae096a20aed95304eb3806be4cd237fe4ffd9afb
-SHA1 (patch-src_bootstrap_bootstrap.py) = a8c094a781339a613221259d8ce7d00f6e0aa3e6
+SHA1 (patch-src_bootstrap_bootstrap.py) = ca87e6c58f34835b420a63a18ca95605a18657c6
 SHA1 (patch-src_bootstrap_builder.rs) = e04b3212786a422f70516227f7cbc7b29dcd699d
 SHA1 (patch-src_bootstrap_compile.rs) = 86fe55d04f7a8c5ec05dbdcb0fe5a0d6c07584d5
 SHA1 (patch-src_bootstrap_lib.rs) = 3277f2be69a269ac761a2a6ab4d5389d121e6ca6
@@ -120,8 +129,13 @@ SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 10e6c1253adac0262b000aec
 SHA1 (patch-src_tools_rls_rls_src_cmd.rs) = fade3e60fecac5c4e4d4ee5bee82659b4eb385b7
 SHA1 (patch-src_tools_rls_rls_src_server_io.rs) = 51af64526db55abcf6b4b3165df314a16cf62e34
 SHA1 (patch-src_tools_rust-installer_install-template.sh) = f2ec6dced2be1fa23773d5827503ad07d0913dc2
+SHA1 (patch-vendor_ap-rustc__target_src_spec_mod.rs) = e3feaf809eb568c3fb34b5880cfa45ec4d71238b
+SHA1 (patch-vendor_cc-1.0.60_src_lib.rs) = 42ddba7dfbec922e5ef948b97ff8c70bae1b0113
+SHA1 (patch-vendor_cc_src_lib.rs) = 27d8b8b6d9a607362152069a206298854f517460
 SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 804ea03be546fef0d2bd37d7f8abb26d38a7892b
 SHA1 (patch-vendor_lzma-sys_config.h) = b654c7e129fa02697734bc87173f89b3056a5437
 SHA1 (patch-vendor_net2_src_ext.rs) = 5c34f3eaaa0589eefe14d374d34fadd4900565fd
-SHA1 (patch-vendor_openssl-src_src_lib.rs) = b3d728b66600363b5144ff84a34683f80c034d27
+SHA1 (patch-vendor_openssl-src_src_lib.rs) = 67e5352830dd1de9cfb809df55d2dc702f371171
+SHA1 (patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 4e86aec4c89db9a331950a12f8ec7b8aaa50eed7
 SHA1 (patch-vendor_stacker_src_lib.rs) = 2f4db9971c0558ec7034052c810b8c8be80c4ae3
+SHA1 (patch-vendor_target-lexicon_src_targets.rs) = ec46802e2ec4bcce80a859b435b591ff464e9a42
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs b/rust/patches/patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
new file mode 100644
index 0000000000..194231d99b
--- /dev/null
+++ b/rust/patches/patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Add aarch64_be NetBSD target.
+
+--- compiler/rustc_target/src/spec/aarch64_be_unknown_netbsd.rs.orig	2021-04-25 17:12:53.986628780 +0200
++++ compiler/rustc_target/src/spec/aarch64_be_unknown_netbsd.rs	2021-04-25 18:00:57.795577197 +0200
+@@ -0,0 +1,20 @@
++use crate::abi::Endian;
++use crate::spec::{Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.max_atomic_width = Some(128);
++    base.unsupported_abis = super::arm_base::unsupported_abis();
++
++    Target {
++        llvm_target: "aarch64_be-unknown-netbsd".to_string(),
++        pointer_width: 64,
++        data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
++        arch: "aarch64".to_string(),
++        options: TargetOptions {
++            mcount: "__mcount".to_string(),
++	    endian: Endian::Big,
++            ..base
++        },
++    }
++}
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs b/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
index 22bfc7d33b..2b60d0e36e 100644
--- a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
+++ b/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
@@ -1,9 +1,14 @@
 $NetBSD$
 
+Add i586(pentium) and aarch64_be targets.
+
 --- compiler/rustc_target/src/spec/mod.rs.orig	2021-03-23 16:15:10.000000000 +0000
 +++ compiler/rustc_target/src/spec/mod.rs
-@@ -697,6 +697,7 @@ supported_targets! {
+@@ -695,8 +695,10 @@ supported_targets! {
+     ("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
+ 
      ("aarch64-unknown-netbsd", aarch64_unknown_netbsd),
++    ("aarch64_be-unknown-netbsd", aarch64_be_unknown_netbsd),
      ("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
      ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
 +    ("i586-unknown-netbsd", i586_unknown_netbsd),
diff --git a/rust/patches/patch-src_bootstrap_bootstrap.py b/rust/patches/patch-src_bootstrap_bootstrap.py
index 21356dfbb7..4d0522c4cb 100644
--- a/rust/patches/patch-src_bootstrap_bootstrap.py
+++ b/rust/patches/patch-src_bootstrap_bootstrap.py
@@ -6,7 +6,7 @@ Handle earmv7hf for NetBSD.
 
 --- src/bootstrap/bootstrap.py.orig	2021-02-10 17:36:44.000000000 +0000
 +++ src/bootstrap/bootstrap.py
-@@ -228,6 +228,11 @@ def default_build_triple(verbose):
+@@ -229,6 +229,11 @@ def default_build_triple(verbose):
          'OpenBSD': 'unknown-openbsd'
      }
  
@@ -18,7 +18,15 @@ Handle earmv7hf for NetBSD.
      # Consider the direct transformation first and then the special cases
      if ostype in ostype_mapper:
          ostype = ostype_mapper[ostype]
-@@ -314,10 +319,12 @@ def default_build_triple(verbose):
+@@ -279,6 +284,7 @@ def default_build_triple(verbose):
+     cputype_mapper = {
+         'BePC': 'i686',
+         'aarch64': 'aarch64',
++        'aarch64eb': 'aarch64',
+         'amd64': 'x86_64',
+         'arm64': 'aarch64',
+         'i386': 'i686',
+@@ -315,10 +321,12 @@ def default_build_triple(verbose):
              ostype = 'linux-androideabi'
          else:
              ostype += 'eabihf'
@@ -32,7 +40,7 @@ Handle earmv7hf for NetBSD.
          else:
              ostype += 'eabihf'
      elif cputype == 'mips':
-@@ -793,7 +800,7 @@ class RustBuild(object):
+@@ -821,7 +829,7 @@ class RustBuild(object):
              if "LIBRARY_PATH" in env else ""
          # preserve existing RUSTFLAGS
          env.setdefault("RUSTFLAGS", "")
diff --git a/rust/patches/patch-vendor_ap-rustc__target_src_spec_mod.rs b/rust/patches/patch-vendor_ap-rustc__target_src_spec_mod.rs
new file mode 100644
index 0000000000..add609db5e
--- /dev/null
+++ b/rust/patches/patch-vendor_ap-rustc__target_src_spec_mod.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add aarch64_be NetBSD target.
+
+--- vendor/rustc-ap-rustc_target/src/spec/mod.rs.orig	2021-03-23 16:54:53.000000000 +0000
++++ vendor/rustc-ap-rustc_target/src/spec/mod.rs
+@@ -695,6 +695,7 @@ supported_targets! {
+     ("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
+ 
+     ("aarch64-unknown-netbsd", aarch64_unknown_netbsd),
++    ("aarch64_be-unknown-netbsd", aarch64_be_unknown_netbsd),
+     ("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
+     ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
+     ("i686-unknown-netbsd", i686_unknown_netbsd),
diff --git a/rust/patches/patch-vendor_cc-1.0.60_src_lib.rs b/rust/patches/patch-vendor_cc-1.0.60_src_lib.rs
new file mode 100644
index 0000000000..70b9b0bdf3
--- /dev/null
+++ b/rust/patches/patch-vendor_cc-1.0.60_src_lib.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add aarch64_be NetBSD target.
+Needed?  (Linux apparently doesn't.)
+
+--- vendor/cc-1.0.60/src/lib.rs.orig	2021-03-23 16:54:51.000000000 +0000
++++ vendor/cc-1.0.60/src/lib.rs
+@@ -2267,6 +2267,7 @@ impl Build {
+             "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
+             "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
+             "aarch64-unknown-netbsd" => Some("aarch64--netbsd"),
++            "aarch64_be-unknown-netbsd" => Some("aarch64_be--netbsd"),
+             "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
diff --git a/rust/patches/patch-vendor_cc_src_lib.rs b/rust/patches/patch-vendor_cc_src_lib.rs
new file mode 100644
index 0000000000..299ea79b58
--- /dev/null
+++ b/rust/patches/patch-vendor_cc_src_lib.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add aarch64_eb.
+
+--- vendor/cc/src/lib.rs.orig	2021-03-23 16:54:51.000000000 +0000
++++ vendor/cc/src/lib.rs
+@@ -2353,6 +2353,7 @@ impl Build {
+             "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
+             "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
+             "aarch64-unknown-netbsd" => Some("aarch64--netbsd"),
++            "aarch64_eb-unknown-netbsd" => Some("aarch64_be--netbsd"),
+             "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
diff --git a/rust/patches/patch-vendor_openssl-src_src_lib.rs b/rust/patches/patch-vendor_openssl-src_src_lib.rs
index fdec682366..3b345b3a42 100644
--- a/rust/patches/patch-vendor_openssl-src_src_lib.rs
+++ b/rust/patches/patch-vendor_openssl-src_src_lib.rs
@@ -2,17 +2,18 @@ $NetBSD: patch-vendor_openssl-src_src_lib.rs,v 1.1 2021/01/01 20:44:48 he Exp $
 
 Provide defaults for the various NetBSD targets.
 
---- vendor/openssl-src/src/lib.rs.orig	2020-12-29 03:36:31.000000000 +0000
+--- vendor/openssl-src/src/lib.rs.orig	2021-03-23 16:54:53.000000000 +0000
 +++ vendor/openssl-src/src/lib.rs
-@@ -167,6 +167,7 @@ impl Build {
+@@ -167,6 +167,8 @@ impl Build {
              "aarch64-unknown-freebsd" => "BSD-generic64",
              "aarch64-unknown-linux-gnu" => "linux-aarch64",
              "aarch64-unknown-linux-musl" => "linux-aarch64",
 +            "aarch64-unknown-netbsd" => "BSD-generic64",
++            "aarch64_be-unknown-netbsd" => "BSD-generic64",
              "aarch64-pc-windows-msvc" => "VC-WIN64-ARM",
              "arm-linux-androideabi" => "linux-armv4",
              "armv7-linux-androideabi" => "linux-armv4",
-@@ -178,6 +179,7 @@ impl Build {
+@@ -178,6 +180,7 @@ impl Build {
              "armv7-unknown-freebsd" => "BSD-generic32",
              "armv7-unknown-linux-gnueabihf" => "linux-armv4",
              "armv7-unknown-linux-musleabihf" => "linux-armv4",
@@ -20,7 +21,7 @@ Provide defaults for the various NetBSD targets.
              "asmjs-unknown-emscripten" => "gcc",
              "i586-unknown-linux-gnu" => "linux-elf",
              "i586-unknown-linux-musl" => "linux-elf",
-@@ -188,6 +190,8 @@ impl Build {
+@@ -188,6 +191,8 @@ impl Build {
              "i686-unknown-freebsd" => "BSD-x86-elf",
              "i686-unknown-linux-gnu" => "linux-elf",
              "i686-unknown-linux-musl" => "linux-elf",
@@ -29,7 +30,7 @@ Provide defaults for the various NetBSD targets.
              "mips-unknown-linux-gnu" => "linux-mips32",
              "mips-unknown-linux-musl" => "linux-mips32",
              "mips64-unknown-linux-gnuabi64" => "linux64-mips64",
-@@ -195,12 +199,14 @@ impl Build {
+@@ -195,12 +200,14 @@ impl Build {
              "mipsel-unknown-linux-gnu" => "linux-mips32",
              "mipsel-unknown-linux-musl" => "linux-mips32",
              "powerpc-unknown-linux-gnu" => "linux-ppc",
diff --git a/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs b/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
new file mode 100644
index 0000000000..98a1d9cb7b
--- /dev/null
+++ b/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Add aarch64_be NetBSD target.
+
+--- /dev/null	2021-04-26 00:02:43.147970692 +0200
++++ vendor/rustc-ap-rustc_target/src/spec/aarch64_be_unknown_netbsd.rs	2021-04-26 00:07:44.657579025 +0200
+@@ -0,0 +1,20 @@
++use crate::abi::Endian;
++use crate::spec::{Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.max_atomic_width = Some(128);
++    base.unsupported_abis = super::arm_base::unsupported_abis();
++
++    Target {
++        llvm_target: "aarch64_be-unknown-netbsd".to_string(),
++        pointer_width: 64,
++        data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
++        arch: "aarch64".to_string(),
++        options: TargetOptions {
++            mcount: "__mcount".to_string(),
++            endian: Endian::Big,
++            ..base
++        },
++    }
++}
diff --git a/rust/patches/patch-vendor_target-lexicon_src_targets.rs b/rust/patches/patch-vendor_target-lexicon_src_targets.rs
new file mode 100644
index 0000000000..2da700cf4e
--- /dev/null
+++ b/rust/patches/patch-vendor_target-lexicon_src_targets.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add aarch64_eb for NetBSD.
+
+--- vendor/target-lexicon/src/targets.rs.orig	2021-03-23 16:54:53.000000000 +0000
++++ vendor/target-lexicon/src/targets.rs
+@@ -1267,6 +1267,7 @@ mod tests {
+             "aarch64-unknown-linux-gnu",
+             "aarch64-unknown-linux-musl",
+             "aarch64-unknown-netbsd",
++            "aarch64_be-unknown-netbsd",
+             "aarch64-unknown-none",
+             "aarch64-unknown-none-softfloat",
+             "aarch64-unknown-openbsd",


Home | Main Index | Thread Index | Old Index