Hi,

Now we have an updated LLVM version in ports, we could use it for
building lang/rust instead of build the embedded version. It should
accelerate a bit the build time...

Please note that devel/llvm is a BUILD_DEPENDS only as rustc is statically
linked with several LLVM libraries.

I have disabled a part of testsuite, as their require FileCheck binary
(from LLVM) to be present, and we don't install it.

Comments ? OK ?
-- 
Sebastien Marie

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/rust/Makefile,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile
--- Makefile    5 Mar 2016 15:05:33 -0000       1.16
+++ Makefile    7 Mar 2016 14:34:37 -0000
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.16 2016/03/05 15:05:33 semarie Exp $
+# $OpenBSD: Makefile,v 1.15 2016/01/25 05:36:05 semarie Exp $
 
 # snapshots are only available for amd64, for now
 ONLY_FOR_ARCHS =       amd64
@@ -10,6 +10,7 @@ COMMENT-doc =         html documentation for ru
 V =                    1.7.0
 RUST_HASH =            6a154fe0
 DISTNAME =             rustc-${V}-src
+REVISION =             0
 
 SUBST_VARS +=          RUST_HASH
 
@@ -32,7 +33,7 @@ MAINTAINER =          Sebastien Marie <semarie@o
 # with portions covered by various BSD-like licenses
 PERMIT_PACKAGE_CDROM = Yes
 
-WANTLIB-main =         ${WANTLIB} c m pthread
+WANTLIB-main =         ${WANTLIB} c m pthread z
 WANTLIB-doc =
 
 MASTER_SITES =         https://static.rust-lang.org/dist/
@@ -56,6 +57,7 @@ SUBST_VARS +=         TRIPLE_ARCH
 
 MODULES +=             gcc4 \
                        lang/python
+BUILD_DEPENDS +=       devel/llvm
 MODPY_RUNDEP =         No
 
 # rustllvm need c++11
@@ -83,6 +85,7 @@ USE_GMAKE =           Yes
 CONFIGURE_STYLE =      simple
 CONFIGURE_ARGS +=      --disable-valgrind-rpass \
                        --release-channel=stable \
+                       --llvm-root="${LOCALBASE}" \
                        --prefix="${LOCALBASE}" \
                        --mandir="${LOCALBASE}/man"
 
@@ -90,10 +93,6 @@ CONFIGURE_ENV +=     ac_cv_header_execinfo_h
 
 # need for libbacktrace
 USE_LIBTOOL =          gnu
-
-.ifdef LOCAL_LLVM_FOR_RUST
-CONFIGURE_ARGS +=      --llvm-root="${LOCAL_LLVM_FOR_RUST}"
-.endif
 
 ALL_TARGET +=          rustc-stage2 docs
 TEST_TARGET =          check
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/lang/rust/patches/patch-configure,v
retrieving revision 1.7
diff -u -p -r1.7 patch-configure
--- patches/patch-configure     5 Mar 2016 15:05:33 -0000       1.7
+++ patches/patch-configure     7 Mar 2016 14:34:37 -0000
@@ -1,8 +1,10 @@
 $OpenBSD: patch-configure,v 1.7 2016/03/05 15:05:33 semarie Exp $
 Remove requirement for curl or wget.
 The snapshot isn't downloaded but copied by post-configure.
+
+Remove requirement for FileCheck (LLVM) used in some tests.
 --- configure.orig     Tue Mar  1 20:18:54 2016
-+++ configure  Wed Mar  2 09:18:22 2016
++++ configure  Mon Mar  7 06:07:54 2016
 @@ -727,7 +727,7 @@ putvar CFG_BOOTSTRAP_KEY
  
  step_msg "looking for build programs"
@@ -12,3 +14,12 @@ The snapshot isn't downloaded but copied
  if [ -z "$CFG_PYTHON_PROVIDED" ]; then
      probe_need CFG_PYTHON      python2.7 python2.6 python2 python
  fi
+@@ -1495,7 +1495,7 @@ do
+         LLVM_INST_DIR=$CFG_LLVM_ROOT
+         do_reconfigure=0
+         # Check that LLVm FileCheck is available. Needed for the tests
+-        need_cmd $LLVM_INST_DIR/bin/FileCheck
++        #need_cmd $LLVM_INST_DIR/bin/FileCheck
+     fi
+ 
+     if [ ${do_reconfigure} -ne 0 ]
Index: patches/patch-src_compiletest_runtest_rs
===================================================================
RCS file: patches/patch-src_compiletest_runtest_rs
diff -N patches/patch-src_compiletest_runtest_rs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_compiletest_runtest_rs    7 Mar 2016 14:34:37 -0000
@@ -0,0 +1,39 @@
+$OpenBSD$
+disable this part of test, as FileCheck isn't installed with LLVM
+--- src/compiletest/runtest.rs.orig    Mon Mar  7 08:17:06 2016
++++ src/compiletest/runtest.rs Mon Mar  7 09:37:52 2016
+@@ -1685,33 +1685,15 @@ fn compile_test_and_save_ir(config: &Config, props: &T
+     compose_and_run_compiler(config, props, testfile, args, None)
+ }
+ 
+-fn check_ir_with_filecheck(config: &Config, testfile: &Path) -> ProcRes {
+-    let irfile = output_base_name(config, testfile).with_extension("ll");
+-    let prog = config.llvm_bin_path.as_ref().unwrap().join("FileCheck");
+-    let proc_args = ProcArgs {
+-        // FIXME (#9639): This needs to handle non-utf8 paths
+-        prog: prog.to_str().unwrap().to_owned(),
+-        args: vec!(format!("-input-file={}", irfile.to_str().unwrap()),
+-                   testfile.to_str().unwrap().to_owned())
+-    };
+-    compose_and_run(config, testfile, proc_args, Vec::new(), "", None, None)
+-}
+-
+ fn run_codegen_test(config: &Config, props: &TestProps, testfile: &Path) {
+ 
+     if config.llvm_bin_path.is_none() {
+         fatal("missing --llvm-bin-path");
+     }
+ 
+-    let mut proc_res = compile_test_and_save_ir(config, props, testfile);
++    let proc_res = compile_test_and_save_ir(config, props, testfile);
+     if !proc_res.status.success() {
+         fatal_proc_rec("compilation failed!", &proc_res);
+-    }
+-
+-    proc_res = check_ir_with_filecheck(config, testfile);
+-    if !proc_res.status.success() {
+-        fatal_proc_rec("verification with 'FileCheck' failed",
+-                      &proc_res);
+     }
+ }
+ 

Reply via email to