Merge pull request #8 from kiwix/use_ccache

Use ccache
This commit is contained in:
Matthieu Gautier 2017-03-13 13:17:09 +01:00 committed by GitHub
commit 38a14d8af6
4 changed files with 39 additions and 15 deletions

View File

@ -4,6 +4,7 @@ sudo: required
before_install:
- openssl aes-256-cbc -K $encrypted_eba2f7543984_key -iv $encrypted_eba2f7543984_iv
-in travis/travisci_builder_id_key.enc -out travis/travisci_builder_id_key -d
cache: ccache
install: travis/install_extra_deps.sh
script: travis/compile_all.sh
deploy:

View File

@ -76,7 +76,7 @@ CROSS_ENV = {
PACKAGE_NAME_MAPPERS = {
'fedora_native_dyn': {
'COMMON' : ['gcc-c++', 'cmake', 'automake'],
'COMMON' : ['gcc-c++', 'cmake', 'automake', 'ccache'],
'uuid': ['libuuid-devel'],
'xapian-core' : None, # Not the right version on fedora 25
'ctpp2' : None,
@ -87,39 +87,39 @@ PACKAGE_NAME_MAPPERS = {
'zimlib': None,
},
'fedora_native_static' : {
'COMMON' : ['gcc-c++', 'cmake', 'automake', 'glibc-static', 'libstdc++-static'],
'COMMON' : ['gcc-c++', 'cmake', 'automake', 'glibc-static', 'libstdc++-static', 'ccache'],
'zlib' : ['zlib-devel', 'zlib-static']
# Either there is no packages, or no static or too old
},
'fedora_win32_dyn' : {
'COMMON' : ['mingw32-gcc-c++', 'mingw32-bzip2', 'mingw32-win-iconv', 'mingw32-winpthreads', 'wine'],
'COMMON' : ['mingw32-gcc-c++', 'mingw32-bzip2', 'mingw32-win-iconv', 'mingw32-winpthreads', 'wine', 'ccache'],
'zlib' : ['mingw32-zlib'],
'libmicrohttpd' : ['mingw32-libmicrohttpd'],
},
'fedora_win32_static' : {
'COMMON' : ['mingw32-gcc-c++', 'mingw32-bzip2-static', 'mingw32-win-iconv-static', 'mingw32-winpthreads-static', 'wine'],
'COMMON' : ['mingw32-gcc-c++', 'mingw32-bzip2-static', 'mingw32-win-iconv-static', 'mingw32-winpthreads-static', 'wine', 'ccache'],
'zlib' : ['mingw32-zlib-static'],
'libmicrohttpd' : None, # ['mingw32-libmicrohttpd-static'] packaging dependecy seems buggy, and some static lib are name libfoo.dll.a and
# gcc cannot found them.
},
'debian_native_dyn' : {
'COMMON' : ['gcc', 'cmake', 'libbz2-dev'],
'COMMON' : ['gcc', 'cmake', 'libbz2-dev', 'ccache'],
'zlib' : ['zlib1g-dev'],
'uuid' : ['uuid-dev'],
'ctpp2': ['libctpp2-dev'],
'libmicrohttpd' : ['libmicrohttpd-dev']
'libmicrohttpd' : ['libmicrohttpd-dev', 'ccache']
},
'debian_native_static' : {
'COMMON' : ['gcc', 'cmake', 'libbz2-dev'],
'COMMON' : ['gcc', 'cmake', 'libbz2-dev', 'ccache'],
'zlib' : ['zlib1g-dev'],
'uuid' : ['uuid-dev'],
'ctpp2': ['libctpp2-dev'],
},
'debian_win32_dyn' : {
'COMMON' : ['g++-mingw-w64-i686', 'gcc-mingw-w64-i686', 'gcc-mingw-w64-base', 'mingw-w64-tools']
'COMMON' : ['g++-mingw-w64-i686', 'gcc-mingw-w64-i686', 'gcc-mingw-w64-base', 'mingw-w64-tools', 'ccache']
},
'debian_win32_static' : {
'COMMON' : ['g++-mingw-w64-i686', 'gcc-mingw-w64-i686', 'gcc-mingw-w64-base', 'mingw-w64-tools']
'COMMON' : ['g++-mingw-w64-i686', 'gcc-mingw-w64-i686', 'gcc-mingw-w64-base', 'mingw-w64-tools', 'ccache']
},
}
@ -252,7 +252,8 @@ class BuildEnv:
'Tests, bug reports and patches are welcomed.')
if _platform == 'Linux':
self.distname, _, _ = platform.linux_distribution()
if self.distname == 'Ubuntu':
self.distname = self.distname.lower()
if self.distname == 'ubuntu':
self.distname = 'debian'
def finalize_setup(self):
@ -357,7 +358,14 @@ class BuildEnv:
if env['PKG_CONFIG_PATH']
else pkgconfig_path
)
env['PATH'] = ':'.join([pj(self.install_dir, 'bin'), env['PATH']])
# Add ccache path
for p in ('/usr/lib/ccache', '/usr/lib64/ccache'):
if os.path.isdir(p):
ccache_path=[p]
break
else:
ccache_path = []
env['PATH'] = ':'.join([pj(self.install_dir, 'bin')] + ccache_path + [env['PATH']])
ld_library_path = ':'.join([
pj(self.install_dir, 'lib'),
pj(self.install_dir, 'lib64')

View File

@ -10,9 +10,18 @@ PATH="{root_path}/bin:$PATH_ORIG"; export PATH;
HOST_CC=gcc; export HOST_CC;
unset PKG_CONFIG_PATH;
CC={which:{binaries[c]}}; export CC
ccache=`which ccache`
CC={which:{binaries[c]}}
CXX={which:{binaries[cpp]}}
if [ "x$ccache" != "x" ] ; then
CC="ccache $CC"
CXX="ccache $CXX"
fi
export CC
export CXX
AR={which:{binaries[ar]}}; export AR
CXX={which:{binaries[cpp]}}; export CXX
STRIP={which:{binaries[strip]}}; export STRIP
CFLAGS=" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"; export CFLAGS;
CXXFLAGS=" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"; export CXXFLAGS;

View File

@ -2,12 +2,18 @@ SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_PROCESSOR x86)
# specify the cross compiler
SET(CMAKE_C_COMPILER {which:{binaries[c]}})
SET(CMAKE_CXX_COMPILER {which:{binaries[cpp]}})
SET(CMAKE_C_COMPILER "{which:{binaries[c]}}")
SET(CMAKE_CXX_COMPILER "{which:{binaries[cpp]}}")
SET(CMAKE_RC_COMPILER {which:{binaries[windres]}})
SET(CMAKE_AR:FILEPATH {which:{binaries[ar]}})
SET(CMAKE_RANLIB:FILEPATH {which:{binaries[ranlib]}})
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH {root_path})