Divide build time by at least three and various fixes, all from semarie@

- stop pruning optimizations coming from the environment (ie OpenBSD's
  default -O2 -pipe) when building llvm - this resulted in a very slow
llvm, and in a veeery slow rust build, and an awfully slow rust
compiler. Yay. See https://github.com/rust-lang/rust/issues/39900
- only add cmake to BDEP when rustc is compiled with bundled llvm
- propagate verbose cmake flag to bundled llvm build

tested on i386 and amd64
This commit is contained in:
landry 2017-02-18 13:15:48 +00:00
parent 82157d0b54
commit 531b5386c3
3 changed files with 30 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.37 2017/02/15 12:52:35 landry Exp $
# $OpenBSD: Makefile,v 1.38 2017/02/18 13:15:48 landry Exp $
# snapshots are only available for amd64 and i386, for now
ONLY_FOR_ARCHS = amd64 i386
@ -8,6 +8,7 @@ COMMENT-doc = html documentation for rustc
V = 1.15.1
DISTNAME = rustc-${V}-src
REVISION = 0
# rustc bootstrap version
RBV-amd64 = 1.15.0-20170203
@ -65,7 +66,6 @@ PKG_ARGS += -Damd64=0 -Di386=1
MODULES += gcc4 \
lang/python
BUILD_DEPENDS += devel/cmake
MODPY_RUNDEP = No
# use embedded or ports version of LLVM
@ -73,7 +73,8 @@ PORTS_LLVM ?= No
.if ${PORTS_LLVM:L:Myes}
BUILD_DEPENDS += devel/llvm<4
.else
BUILD_DEPENDS += devel/ninja
BUILD_DEPENDS += devel/cmake \
devel/ninja
.endif
# rustllvm need c++11

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_bootstrap_lib_rs,v 1.1 2017/02/18 13:15:48 landry Exp $
Let us compilation choice to be honored.
--- src/bootstrap/lib.rs.orig Thu Feb 16 12:26:21 2017
+++ src/bootstrap/lib.rs Thu Feb 16 12:26:27 2017
@@ -791,7 +791,6 @@ impl Build {
// gcc-rs because the build scripts will determine that for themselves.
let mut base = self.cc[target].0.args().iter()
.map(|s| s.to_string_lossy().into_owned())
- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<_>>();
// If we're compiling on OSX then we add a few unconditional flags

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-src_bootstrap_native_rs,v 1.1 2017/02/15 12:52:35 landry Exp $
$OpenBSD: patch-src_bootstrap_native_rs,v 1.2 2017/02/18 13:15:48 landry Exp $
use default settings from devel/llvm to local embedded version
--- src/bootstrap/native.rs.orig Thu Feb 9 02:37:48 2017
+++ src/bootstrap/native.rs Fri Feb 10 13:35:47 2017
@@ -85,10 +85,10 @@ pub fn llvm(build: &Build, target: &str) {
+++ src/bootstrap/native.rs Thu Feb 16 12:22:02 2017
@@ -85,16 +85,21 @@ pub fn llvm(build: &Build, target: &str) {
.define("LLVM_INCLUDE_EXAMPLES", "OFF")
.define("LLVM_INCLUDE_TESTS", "OFF")
.define("LLVM_INCLUDE_DOCS", "OFF")
@ -16,3 +16,14 @@ use default settings from devel/llvm to local embedded version
.define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
if target.starts_with("i686") {
cfg.define("LLVM_BUILD_32_BITS", "ON");
+ }
+
+ // propagate verbose flag to llvm build
+ if build.flags.verbose {
+ cfg.define("CMAKE_VERBOSE_MAKEFILE", "ON");
}
// http://llvm.org/docs/HowToCrossCompileLLVM.html