Skip to content

Commit

Permalink
remove building clang on my own and use system installed instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeorgiev committed May 8, 2016
1 parent 7c3f0d3 commit 920eb51
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 224 deletions.
17 changes: 0 additions & 17 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
[submodule "llvm"]
path = 3rdparty/llvm
url = https://github.com/llvm-mirror/llvm.git
[submodule "clang"]
path = 3rdparty/clang
url = https://github.com/llvm-mirror/clang.git
[submodule "libcxx"]
path = 3rdparty/libcxx
url = https://github.com/llvm-mirror/libcxx.git
[submodule "libcxxabi"]
path = 3rdparty/libcxxabi
url = https://github.com/llvm-mirror/libcxxabi.git

[submodule "iwyu"]
path = 3rdparty/iwyu
url = https://github.com/include-what-you-use/include-what-you-use.git
Expand All @@ -23,10 +10,6 @@
path = 3rdparty/boost
url = https://github.com/boostorg/boost.git

[submodule "clang-tools-extra"]
path = 3rdparty/clang-tools-extra
url = https://github.com/llvm-mirror/clang-tools-extra.git

[submodule "clang-plugin"]
path = 3rdparty/clang-plugin
url = https://github.com/ggeorgiev/clang-plugin.git
Expand Down
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-4.8 g++-4.8 -y ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 ; fi

# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -L https://github.com/ggeorgiev/dbs/releases/download/clang/clang.zip > clang.zip ; fi
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then unzip clang.zip ; fi

- ./prepare.sh travis
- ./prepare.sh

install:

Expand All @@ -35,7 +32,6 @@ script:

cache:
directories:
- clang
- iwyu
- boost
- fmt
Expand Down
1 change: 0 additions & 1 deletion 3rdparty/clang
Submodule clang deleted from 9fd77b
1 change: 0 additions & 1 deletion 3rdparty/clang-tools-extra
Submodule clang-tools-extra deleted from c28852
1 change: 0 additions & 1 deletion 3rdparty/libcxx
Submodule libcxx deleted from fda354
1 change: 0 additions & 1 deletion 3rdparty/libcxxabi
Submodule libcxxabi deleted from 8d4e51
1 change: 0 additions & 1 deletion 3rdparty/llvm
Submodule llvm deleted from 06cf4b
77 changes: 1 addition & 76 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,12 @@
BASEDIR=$(pwd)/$(dirname $0)
cd $BASEDIR

CLANGBIN=$BASEDIR/clang/bin
CLANG=clang++

IWYU=include-what-you-use

CXXFLAGS="-std=c++11 -stdlib=libc++"
CXXFLAGS="$CXXFLAGS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms"
CXXFLAGS="$CXXFLAGS/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"

#PLUGINS="-fcolor-diagnostics"
PLUGINS=

PLUGIN=$BASEDIR/clang/plugin/param_check/ParameterNameChecker.so
if [ -e $PLUGIN ]
then
PLUGINS="$PLUGINS -Xclang -load -Xclang $PLUGIN"
PLUGINS="$PLUGINS -Xclang -plugin -Xclang check-parameter-names"
fi

CXXFLAGS="$CXXFLAGS -Isrc"

FILES=""
Expand Down Expand Up @@ -92,68 +79,6 @@ DEFINES=" -DNDEBUG" && OPTOMIZATION="-O3"
if [ 1 == 1 ]
then
mkdir -p build
PATH=$CLANGBIN:$PATH $CLANG $OPTOMIZATION $CXXFLAGS src/main.cpp $FILES \
clang++ $OPTOMIZATION $CXXFLAGS src/main.cpp $FILES \
$DEFINES $LIBRARIES -o build/dbs && cp build/dbs dbs || exit 1
elif [ 1 == 0 ]
then

CXXFLAGS="$CXXFLAGS -Isrc/gtest/include"

FILES="$FILES src/gtest/time_monitor.cpp src/gtest/performance_arbiter.cpp"

FILES="$FILES src/im/gtest/initialization_manager-utest.cpp"

FILES="$FILES src/log/gtest/log-utest.cpp"

FILES="$FILES src/err/gtest/err-utest.cpp"
FILES="$FILES src/err/gtest/err-ptest.cpp"
FILES="$FILES src/err/gtest/macro-utest.cpp"

FILES="$FILES src/db/gtest/database-utest.cpp"

FILES="$FILES src/dom/gtest/cxx_library-utest.cpp"
FILES="$FILES src/dom/gtest/cxx_program-utest.cpp"

