mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 17:11:59 +00:00
Upgrade bundled clang+llvm to 5.0.0, fixes #41
This commit is contained in:
parent
2b54296992
commit
7df44f75a7
48
wscript
48
wscript
@ -7,11 +7,11 @@ except ImportError:
|
|||||||
from urllib.request import urlopen # Python 3
|
from urllib.request import urlopen # Python 3
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
from subprocess import call
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = '0.0.1'
|
VERSION = '0.0.1'
|
||||||
APPNAME='indexer'
|
APPNAME = 'cquery'
|
||||||
|
|
||||||
top = '.'
|
top = '.'
|
||||||
out = 'build'
|
out = 'build'
|
||||||
@ -21,40 +21,27 @@ out = 'build'
|
|||||||
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz
|
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz
|
||||||
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
|
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
|
||||||
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
|
# http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
|
||||||
# TODO: windows support (it's an exe!)
|
|
||||||
|
|
||||||
global CLANG_PLATFORM_NAME
|
# Version of clang to download and use.
|
||||||
global CLANG_TARBALL_PLATFORM_NAME
|
CLANG_VERSION = '5.0.0'
|
||||||
|
|
||||||
if sys.platform == 'linux' or sys.platform == 'linux2':
|
if sys.platform == 'darwin':
|
||||||
#CLANG_PLATFORM_NAME = 'linux-x86_64-ubuntu14.04'
|
CLANG_TARBALL_NAME = 'clang+llvm-{0}-x86_64-apple-darwin'.format(CLANG_VERSION)
|
||||||
CLANG_PLATFORM_NAME = 'x86_64-linux-gnu-ubuntu-14.04'
|
elif sys.platform.startswith('freebsd'):
|
||||||
CLANG_TARBALL_PLATFORM_NAME = 'clang+llvm'
|
CLANG_TARBALL_NAME = 'clang+llvm-{0}-amd64-unknown-freebsd10'.format(CLANG_VERSION)
|
||||||
elif sys.platform == 'darwin':
|
# It is either 'linux2' or 'linux3' before Python 3.3
|
||||||
CLANG_PLATFORM_NAME = 'x86_64-apple-darwin'
|
elif sys.platform.startswith('linux'):
|
||||||
CLANG_TARBALL_PLATFORM_NAME = 'clang+llvm'
|
# These executable depend on libtinfo.so.5
|
||||||
|
CLANG_TARBALL_NAME = 'clang+llvm-{0}-linux-x86_64-ubuntu14.04'.format(CLANG_VERSION)
|
||||||
else:
|
else:
|
||||||
|
# TODO: windows support (it's an exe!)
|
||||||
sys.stderr.write('ERROR: Unknown platform {0}\n'.format(sys.platform))
|
sys.stderr.write('ERROR: Unknown platform {0}\n'.format(sys.platform))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Version of clang to download and use.
|
|
||||||
#CLANG_VERSION = '5.0.0'
|
|
||||||
CLANG_VERSION = '4.0.0'
|
|
||||||
# Tarball name on clang servers that should be used.
|
|
||||||
CLANG_TARBALL_NAME = '{0}-{1}-{2}'.format(CLANG_TARBALL_PLATFORM_NAME, CLANG_VERSION, CLANG_PLATFORM_NAME)
|
|
||||||
# Directory clang has been extracted to.
|
# Directory clang has been extracted to.
|
||||||
CLANG_DIRECTORY = '{0}/{1}'.format(out, CLANG_TARBALL_NAME)
|
CLANG_DIRECTORY = '{0}/{1}'.format(out, CLANG_TARBALL_NAME)
|
||||||
# URL of the tarball to download.
|
# URL of the tarball to download.
|
||||||
CLANG_TARBALL_URL = 'http://releases.llvm.org/{0}/{1}.tar.xz'.format(CLANG_VERSION, CLANG_TARBALL_NAME)
|
CLANG_TARBALL_URL = 'http://releases.llvm.org/{0}/{1}.tar.xz'.format(CLANG_VERSION, CLANG_TARBALL_NAME)
|
||||||
# Path to locally tarball.
|
|
||||||
CLANG_TARBALL_LOCAL_PATH = '{0}.tar.xz'.format(CLANG_DIRECTORY)
|
|
||||||
|
|
||||||
# Directory libcxx will be extracted to.
|
|
||||||
LIBCXX_DIRECTORY = '{0}/libcxx'.format(out)
|
|
||||||
# URL to download libcxx from.
|
|
||||||
LIBCXX_URL = 'http://releases.llvm.org/4.0.0/libcxx-4.0.0.src.tar.xz'
|
|
||||||
# Absolute path for where to download the URL.
|
|
||||||
LIBCXX_LOCAL_PATH = '{0}/libcxx-4.0.0.src.tar.xz'.format(out)
|
|
||||||
|
|
||||||
from waflib.Tools.compiler_cxx import cxx_compiler
|
from waflib.Tools.compiler_cxx import cxx_compiler
|
||||||
cxx_compiler['linux'] = ['clang++', 'g++']
|
cxx_compiler['linux'] = ['clang++', 'g++']
|
||||||
@ -69,7 +56,8 @@ def options(opt):
|
|||||||
grp.add_option('--clang-prefix', dest='clang_prefix', default='',
|
grp.add_option('--clang-prefix', dest='clang_prefix', default='',
|
||||||
help='enable fallback configuration method by specifying a clang installation prefix (e.g. /opt/llvm)')
|
help='enable fallback configuration method by specifying a clang installation prefix (e.g. /opt/llvm)')
|
||||||
|
|
||||||
def download_and_extract(destdir, dest, url):
|
def download_and_extract(destdir, url):
|
||||||
|
dest = destdir + '.tar.xz'
|
||||||
# Download and save the compressed tarball as |compressed_file_name|.
|
# Download and save the compressed tarball as |compressed_file_name|.
|
||||||
if not os.path.isfile(dest):
|
if not os.path.isfile(dest):
|
||||||
print('Downloading tarball')
|
print('Downloading tarball')
|
||||||
@ -86,7 +74,7 @@ def download_and_extract(destdir, dest, url):
|
|||||||
if not os.path.isdir(destdir):
|
if not os.path.isdir(destdir):
|
||||||
print('Extracting')
|
print('Extracting')
|
||||||
# TODO: make portable.
|
# TODO: make portable.
|
||||||
call(['tar', 'xf', dest, '-C', out])
|
subprocess.call(['tar', '-x', '-C', out, '-f', dest])
|
||||||
else:
|
else:
|
||||||
print('Found extracted at {0}'.format(destdir))
|
print('Found extracted at {0}'.format(destdir))
|
||||||
|
|
||||||
@ -126,7 +114,7 @@ def configure(conf):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
print('Checking for clang')
|
print('Checking for clang')
|
||||||
download_and_extract(CLANG_DIRECTORY, CLANG_TARBALL_LOCAL_PATH, CLANG_TARBALL_URL)
|
download_and_extract(CLANG_DIRECTORY, CLANG_TARBALL_URL)
|
||||||
clang_node = conf.path.find_dir(CLANG_DIRECTORY)
|
clang_node = conf.path.find_dir(CLANG_DIRECTORY)
|
||||||
|
|
||||||
conf.check_cxx(uselib_store='clang',
|
conf.check_cxx(uselib_store='clang',
|
||||||
@ -165,7 +153,7 @@ def build(bld):
|
|||||||
cc_files = bld.path.ant_glob(['src/*.cc'])
|
cc_files = bld.path.ant_glob(['src/*.cc'])
|
||||||
|
|
||||||
lib = []
|
lib = []
|
||||||
if sys.platform == 'linux' or sys.platform == 'linux2':
|
if sys.platform.startswith('linux'):
|
||||||
lib.append('rt')
|
lib.append('rt')
|
||||||
lib.append('pthread')
|
lib.append('pthread')
|
||||||
lib.append('dl')
|
lib.append('dl')
|
||||||
|
Loading…
Reference in New Issue
Block a user