diff --git a/.travis.yml b/.travis.yml index 76e3af05d55..17a7543ef22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ install: - sudo apt-get update -qq - sudo apt-get install -qq --force-yes -y llvm-$LLVM_VERSION llvm-${LLVM_VERSION}-dev clang-$LLVM_VERSION lldb-$LLVM_VERSION + libjemalloc-dev # All of the llvm tools are suffixed with "-$VERS" which we don't want, so @@ -27,7 +28,8 @@ before_script: - ln -nsf /usr/bin/llvm-dis-$LLVM_VERSION local-llvm/bin/llvm-dis - ln -nsf /usr/bin/llc-$LLVM_VERSION local-llvm/bin/llc - ln -nsf /usr/include/llvm-$LLVM_VERSION local-llvm/include - - ./configure --disable-optimize-tests --llvm-root=`pwd`/local-llvm --enable-fast-make --enable-clang + - ./configure --disable-optimize-tests --llvm-root=`pwd`/local-llvm + --enable-fast-make --enable-clang --jemalloc-root=/usr/lib # Tidy everything up first, then build a few things, and then run a few tests. # Note that this is meant to run in a "fairly small" amount of time, so this diff --git a/configure b/configure index e3cf990d47c..fe29e488316 100755 --- a/configure +++ b/configure @@ -425,6 +425,8 @@ opt verify-install 1 "verify installed binaries work" valopt prefix "/usr/local" "set installation prefix" valopt local-rust-root "/usr/local" "set prefix for local rust binary" valopt llvm-root "" "set LLVM root" +valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located" +valopt libuv-root "" "set directory where libuv.a is located" valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path" valopt mingw32-cross-path "" "MinGW32 cross compiler path" @@ -1198,6 +1200,8 @@ putvar CFG_ANDROID_CROSS_PATH putvar CFG_MINGW32_CROSS_PATH putvar CFG_MANDIR putvar CFG_DISABLE_INJECT_STD_VERSION +putvar CFG_JEMALLOC_ROOT +putvar CFG_LIBUV_ROOT # Avoid spurious warnings from clang by feeding it original source on # ccache-miss rather than preprocessed input. diff --git a/mk/rt.mk b/mk/rt.mk index a75cb8aa4de..1c4efd641f0 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -204,19 +204,17 @@ $$(LIBUV_MAKEFILE_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS) $$(LIBUV_STAMP_$(1)) # theory when we support msvc then we should be using gyp's msvc output instead # of mingw's makefile for windows ifdef CFG_WINDOWSY_$(1) -$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS) +LIBUV_LOCAL_$(1) := $$(S)src/libuv/libuv.a +$$(LIBUV_LOCAL_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS) $$(Q)$$(MAKE) -C $$(S)src/libuv -f Makefile.mingw \ LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_$(1))" \ CC="$$(CC_$(1)) $$(LIBUV_CFLAGS_$(1)) $$(SNAP_DEFINES)" \ CXX="$$(CXX_$(1))" \ AR="$$(AR_$(1))" \ V=$$(VERBOSE) - $$(Q)cp $$(S)src/libuv/libuv.a $$@ else -$$(LIBUV_LIB_$(1)): $$(LIBUV_DIR_$(1))/Release/libuv.a $$(MKFILE_DEPS) - $$(Q)cp $$< $$@ -$$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \ - $$(MKFILE_DEPS) +LIBUV_LOCAL_$(1) := $$(LIBUV_DIR_$(1))/Release/libuv.a +$$(LIBUV_LOCAL_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) $$(MKFILE_DEPS) $$(Q)$$(MAKE) -C $$(LIBUV_DIR_$(1)) \ CFLAGS="$$(LIBUV_CFLAGS_$(1)) $$(SNAP_DEFINES)" \ LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_$(1))" \ @@ -231,6 +229,19 @@ $$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \ endif +ifeq ($(1),$$(CFG_BUILD)) +ifneq ($$(CFG_LIBUV_ROOT),) +$$(LIBUV_LIB_$(1)): $$(CFG_LIBUV_ROOT)/libuv.a + $$(Q)cp $$< $$@ +else +$$(LIBUV_LIB_$(1)): $$(LIBUV_LOCAL_$(1)) + $$(Q)cp $$< $$@ +endif +else +$$(LIBUV_LIB_$(1)): $$(LIBUV_LOCAL_$(1)) + $$(Q)cp $$< $$@ +endif + ################################################################################ # jemalloc ################################################################################ @@ -253,8 +264,9 @@ else endif JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1)) JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc +JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1)) -$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS) +$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS) @$$(call E, make: jemalloc) cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \ $$(JEMALLOC_ARGS_$(1)) --enable-cc-silence --with-jemalloc-prefix=je_ \ @@ -265,7 +277,20 @@ $$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS) CPPFLAGS="-I $(S)src/rt/" \ EXTRA_CFLAGS="$$(CFG_CFLAGS_$(1)) -g1" $$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static - $$(Q)cp $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1)) $$(JEMALLOC_LIB_$(1)) + +ifeq ($(1),$$(CFG_BUILD)) +ifneq ($$(CFG_JEMALLOC_ROOT),) +$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a + @$$(call E, copy: jemalloc) + $$(Q)cp $$< $$@ +else +$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1)) + $$(Q)cp $$< $$@ +endif +else +$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1)) + $$(Q)cp $$< $$@ +endif ################################################################################ # compiler-rt