pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/rust rust: add some kludges to better support Net...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6c0a942cf425
branches:  trunk
changeset: 327665:6c0a942cf425
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sat Jan 05 23:29:40 2019 +0000

description:
rust: add some kludges to better support NetBSD HEAD-llvm

1) bootstrap rustc adds -lgcc_s when linking
-> Dropped with a BUILDLINK_TRANSFORM

2) bootstrap rustc has shared linkage to libgcc_s.so.1
-> Until upstream changes this to static linkage, we look for
   libgcc_s.so.1 in ${FILESDIR} where the user must place it manually.

3) newly built rustc adds -lstdc++ instead of -lc++ when linking llvm
-> fixed with patch-src_librustc__llvm_build.rs

4) newly built rustc adds -lgcc_s when linking
-> fixed with patch-src_libunwind_build.rs

diffstat:

 lang/rust/Makefile                                  |  12 ++++++++-
 lang/rust/distinfo                                  |   4 ++-
 lang/rust/patches/patch-src_librustc__llvm_build.rs |  26 +++++++++++++++++++++
 lang/rust/patches/patch-src_libunwind_build.rs      |  17 +++++++++++++
 4 files changed, 56 insertions(+), 3 deletions(-)

diffs (101 lines):

diff -r 530f05bbfa29 -r 6c0a942cf425 lang/rust/Makefile
--- a/lang/rust/Makefile        Sat Jan 05 21:46:09 2019 +0000
+++ b/lang/rust/Makefile        Sat Jan 05 23:29:40 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.72 2019/01/03 03:12:30 tnn Exp $
+# $NetBSD: Makefile,v 1.73 2019/01/05 23:29:40 tnn Exp $
 
 DISTNAME=      rustc-1.31.1-src
 PKGREVISION=   1
@@ -308,10 +308,18 @@
 MAKE_ENV+=             OPENSSL_DIR=${SSLBASE}
 .endif
 
+.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
+BUILDLINK_TRANSFORM+=  rm:-lgcc_s
+MAKE_ENV+=             PKGSRC_HAVE_LIBCPP=yes
+.endif
+
 pre-build: pre-build-fix
-       # Requires libssh2 defines only available in master.
+#      Requires libssh2 defines only available in master.
        ${CP} -f ${WRKSRC}/src/vendor/libssh2-sys/libssh2/include/libssh2.h \
                ${BUILDLINK_DIR}/include/
+.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
+       cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/.
+.endif
 
 do-build:
        cd ${WRKSRC} \
diff -r 530f05bbfa29 -r 6c0a942cf425 lang/rust/distinfo
--- a/lang/rust/distinfo        Sat Jan 05 21:46:09 2019 +0000
+++ b/lang/rust/distinfo        Sat Jan 05 23:29:40 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.50 2018/12/21 23:12:34 he Exp $
+$NetBSD: distinfo,v 1.51 2019/01/05 23:29:40 tnn Exp $
 
 SHA1 (rust-1.30.0-x86_64-sun-solaris.tar.gz) = d1da4a02bdbb9a46587bc64d4b7987bb3f1aaeab
 RMD160 (rust-1.30.0-x86_64-sun-solaris.tar.gz) = 0670575ad4eb63f86d34299104f451463e5fc070
@@ -103,9 +103,11 @@
 SHA1 (patch-src_libbacktrace_configure) = b2c1e9b93a99408aad42ab9f1af27704cc81bdd8
 SHA1 (patch-src_liblibc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = e5b564bb247094cc8e4e6935a02262b3385cb7e6
 SHA1 (patch-src_liblibc_src_unix_solaris_mod.rs) = aeb7c22995e33c700ce3ea4336368a1fd08120e1
+SHA1 (patch-src_librustc__llvm_build.rs) = a56bf5435e40bb012641ada6b20256901a1073fb
 SHA1 (patch-src_libstd_build.rs) = 1edbf87339bd88e3178d4fa2fc408a6e802ed488
 SHA1 (patch-src_libstd_sys_unix_thread.rs) = 46ef46365658e2f895bd3dde9c74f352890e9ccc
 SHA1 (patch-src_libsyntax__pos_span__encoding.rs) = c891cffab8ae47b13b3b391ddd1a6c62ee2b38f3
+SHA1 (patch-src_libunwind_build.rs) = 74e2101f0cd78ca68b0a9d14355e20dcaea66100
 SHA1 (patch-src_llvm_CMakeLists.txt) = ffdf4337fdc84d8314c97c4e492e6b84244a99d1
 SHA1 (patch-src_llvm_cmake_modules_AddLLVM.cmake) = f0620ac62ecfb1d62d2dfa61b4c063d21c29b8f5
 SHA1 (patch-src_llvm_include_llvm-c_DataTypes.h) = 432693204912e79059ee31e815ad1e24f3236374
diff -r 530f05bbfa29 -r 6c0a942cf425 lang/rust/patches/patch-src_librustc__llvm_build.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_librustc__llvm_build.rs       Sat Jan 05 23:29:40 2019 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_librustc__llvm_build.rs,v 1.1 2019/01/05 23:29:40 tnn Exp $
+
+fix build on NetBSD HEAD-llvm. XXX there is probably a better way to do this.
+
+--- src/librustc_llvm/build.rs.orig    2018-12-18 23:11:17.000000000 +0000
++++ src/librustc_llvm/build.rs
+@@ -250,9 +250,17 @@ fn main() {
+         "c++"
+     } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
+         // NetBSD uses a separate library when relocation is required
+-        "stdc++_pic"
++        if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
++            "c++_pic"
++        } else {
++            "stdc++_pic"
++        }
+     } else {
+-        "stdc++"
++        if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
++            "c++"
++        } else {
++            "stdc++"
++        }
+     };
+ 
+     // C++ runtime library
diff -r 530f05bbfa29 -r 6c0a942cf425 lang/rust/patches/patch-src_libunwind_build.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_libunwind_build.rs    Sat Jan 05 23:29:40 2019 +0000
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_libunwind_build.rs,v 1.1 2019/01/05 23:29:40 tnn Exp $
+
+fix build on NetBSD HEAD-llvm. XXX there is probably a better way to do this.
+
+--- src/libunwind/build.rs.orig        2018-12-18 23:11:17.000000000 +0000
++++ src/libunwind/build.rs
+@@ -25,7 +25,9 @@ fn main() {
+     } else if target.contains("rumprun") {
+         println!("cargo:rustc-link-lib=unwind");
+     } else if target.contains("netbsd") {
+-        println!("cargo:rustc-link-lib=gcc_s");
++      if !env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
++            println!("cargo:rustc-link-lib=gcc_s");
++        }
+     } else if target.contains("openbsd") {
+         println!("cargo:rustc-link-lib=c++abi");
+     } else if target.contains("solaris") {



Home | Main Index | Thread Index | Old Index