From bc8eed12d9d53ccd8d4fedb9eb0c31a6437a2484 Mon Sep 17 00:00:00 2001 From: Jim Paton Date: Thu, 22 Aug 2013 14:53:51 -0700 Subject: [PATCH] Do not use relative paths in build system Summary: Previously, RocksDB's build scripts used relative pathnames like ./build_detect_platform. This can cause problems if the user uses CDPATH. Also, it just doesn't seem right to me. Test Plan: make clean make -j32 check Reviewers: MarkCallaghan, dhruba, kailiu Reviewed By: kailiu CC: leveldb Differential Revision: https://reviews.facebook.net/D12459 --- Makefile | 2 +- build_tools/build_detect_platform | 8 ++++---- build_tools/build_detect_version | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 196b88c4c..f2e2a0f2b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ OPT += -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer #----------------------------------------------- # detect what platform we're building on -$(shell (cd build_tools/; ROCKSDB_ROOT=.. ./build_detect_platform ../build_config.mk)) +$(shell (export ROCKSDB_ROOT=$(CURDIR); $(CURDIR)/build_tools/build_detect_platform $(CURDIR)/build_config.mk)) # this file is generated by the previous line to set build flags and sources include build_config.mk diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index d0d1e61ca..ecc408fe2 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -31,9 +31,9 @@ fi # Default to fbcode gcc on internal fb machines if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then if [ -z "$USE_CLANG" ]; then - source ./fbcode.gcc471.sh + source $PWD/build_tools/fbcode.gcc471.sh else - source ./fbcode.clang31.sh + source $PWD/build_tools/fbcode.clang31.sh fi fi @@ -65,7 +65,7 @@ PLATFORM_SHARED_CFLAGS="-fPIC" PLATFORM_SHARED_VERSIONED=true # generic port files (working on all platform by #ifdef) go directly in /port -GENERIC_PORT_FILES=`cd $ROCKSDB_ROOT; find port -name '*.cc' | tr "\n" " "` +GENERIC_PORT_FILES=`find $ROCKSDB_ROOT/port -name '*.cc' | tr "\n" " "` # On GCC, we pick libc's memcmp over GCC's memcmp via -fno-builtin-memcmp case "$TARGET_OS" in @@ -127,7 +127,7 @@ case "$TARGET_OS" in exit 1 esac -./build_detect_version +$PWD/build_tools/build_detect_version # We want to make a list of all cc files within util, db, table, and helpers # except for the test and benchmark files. By default, find will output a list diff --git a/build_tools/build_detect_version b/build_tools/build_detect_version index 0580a56be..513d89a71 100755 --- a/build_tools/build_detect_version +++ b/build_tools/build_detect_version @@ -19,15 +19,15 @@ if [ "$?" = 0 ]; then awk ' BEGIN { print "#include \"build_version.h\"\n" - } + } { print "const char* leveldb_build_git_sha = \"leveldb_build_git_sha:" $0"\";" } ' > ${VFILE} else echo "git not found" | awk ' BEGIN { - print "#include \"build_version.h\"" - } + print "#include \"build_version.h\"" + } { print "const char* leveldb_build_git_sha = \"leveldb_build_git_sha:git not found\";" } ' > ${VFILE} fi