FILES="$FILES src/doim/gtest/manager-utest.cpp"
FILES="$FILES src/doim/gtest/fs/fs_directory-utest.cpp"
FILES="$FILES src/doim/gtest/fs/fs_file-ptest.cpp"

FILES="$FILES src/parser/gtest/parser-utest.cpp"
FILES="$FILES src/parser/gtest/stream-utest.cpp"
FILES="$FILES src/parser/gtest/token-utest.cpp"
FILES="$FILES src/parser/gtest/tokenizer-utest.cpp"
FILES="$FILES src/parser/gtest/cxx/cxx_parser-utest.cpp"

FILES="$FILES src/tpool/gtest/tpool-utest.cpp"
FILES="$FILES src/tpool/gtest/priority-utest.cpp"

FILES="$FILES src/task/gtest/cxx/cxx_file_crc_task-utest.cpp"
FILES="$FILES src/task/gtest/cxx/cxx_header_crc_task-utest.cpp"


LIBRARIES="$LIBRARIES -lgtest"

if [ 1 == 1 ]
then

echo > build/iwyu.log
for FILE in src/main.cpp src/gtest/main.cpp $FILES
do
echo include what you using $FILE ...
PATH=$CLANGBIN:$PATH $IWYU $CXXFLAGS $FILE 2>&1 | \
tee -a build/iwyu.log || exit 1
done

iwyu/bin/fix_includes.py --noblank_lines --nosafe_headers < build/iwyu.log
else
for FILE in src/main.cpp src/gtest/main.cpp $FILES
do
echo clang tidy $FILE ...
PATH=$CLANGBIN:$PATH clang-tidy -checks=*,-llvm-include-order,-google-readability-todo,-cppcoreguidelines-pro-type-vararg,-google-readability-braces-around-statements,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-readability-braces-around-statements -p build $FILE 2>&1 || exit 1
echo
#echo clang check $FILE ...
#PATH=$CLANGBIN:$PATH clang-check -analyze -extra-arg -Xclang -extra-arg -analyzer-output=text -p build $FILE 2>&1 || exit 1
#echo
done
fi
fi
126 changes: 10 additions & 116 deletions prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,12 @@ BASEDIR=$(pwd)/$(dirname $0)

cd $BASEDIR

CMAKE=cmake
CLANG=`xcodebuild -find clang++`
CLANGBIN=$(dirname $CLANG)
CLANGDIR=$(dirname $CLANGBIN)

if [ ! -e clang -o ! "$(ls -A clang)" ]
then
git submodule update --init 3rdparty/clang || exit 1
git submodule update --init 3rdparty/clang-tools-extra || exit 1
git submodule update --init 3rdparty/llvm || exit 1
git submodule update --init 3rdparty/libcxx || exit 1
git submodule update --init 3rdparty/libcxxabi || exit 1

cd 3rdparty || exit 1

echo Build clang ...

echo Copy clang to llvm ...
rm -rf llvm/tools/clang
mkdir -p llvm/tools/clang || exit 1
cp -r clang llvm/tools || exit 1

echo Copy clang extra tools to llvm ...
rm -rf llvm/tools/clang/tools/extra
mkdir -p llvm/tools/clang/tools/extra || exit 1
cp -r clang-tools-extra/ llvm/tools/clang/tools/extra/ || exit 1

echo Copy libcxx to llvm ...
rm -rf llvm/projects/libcxx
mkdir -p llvm/projects/libcxx || exit 1
cp -r libcxx llvm/projects || exit 1

echo Copy libcxxabi to llvm ...
rm -rf llvm/projects/libcxxabi
mkdir -p llvm/projects/libcxxabi || exit 1
cp -r libcxxabi llvm/projects || exit 1

rm -rf clang-build || exit 1
mkdir clang-build || exit 1
cd clang-build || exit 1

echo Prepare make files ...
$CMAKE \
-G "Unix Makefiles" \
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CC_COMPILER=clang \
-DCMAKE_INSTALL_PREFIX:PATH=../../clang \
-DCMAKE_BUILD_TYPE=Release \
../llvm || exit 1

echo Make ...
make -j 8 || exit 1

echo Install ...
make install || exit 1

cd .. || exit 1

rm -rf clang-build

rm -rf llvm/tools/clang
rm -rf llvm/projects/libcxx
rm -rf llvm/projects/libcxxabi

cd .. || exit 1

