mirror of
https://github.com/girlbossceo/jemallocator.git
synced 2024-12-04 02:06:18 +00:00
*: update jemalloc and simplify build (#1)
- Remove all cross compilation and reduce supporting platforms - Remove complicated checks and builds - Update jemalloc to 5.2.1 - Fix gnzlbg/jemallocator#147 Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
This commit is contained in:
parent
a09f18a739
commit
21c54a2446
73
.travis.yml
73
.travis.yml
|
@ -7,61 +7,17 @@ jobs:
|
||||||
# Linux
|
# Linux
|
||||||
- name: "aarch64-unknown-linux-gnu"
|
- name: "aarch64-unknown-linux-gnu"
|
||||||
env: TARGET=aarch64-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
env: TARGET=aarch64-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
||||||
- name: "arm-unknown-linux-gnueabi"
|
arch: arm64
|
||||||
env: TARGET=arm-unknown-linux-gnueabi NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "armv7-unknown-linux-gnueabihf"
|
|
||||||
env: TARGET=armv7-unknown-linux-gnueabihf NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "i586-unknown-linux-gnu"
|
|
||||||
env: TARGET=i586-unknown-linux-gnu
|
|
||||||
addons: &gcc_multilib
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- gcc-multilib
|
|
||||||
- name: "i686-unknown-linux-gnu (nightly)"
|
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
|
||||||
addons: *gcc_multilib
|
|
||||||
- name: "i686-unknown-linux-gnu (beta)"
|
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
|
||||||
addons: *gcc_multilib
|
|
||||||
rust: beta
|
|
||||||
- name: "i686-unknown-linux-gnu (stable)"
|
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
|
||||||
addons: *gcc_multilib
|
|
||||||
rust: stable
|
|
||||||
# FIXME: blocked onhttps://github.com/jemalloc/jemalloc/issues/1464
|
|
||||||
# - name: "i686-unknown-linux-musl"
|
|
||||||
# env: TARGET=i686-unknown-linux-musl NOBGT=1 NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "mips-unknown-linux-gnu"
|
|
||||||
env: TARGET=mips-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "mips64-unknown-linux-gnuabi64"
|
|
||||||
env: TARGET=mips64-unknown-linux-gnuabi64 NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "mips64el-unknown-linux-gnuabi64"
|
|
||||||
env: TARGET=mips64el-unknown-linux-gnuabi64 NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "mipsel-unknown-linux-gnu"
|
|
||||||
env: TARGET=mipsel-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "powerpc-unknown-linux-gnu"
|
|
||||||
env: TARGET=powerpc-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "powerpc64-unknown-linux-gnu"
|
|
||||||
env: TARGET=powerpc64-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
|
||||||
- name: "powerpc64le-unknown-linux-gnu"
|
- name: "powerpc64le-unknown-linux-gnu"
|
||||||
env: TARGET=powerpc64le-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
env: TARGET=powerpc64le-unknown-linux-gnu NO_JEMALLOC_TESTS=1
|
||||||
|
arch: ppc64le
|
||||||
- name: "x86_64-unknown-linux-gnu (nightly)"
|
- name: "x86_64-unknown-linux-gnu (nightly)"
|
||||||
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 JEMALLOC_SYS_VERIFY_CONFIGURE=1
|
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1
|
||||||
install: rustup component add llvm-tools-preview
|
install: rustup component add llvm-tools-preview
|
||||||
addons: &valgrind
|
addons: &valgrind
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- valgrind
|
- valgrind
|
||||||
- autoconf
|
|
||||||
- name: "x86_64-unknown-linux-gnu (nightly - jemalloc's dev branch)"
|
|
||||||
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1 JEMALLOC_SYS_GIT_DEV_BRANCH=1
|
|
||||||
install: rustup component add llvm-tools-preview
|
|
||||||
addons: *valgrind
|
|
||||||
- name: "x86_64-unknown-linux-gnu (beta)"
|
|
||||||
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1
|
|
||||||
rust: beta
|
|
||||||
install: rustup component add llvm-tools-preview
|
|
||||||
addons: *valgrind
|
|
||||||
- name: "x86_64-unknown-linux-gnu (stable)"
|
- name: "x86_64-unknown-linux-gnu (stable)"
|
||||||
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1
|
env: TARGET=x86_64-unknown-linux-gnu VALGRIND=1
|
||||||
rust: stable
|
rust: stable
|
||||||
|
@ -76,12 +32,11 @@ jobs:
|
||||||
# - cargo test --features=alloc_trait --bench roundtrip
|
# - cargo test --features=alloc_trait --bench roundtrip
|
||||||
- name: "x86_64-unknown-linux-musl"
|
- name: "x86_64-unknown-linux-musl"
|
||||||
env: TARGET=x86_64-unknown-linux-musl NOBGT=1 NO_JEMALLOC_TESTS=1
|
env: TARGET=x86_64-unknown-linux-musl NOBGT=1 NO_JEMALLOC_TESTS=1
|
||||||
|
install: rustup target add x86_64-unknown-linux-musl
|
||||||
# Android
|
addons:
|
||||||
- name: "aarch64-linux-android"
|
apt:
|
||||||
env: TARGET=aarch64-linux-android NO_JEMALLOC_TESTS=1
|
packages:
|
||||||
- name: "x86_64-linux-android"
|
musl-tools
|
||||||
env: TARGET=x86_64-linux-android
|
|
||||||
|
|
||||||
# OSX
|
# OSX
|
||||||
# FIXME: cannot jemalloc tests fail due to:
|
# FIXME: cannot jemalloc tests fail due to:
|
||||||
|
@ -90,20 +45,10 @@ jobs:
|
||||||
# FIXME: valgrind fails on OSX
|
# FIXME: valgrind fails on OSX
|
||||||
# https://github.com/gnzlbg/jemallocator/issues/86
|
# https://github.com/gnzlbg/jemallocator/issues/86
|
||||||
- name: "x86_64-apple-darwin (nightly)"
|
- name: "x86_64-apple-darwin (nightly)"
|
||||||
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 # JEMALLOC_SYS_VERIFY_CONFIGURE=1
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode10
|
|
||||||
install: rustup component add llvm-tools-preview
|
|
||||||
- name: "x86_64-apple-darwin (nightly - jemalloc's dev branch)"
|
|
||||||
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1 JEMALLOC_SYS_GIT_DEV_BRANCH=1
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode10
|
|
||||||
install: rustup component add llvm-tools-preview
|
|
||||||
- name: "x86_64-apple-darwin (beta)"
|
|
||||||
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1
|
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1
|
||||||
os: osx
|
os: osx
|
||||||
osx_image: xcode10
|
osx_image: xcode10
|
||||||
rust: beta
|
install: rustup component add llvm-tools-preview
|
||||||
install: rustup component add llvm-tools-preview
|
install: rustup component add llvm-tools-preview
|
||||||
- name: "x86_64-apple-darwin (stable)"
|
- name: "x86_64-apple-darwin (stable)"
|
||||||
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1
|
env: TARGET=x86_64-apple-darwin NO_JEMALLOC_TESTS=1
|
||||||
|
|
16
Cross.toml
16
Cross.toml
|
@ -1,16 +0,0 @@
|
||||||
[build.env]
|
|
||||||
passthrough = [
|
|
||||||
"RUST_BACKTRACE",
|
|
||||||
"RUST_TEST_THREADS",
|
|
||||||
"RUST_TEST_NOCAPTURE",
|
|
||||||
"NO_JEMALLOC_TESTS",
|
|
||||||
"TERM",
|
|
||||||
"JEMALLOC_SYS_RUN_JEMALLOC_TESTS",
|
|
||||||
"JEMALLOC_SYS_VERIFY_CONFIGURE",
|
|
||||||
"JEMALLOC_SYS_GIT_DEV_BRANCH",
|
|
||||||
"JEMALLOC_SYS_WITH_MALLOC_CONF",
|
|
||||||
"JEMALLOC_SYS_WITH_LG_PAGE",
|
|
||||||
"JEMALLOC_SYS_WITH_LG_HUGEPAGE",
|
|
||||||
"JEMALLOC_SYS_WITH_LG_QUANTUM",
|
|
||||||
"JEMALLOC_SYS_WITH_LG_VADDR"
|
|
||||||
]
|
|
70
ci/run.sh
70
ci/run.sh
|
@ -8,7 +8,6 @@ echo "Running tests for target: ${TARGET}, Rust version=${TRAVIS_RUST_VERSION}"
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
export RUST_TEST_THREADS=1
|
export RUST_TEST_THREADS=1
|
||||||
export RUST_TEST_NOCAPTURE=1
|
export RUST_TEST_NOCAPTURE=1
|
||||||
export CARGO_CMD=cross
|
|
||||||
|
|
||||||
# FIXME: workaround cargo breaking Travis-CI again:
|
# FIXME: workaround cargo breaking Travis-CI again:
|
||||||
# https://github.com/rust-lang/cargo/issues/5721
|
# https://github.com/rust-lang/cargo/issues/5721
|
||||||
|
@ -25,18 +24,6 @@ else
|
||||||
export JEMALLOC_SYS_RUN_JEMALLOC_TESTS=1
|
export JEMALLOC_SYS_RUN_JEMALLOC_TESTS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use cargo on native CI platforms:
|
|
||||||
case "${TARGET}" in
|
|
||||||
"x86_64-unknown-linux-gnu") export CARGO_CMD=cargo ;;
|
|
||||||
*"windows"*) export CARGO_CMD=cargo ;;
|
|
||||||
*"apple"*) export CARGO_CMD=cargo ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "${CARGO_CMD}" = "cross" ]
|
|
||||||
then
|
|
||||||
cargo install cross || echo "cross is already installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${VALGRIND}" = "1" ]
|
if [ "${VALGRIND}" = "1" ]
|
||||||
then
|
then
|
||||||
case "${TARGET}" in
|
case "${TARGET}" in
|
||||||
|
@ -56,7 +43,7 @@ fi
|
||||||
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ]
|
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ]
|
||||||
then
|
then
|
||||||
# Not using tee to avoid too much logs that exceeds travis' limit.
|
# Not using tee to avoid too much logs that exceeds travis' limit.
|
||||||
if ! ${CARGO_CMD} build -vv --target "${TARGET}" > build_no_std.txt 2>&1; then
|
if ! cargo build -vv --target "${TARGET}" > build_no_std.txt 2>&1; then
|
||||||
tail -n 1024 build_no_std.txt
|
tail -n 1024 build_no_std.txt
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -75,42 +62,28 @@ then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}"
|
cargo test --target "${TARGET}"
|
||||||
|
cargo test --target "${TARGET}" --features profiling
|
||||||
|
cargo test --target "${TARGET}" --features debug
|
||||||
|
cargo test --target "${TARGET}" --features stats
|
||||||
|
cargo test --target "${TARGET}" --features 'debug profiling'
|
||||||
|
|
||||||
if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
|
cargo test --target "${TARGET}" \
|
||||||
# FIXME: profiling tests broken on dev-branch
|
--features unprefixed_malloc_on_supported_platforms
|
||||||
# https://github.com/jemalloc/jemalloc/issues/1477
|
cargo test --target "${TARGET}" --no-default-features
|
||||||
:
|
cargo test --target "${TARGET}" --no-default-features \
|
||||||
else
|
--features background_threads_runtime_support
|
||||||
${CARGO_CMD} test --target "${TARGET}" --features profiling
|
|
||||||
fi
|
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --features debug
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --features stats
|
|
||||||
if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
|
|
||||||
# FIXME: profiling tests broken on dev-branch
|
|
||||||
# https://github.com/jemalloc/jemalloc/issues/1477
|
|
||||||
:
|
|
||||||
else
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --features 'debug profiling'
|
|
||||||
fi
|
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" \
|
|
||||||
--features unprefixed_malloc_on_supported_platforms
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --no-default-features
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --no-default-features \
|
|
||||||
--features background_threads_runtime_support
|
|
||||||
|
|
||||||
if [ "${NOBGT}" = "1" ]
|
if [ "${NOBGT}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "enabling background threads by default at run-time is not tested"
|
echo "enabling background threads by default at run-time is not tested"
|
||||||
else
|
else
|
||||||
${CARGO_CMD} test --target "${TARGET}" --features background_threads
|
cargo test --target "${TARGET}" --features background_threads
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" --release
|
cargo test --target "${TARGET}" --release
|
||||||
${CARGO_CMD} test --target "${TARGET}" --manifest-path jemalloc-sys/Cargo.toml
|
cargo test --target "${TARGET}" --manifest-path jemalloc-sys/Cargo.toml
|
||||||
${CARGO_CMD} test --target "${TARGET}" \
|
cargo test --target "${TARGET}" \
|
||||||
--manifest-path jemalloc-sys/Cargo.toml \
|
--manifest-path jemalloc-sys/Cargo.toml \
|
||||||
--features unprefixed_malloc_on_supported_platforms
|
--features unprefixed_malloc_on_supported_platforms
|
||||||
|
|
||||||
|
@ -120,9 +93,9 @@ case "${TARGET}" in
|
||||||
"x86_64-unknown-linux-musl") ;;
|
"x86_64-unknown-linux-musl") ;;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" \
|
cargo test --target "${TARGET}" \
|
||||||
--manifest-path jemalloc-ctl/Cargo.toml \
|
--manifest-path jemalloc-ctl/Cargo.toml \
|
||||||
--no-default-features
|
--no-default-features
|
||||||
# FIXME: cross fails to pass features to jemalloc-ctl
|
# FIXME: cross fails to pass features to jemalloc-ctl
|
||||||
# ${CARGO_CMD} test --target "${TARGET}" \
|
# ${CARGO_CMD} test --target "${TARGET}" \
|
||||||
# --manifest-path jemalloc-ctl \
|
# --manifest-path jemalloc-ctl \
|
||||||
|
@ -130,10 +103,9 @@ case "${TARGET}" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
${CARGO_CMD} test --target "${TARGET}" -p systest
|
cargo test --target "${TARGET}" -p systest
|
||||||
${CARGO_CMD} test --target "${TARGET}" \
|
cargo test --target "${TARGET}" --manifest-path jemallocator-global/Cargo.toml
|
||||||
--manifest-path jemallocator-global/Cargo.toml
|
cargo test --target "${TARGET}" \
|
||||||
${CARGO_CMD} test --target "${TARGET}" \
|
|
||||||
--manifest-path jemallocator-global/Cargo.toml \
|
--manifest-path jemallocator-global/Cargo.toml \
|
||||||
--features force_global_jemalloc
|
--features force_global_jemalloc
|
||||||
|
|
||||||
|
|
|
@ -144,10 +144,6 @@ hyphens `-` are replaced with underscores `_`(see
|
||||||
virtual address size on those platforms where it knows how, and picks a
|
virtual address size on those platforms where it knows how, and picks a
|
||||||
default otherwise. This option may be useful when cross-compiling.
|
default otherwise. This option may be useful when cross-compiling.
|
||||||
|
|
||||||
* `JEMALLOC_SYS_GIT_DEV_BRANCH`: when this environment variable is defined, the
|
|
||||||
latest commit from `jemalloc`'s dev branch is fetched from
|
|
||||||
`https://github.com/jemalloc/jemalloc` and built.
|
|
||||||
|
|
||||||
[jemalloc_install]: https://github.com/jemalloc/jemalloc/blob/dev/INSTALL.md#advanced-configuration
|
[jemalloc_install]: https://github.com/jemalloc/jemalloc/blob/dev/INSTALL.md#advanced-configuration
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
@ -116,8 +116,6 @@ fn main() {
|
||||||
println!("cargo:rustc-link-lib={}={}", kind, &stem[3..]);
|
println!("cargo:rustc-link-lib={}={}", kind, &stem[3..]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::create_dir_all(&build_dir).unwrap();
|
|
||||||
// Disable -Wextra warnings - jemalloc doesn't compile free of warnings with
|
// Disable -Wextra warnings - jemalloc doesn't compile free of warnings with
|
||||||
// it enabled: https://github.com/jemalloc/jemalloc/issues/1196
|
// it enabled: https://github.com/jemalloc/jemalloc/issues/1196
|
||||||
let compiler = cc::Build::new().extra_warnings(false).get_compiler();
|
let compiler = cc::Build::new().extra_warnings(false).get_compiler();
|
||||||
|
@ -131,78 +129,31 @@ fn main() {
|
||||||
info!("CFLAGS={:?}", cflags);
|
info!("CFLAGS={:?}", cflags);
|
||||||
|
|
||||||
assert!(out_dir.exists(), "OUT_DIR does not exist");
|
assert!(out_dir.exists(), "OUT_DIR does not exist");
|
||||||
let (jemalloc_repo_dir, run_autoconf) = if env::var("JEMALLOC_SYS_GIT_DEV_BRANCH").is_ok() {
|
let jemalloc_repo_dir = PathBuf::from("jemalloc");
|
||||||
let jemalloc_repo = out_dir.join("jemalloc_repo");
|
|
||||||
if jemalloc_repo.exists() {
|
|
||||||
fs::remove_dir_all(jemalloc_repo.clone()).unwrap();
|
|
||||||
}
|
|
||||||
let mut cmd = Command::new("git");
|
|
||||||
cmd.arg("clone")
|
|
||||||
.arg("--depth=1")
|
|
||||||
.arg("--branch=dev")
|
|
||||||
.arg("--")
|
|
||||||
.arg("https://github.com/jemalloc/jemalloc")
|
|
||||||
.arg(format!("{}", jemalloc_repo.display()));
|
|
||||||
run(&mut cmd);
|
|
||||||
(jemalloc_repo, true)
|
|
||||||
} else {
|
|
||||||
(PathBuf::from("jemalloc"), false)
|
|
||||||
};
|
|
||||||
info!("JEMALLOC_REPO_DIR={:?}", jemalloc_repo_dir);
|
info!("JEMALLOC_REPO_DIR={:?}", jemalloc_repo_dir);
|
||||||
|
|
||||||
let jemalloc_src_dir = out_dir.join("jemalloc");
|
if build_dir.exists() {
|
||||||
info!("JEMALLOC_SRC_DIR={:?}", jemalloc_src_dir);
|
fs::remove_dir_all(build_dir.clone()).unwrap();
|
||||||
|
|
||||||
if jemalloc_src_dir.exists() {
|
|
||||||
fs::remove_dir_all(jemalloc_src_dir.clone()).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy jemalloc submodule to the OUT_DIR
|
// Copy jemalloc submodule to the OUT_DIR
|
||||||
let mut copy_options = fs_extra::dir::CopyOptions::new();
|
let mut copy_options = fs_extra::dir::CopyOptions::new();
|
||||||
copy_options.overwrite = true;
|
copy_options.overwrite = true;
|
||||||
copy_options.copy_inside = true;
|
copy_options.copy_inside = true;
|
||||||
fs_extra::dir::copy(&jemalloc_repo_dir, &jemalloc_src_dir, ©_options)
|
fs_extra::dir::copy(&jemalloc_repo_dir, &build_dir, ©_options)
|
||||||
.expect("failed to copy jemalloc source code to OUT_DIR");
|
.expect("failed to copy jemalloc source code to OUT_DIR");
|
||||||
assert!(jemalloc_src_dir.exists());
|
assert!(build_dir.exists());
|
||||||
|
|
||||||
// Configuration files
|
// Configuration files
|
||||||
let config_files = ["configure" /*"VERSION"*/];
|
let config_files = ["configure", "VERSION"];
|
||||||
|
|
||||||
// Verify that the configuration files are up-to-date
|
// Copy the configuration files to jemalloc's source directory
|
||||||
let verify_configure = env::var("JEMALLOC_SYS_VERIFY_CONFIGURE").is_ok();
|
for f in &config_files {
|
||||||
if verify_configure || run_autoconf {
|
fs::copy(Path::new("configure").join(f), build_dir.join(f))
|
||||||
info!("Verifying that configuration files in `configure/` are up-to-date... ");
|
.expect("failed to copy config file to OUT_DIR");
|
||||||
|
|
||||||
// The configuration file from the configure/directory should be used.
|
|
||||||
// The jemalloc git submodule shouldn't contain any configuration files.
|
|
||||||
assert!(
|
|
||||||
!jemalloc_src_dir.join("configure").exists(),
|
|
||||||
"the jemalloc submodule contains configuration files"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Run autoconf:
|
|
||||||
let mut cmd = Command::new("autoconf");
|
|
||||||
cmd.current_dir(jemalloc_src_dir.clone());
|
|
||||||
run(&mut cmd);
|
|
||||||
|
|
||||||
for f in &config_files {
|
|
||||||
if verify_configure {
|
|
||||||
let mut cmd = Command::new("diff");
|
|
||||||
run(cmd
|
|
||||||
.arg(&jemalloc_src_dir.join(f))
|
|
||||||
.arg(&Path::new("configure").join(f)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Copy the configuration files to jemalloc's source directory
|
|
||||||
for f in &config_files {
|
|
||||||
fs::copy(Path::new("configure").join(f), jemalloc_src_dir.join(f))
|
|
||||||
.expect("failed to copy config file to OUT_DIR");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run configure:
|
// Run configure:
|
||||||
let configure = jemalloc_src_dir.join("configure");
|
let configure = build_dir.join("configure");
|
||||||
let mut cmd = Command::new("sh");
|
let mut cmd = Command::new("sh");
|
||||||
cmd.arg(
|
cmd.arg(
|
||||||
configure
|
configure
|
||||||
|
@ -311,13 +262,12 @@ fn main() {
|
||||||
cmd.arg(format!("--build={}", gnu_target(&host)));
|
cmd.arg(format!("--build={}", gnu_target(&host)));
|
||||||
cmd.arg(format!("--prefix={}", out_dir.display()));
|
cmd.arg(format!("--prefix={}", out_dir.display()));
|
||||||
|
|
||||||
run(&mut cmd);
|
run_and_log(&mut cmd, &build_dir.join("config.log"));
|
||||||
|
|
||||||
// Make:
|
// Make:
|
||||||
let make = make_cmd(&host);
|
let make = make_cmd(&host);
|
||||||
run(Command::new(make)
|
run(Command::new(make)
|
||||||
.current_dir(&build_dir)
|
.current_dir(&build_dir)
|
||||||
.arg("srcroot=../jemalloc/")
|
|
||||||
.arg("-j")
|
.arg("-j")
|
||||||
.arg(num_jobs.clone()));
|
.arg(num_jobs.clone()));
|
||||||
|
|
||||||
|
@ -326,22 +276,17 @@ fn main() {
|
||||||
// Make tests:
|
// Make tests:
|
||||||
run(Command::new(make)
|
run(Command::new(make)
|
||||||
.current_dir(&build_dir)
|
.current_dir(&build_dir)
|
||||||
.arg("srcroot=../jemalloc/")
|
|
||||||
.arg("-j")
|
.arg("-j")
|
||||||
.arg(num_jobs.clone())
|
.arg(num_jobs.clone())
|
||||||
.arg("tests"));
|
.arg("tests"));
|
||||||
|
|
||||||
// Run tests:
|
// Run tests:
|
||||||
run(Command::new(make)
|
run(Command::new(make).current_dir(&build_dir).arg("check"));
|
||||||
.current_dir(&build_dir)
|
|
||||||
.arg("srcroot=../jemalloc/")
|
|
||||||
.arg("check"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make install:
|
// Make install:
|
||||||
run(Command::new(make)
|
run(Command::new(make)
|
||||||
.current_dir(&build_dir)
|
.current_dir(&build_dir)
|
||||||
.arg("srcroot=../jemalloc/")
|
|
||||||
.arg("install_lib_static")
|
.arg("install_lib_static")
|
||||||
.arg("install_include")
|
.arg("install_include")
|
||||||
.arg("-j")
|
.arg("-j")
|
||||||
|
@ -370,13 +315,24 @@ fn main() {
|
||||||
println!("cargo:rerun-if-changed=jemalloc");
|
println!("cargo:rerun-if-changed=jemalloc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn run_and_log(cmd: &mut Command, log_file: &Path) {
|
||||||
|
execute(cmd, || {
|
||||||
|
run(Command::new("tail").arg("-n").arg("100").arg(log_file));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn run(cmd: &mut Command) {
|
fn run(cmd: &mut Command) {
|
||||||
|
execute(cmd, || ());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn execute(cmd: &mut Command, on_fail: impl FnOnce()) {
|
||||||
println!("running: {:?}", cmd);
|
println!("running: {:?}", cmd);
|
||||||
let status = match cmd.status() {
|
let status = match cmd.status() {
|
||||||
Ok(status) => status,
|
Ok(status) => status,
|
||||||
Err(e) => panic!("failed to execute command: {}", e),
|
Err(e) => panic!("failed to execute command: {}", e),
|
||||||
};
|
};
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
|
on_fail();
|
||||||
panic!(
|
panic!(
|
||||||
"command did not execute successfully: {:?}\n\
|
"command did not execute successfully: {:?}\n\
|
||||||
expected success, got: {}",
|
expected success, got: {}",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4
|
5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756
|
||||||
|
|
854
jemalloc-sys/configure/configure
vendored
854
jemalloc-sys/configure/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -1 +1 @@
|
||||||
Subproject commit 61efbda7098de6fe64c362d309824864308c36d4
|
Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756
|
Loading…
Reference in a new issue