From 621dc8bcf55aa5ce48332236c57b78cb4abf5f8d Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 28 Nov 2019 03:12:47 +0800 Subject: [PATCH] feat: no debug symbols as default and add a command to build with debug symbols --- Cargo.toml | 1 - Makefile | 4 +++ devtools/release/make-with-debug-symbols | 31 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 devtools/release/make-with-debug-symbols diff --git a/Cargo.toml b/Cargo.toml index 9ed0e52f19..4481221070 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,6 @@ members = [ ] [profile.release] -debug = true overflow-checks = true [target.'cfg(all(not(target_env = "msvc"), not(target_os="macos")))'.dependencies] diff --git a/Makefile b/Makefile index 2e3cde6563..1bb4acfd00 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,10 @@ prod-docker: prod-test: RUSTFLAGS="--cfg disable_faketime" RUSTDOCFLAGS="--cfg disable_faketime" cargo test ${VERBOSE} --all -- --nocapture +.PHONY: prod-with-debug +prod-with-debug: + devtools/release/make-with-debug-symbols prod + .PHONY: docker docker: ## Build docker image docker build -f docker/hub/Dockerfile -t nervos/ckb:$$(git describe) . diff --git a/devtools/release/make-with-debug-symbols b/devtools/release/make-with-debug-symbols new file mode 100755 index 0000000000..0fc4f1024c --- /dev/null +++ b/devtools/release/make-with-debug-symbols @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -euo pipefail + +case "$OSTYPE" in + darwin*) + if ! type gsed &> /dev/null; then + echo "GNU sed not found! You can install via Homebrew" >&2 + echo >&2 + echo " brew install gnu-sed" >&2 + exit 1 + fi + SED=gsed + ;; + *) + SED=sed + ;; +esac + +function restore_manifest_file () { + ${SED} -i -e '/\[profile.release\]/{n;d}' Cargo.toml +} + +trap restore_manifest_file EXIT + +function main() { + ${SED} -i "/\[profile.release\]/adebug = true" Cargo.toml + make "$@" +} + +main "$@"