if [ -e iwyu/bin ]
then
cp iwyu/bin/* $CLANGBIN
fi

if [ "$1" == "travis" ]
then
exit 0
fi
fi

CLANGDIR=$BASEDIR/clang
CLANGBIN=$CLANGDIR/bin
CLANG=$CLANGBIN/clang++

if [ ! -e clang/plugin -o ! "$(ls -A clang/plugin)" ]
#if [ ! -e clang/plugin -o ! "$(ls -A clang/plugin)" ]
if [ 0 == 1 ]
then
git submodule update --init 3rdparty/clang-plugin || exit 1

Expand All @@ -102,15 +30,11 @@ then
cd .. || exit 1

cd ../.. || exit 1

if [ "$1" == "travis" ]
then
exit 0
fi
fi


if [ ! -e iwyu -o ! "$(ls -A iwyu)" ]
#if [ ! -e iwyu -o ! "$(ls -A iwyu)" ]
if [ 0 == 1 ]
then
git submodule update --init 3rdparty/iwyu || exit 1

Expand All @@ -122,7 +46,7 @@ then
mkdir build || exit 1
cd build || exit 1

$CMAKE \
cmake \
-G "Unix Makefiles" \
-DCMAKE_CXX_COMPILER=$CLANG \
-DIWYU_LLVM_ROOT_PATH=$CLANGDIR \
Expand All @@ -139,11 +63,6 @@ then
cd ../.. || exit 1

cp iwyu/bin/* $CLANGBIN

if [ "$1" == "travis" ]
then
exit 0
fi
fi

if [ ! -e gtest -o ! "$(ls -A gtest)" ]
Expand All @@ -158,7 +77,7 @@ then
mkdir build || exit 1
cd build || exit 1

$CMAKE \
cmake \
-G "Unix Makefiles" \
-DCMAKE_CXX_COMPILER=$CLANG \
-DBUILD_SHARED_LIBS=OFF \
Expand All @@ -179,11 +98,6 @@ then
git clean -fdx

cd ../..

if [ "$1" == "travis" ]
then
exit 0
fi
fi

if [ ! -e boost -o ! "$(ls -A boost)" ]
Expand Down Expand Up @@ -269,11 +183,6 @@ then
cd ../..

cd ../..

if [ "$1" == "travis" ]
then
exit 0
fi
fi

if [ ! -e fmt -o ! "$(ls -A fmt)" ]
Expand All @@ -287,7 +196,7 @@ then
mkdir build
cd build

$CMAKE -DCMAKE_CC_COMPILER=$CLANG -DCMAKE_CXX_COMPILER=$CLANG -DCMAKE_INSTALL_PREFIX:PATH=$BASEDIR/fmt .. || exit 1
cmake -DCMAKE_CC_COMPILER=$CLANG -DCMAKE_CXX_COMPILER=$CLANG -DCMAKE_INSTALL_PREFIX:PATH=$BASEDIR/fmt .. || exit 1
CC=$CLANG CXX=$CLANG make || exit 1
make test || exit 1
make install || exit 1
Expand All @@ -297,11 +206,6 @@ then
git clean -fdx

cd ../.. || exit 1

if [ "$1" == "travis" ]
then
exit 0
fi
fi

if [ ! -e spdlog -o ! "$(ls -A spdlog)" ]
Expand All @@ -313,11 +217,6 @@ then
mkdir -p spdlog || exit 1

cp -r 3rdparty/spdlog/include spdlog || exit 1

if [ "$1" == "travis" ]
then
exit 0
fi
fi

if [ ! -e rocksdb -o ! "$(ls -A rocksdb)" ]
Expand All @@ -337,11 +236,6 @@ then
git clean -fdx

cd ../.. || exit 1

if [ "$1" == "travis" ]
then
exit 0
fi
fi


Expand Down
1 change: 1 addition & 0 deletions src/3rdparty/boost.dbs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cxx_library boost_thread
boost/thread/locks.hpp
boost/thread/reverse_lock.hpp
boost/thread/shared_mutex.hpp
boost/thread/tss.hpp
;

cxx_binary: ../../boost/lib/libboost_thread.a;
Expand Down
4 changes: 2 additions & 2 deletions src/err/err.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright © 2015 George Georgiev. All rights reserved.
// Copyright © 2015-2016 George Georgiev. All rights reserved.
//

#include "err/err.h"
#include <functional>

namespace err
{
thread_local ErrorUPtr gError;
boost::thread_specific_ptr<Error> gError;

static bool init()
{
Expand Down
1 change: 1 addition & 0 deletions src/err/err.dbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cxx_library err
../system/cstd
../system/stl

../3rdparty/boost_thread
../3rdparty/cppformat

../im/im
Expand Down
Loading

0 comments on commit 920eb51

Please sign in to comment.