/devtools/trunk

To get this branch, use:
bzr branch /scm/loggerhead/devtools/trunk
183 by Marcin Wojdyr
minor updated here and there
1
# configuration file reference is available at:
63 by Marcin Wojdyr
updated ccp4-jhbuild
2
# http://developer.gnome.org/jhbuild/unstable/config-reference.html.en
1 by Marcin Wojdyr
initial revision of jhbuild config
3
16 by Marcin Wojdyr
updated ccp4-jhbuild docs
4
# default root directory for directories below
1 by Marcin Wojdyr
initial revision of jhbuild config
5
_topdir = os.getcwd()
6
70 by Marcin Wojdyr
changes in configuration file
7
# cross-compilation is started by: TARGET=i686-pc-mingw32 ./cj ...
8
_target = os.getenv('TARGET')
9
3 by Marcin Wojdyr
added jhbuild copy, jh script, .bzrignore
10
# directory where source code is downloaded from repositories...
1 by Marcin Wojdyr
initial revision of jhbuild config
11
checkoutroot = os.path.join(_topdir, 'checkout')
3 by Marcin Wojdyr
added jhbuild copy, jh script, .bzrignore
12
# ...and from ftp
13
tarballdir = checkoutroot
1 by Marcin Wojdyr
initial revision of jhbuild config
14
15
# build directory, set to None to use in-source build
948 by Marcin Wojdyr
changed default build directory from build to builddir, for consistency
16
buildroot = os.path.join(_topdir, 'builddir')
1 by Marcin Wojdyr
initial revision of jhbuild config
17
18
# installation prefix
869 by Marcin Wojdyr
don't use $RELEASE, use devtools from release branch instead
19
prefix = os.path.join(_topdir, 'install')
1 by Marcin Wojdyr
initial revision of jhbuild config
20
1002 by Marcin Wojdyr
conf.py: "deprecate" option use_lib64
21
# this option should not be changed for now (it will be removed later)
280 by Marcin Wojdyr
conf.py: add use_lib64=False (for compatibility with other ccp4 builds)
22
use_lib64 = False
23
406 by Marcin Wojdyr
conf.py: set partial_build=False as default; fixes for static build
24
# when set to True, building of some libraries is skipped if up-to-date
25
# version is installed system-wise (which is verified using pkg-config)
26
partial_build = False
27
203 by Marcin Wojdyr
rearranged conf.py and modified README
28
# for cross-compilation, add compiler prefix to directory names
29
if _target:
30
    buildroot += "-%s" % _target
31
    prefix += "-%s" % _target
32
198 by Marcin Wojdyr
on Windows, always use lib not lib64
33
_for_windows = (sys.platform == 'win32' or (_target and 'mingw' in _target))
203 by Marcin Wojdyr
rearranged conf.py and modified README
34
482 by Marcin Wojdyr
conf.py: clean up tcl configuration
35
# directory where Tcl/Tk is installed (set to '' if Tcl is in the system path)
196 by Marcin Wojdyr
misc changes:
36
_tcldir = _topdir + '/TclTk84'
482 by Marcin Wojdyr
conf.py: clean up tcl configuration
37
# Tcl library name (no need to change it, for Windows the dot is removed)
191 by Marcin Wojdyr
modified parts in README and conf.py related to Tcl/Tk
38
_tcllib = 'tcl8.4'
39
595 by Marcin Wojdyr
conf.py: set default compilers to usual GCC names
40
# compilers (can be set differently from command line or from cj.rc)
656 by Marcin Wojdyr
very minor changes to conf.py
41
# If compilers are not set, they are guessed by build scripts of individual
42
# modules. It usually works fine, but sometimes, when the user has multiple
43
# compilers installed cmake and autotools scripts pick different ones,
44
# what may lead to puzzling linking errors. So we rather set them explicitely
45
# (unless cross-compiling)
46
if not _target:
47
    os.environ.setdefault('CC', "gcc")
48
    os.environ.setdefault('CXX', "g++")
49
    os.environ.setdefault('FC', "gfortran")
203 by Marcin Wojdyr
rearranged conf.py and modified README
50
302 by Marcin Wojdyr
conf.py: add note that cctbx ignores CC/CXX
51
# Note: cctbx/phaser ignores compiler settings above. It supports only
52
# a few hardcoded (in libtbx/SConscript) choices of compilers, that may
53
# be selected by adding "--compiler=name" in _cctbx_configure_args
54
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
55
# set STATIC=1 to build and link with static libraries (default: shared)
56
_static = os.getenv('STATIC') in ("1", "Y", "y")
57
# BUILD_STATIC=1 to just build static libraries
58
_build_static = _static or (os.getenv('BUILD_STATIC') in ("1", "Y", "y"))
59
60
# compiler flags (respect flags set explicitely)
61
# note: cmake ignores CPPFLAGS http://www.cmake.org/Bug/view.php?id=12928
62
_common_flags = os.getenv('FLAGS') or '-O2' # -march=i686 -Wall -W
63
os.environ.setdefault('CFLAGS', _common_flags)
64
os.environ.setdefault('FFLAGS', _common_flags)
65
os.environ.setdefault('CXXFLAGS', _common_flags)
626 by Marcin Wojdyr
conf.py: don't pass -static to cctbx-phaser through LDFLAGS
66
os.environ.setdefault('LDFLAGS', '')
101 by Marcin Wojdyr
updated ccp4-jhbuild
67
203 by Marcin Wojdyr
rearranged conf.py and modified README
68
# cctbx has a different build system, but it understands some env. vars.
69
_cctbx_configure_args = [ '--build=release',
70
                          #'--build-boost-python-extensions=False',
71
                          '--enable-openmp-if-possible=True',
679 by Marcin Wojdyr
ccp4.xml & conf.py: build boost with python and cctbx with external boost
72
                          '--use-system-libs=boost',
203 by Marcin Wojdyr
rearranged conf.py and modified README
73
                          '--use-environment-flags']
510 by Charles Ballard
set --compiler for cctbx is CC is set in the environment
74
1066 by Charles Ballard
start bringing in dials and xia2
75
_cctbx_modules = "mmtbx cctbx scitbx tntbx dxtbx rstbx phaser dials xia2"
203 by Marcin Wojdyr
rearranged conf.py and modified README
76
77
# arguments passed to configure scripts (for autotools-based packages) 
204 by Marcin Wojdyr
avoid default autogenargs
78
autogenargs = '--enable-silent-rules'
203 by Marcin Wojdyr
rearranged conf.py and modified README
79
70 by Marcin Wojdyr
changes in configuration file
80
# number of parallel jobs (usually translates to "make -j N")
44 by Marcin Wojdyr
build system: support cross-compilation and a few other tweaks
81
jobs = 2
70 by Marcin Wojdyr
changes in configuration file
82
125 by Marcin Wojdyr
ccp4-jhbuild updated after building on Windows
83
# no need to build libraries that already installed
193 by Marcin Wojdyr
comment out "skip" in default conf.py and some cosmetic changes
84
#skip += ["zlib", "libxml2"]
85
#skip += ["lapack", "fftw2", "libjpeg"]
16 by Marcin Wojdyr
updated ccp4-jhbuild docs
86
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
87
_x11dir = None
88
if sys.platform == 'darwin':
1224 by Marcin Wojdyr
fix missing '/' when compiling with $SDKROOT set
89
    _x11dir = os.getenv('SDKROOT', '') + '/usr/X11'
56 by Marcin Wojdyr
a few small updates
90
203 by Marcin Wojdyr
rearranged conf.py and modified README
91
################## end of user-friendly configuration #####################
70 by Marcin Wojdyr
changes in configuration file
92
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
93
# choose between shared and static libraries
94
if _build_static:
95
    autogenargs += ' --disable-shared --enable-static'
1047 by Marcin Wojdyr
always call cmake with -DBUILD_SHARED_LIBS=...
96
    cmakeargs += ' -DBUILD_SHARED_LIBS=OFF'
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
97
    _cctbx_configure_args += ['--static-libraries']
98
else:
99
    autogenargs += ' --enable-shared --disable-static'
1047 by Marcin Wojdyr
always call cmake with -DBUILD_SHARED_LIBS=...
100
    cmakeargs += ' -DBUILD_SHARED_LIBS=ON'
101
    module_cmakeargs['lapack'] = cmakeargs + " -DBUILD_STATIC_LIBS=OFF"
229 by Marcin Wojdyr
conf.py: add relative rpath (+ hack in modtypes/autotools.py to quote $)
102
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
103
if _static:
626 by Marcin Wojdyr
conf.py: don't pass -static to cctbx-phaser through LDFLAGS
104
    for _m in ['zlib', 'cctbx-phaser']:
105
        module_extra_env.setdefault(_m, {}).setdefault('LDFLAGS',
106
                                                    os.environ['LDFLAGS'])
406 by Marcin Wojdyr
conf.py: set partial_build=False as default; fixes for static build
107
    # '-static' flag is eaten by libtool, but -Wl,-static may not work at all
108
    os.environ['LDFLAGS'] += ' -static'
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
109
    cmakeargs += ' -D USE_STATIC=1'
110
    _cctbx_configure_args += ['--static-exe']
406 by Marcin Wojdyr
conf.py: set partial_build=False as default; fixes for static build
111
    os.environ['PKG_CONFIG'] = "pkg-config --static"
1009 by Marcin Wojdyr
conf.py: simplify rpath handling
112
113
if sys.platform.startswith('linux') and not _for_windows:
114
    # '$' in -Wl,-rpath,$ORIGIN/... needs to be escaped differently
115
    # in different build scripts. It's easier to use $LD_RUN_PATH + patchelf.
116
    # (patchelf or chrpath is needed because libtool inserts own rpath)
117
    os.environ['LD_RUN_PATH'] = '$ORIGIN/../lib'
118
    cmakeargs += ' -D CMAKE_SKIP_RPATH=1' # prevent rpath removal on install
119
    module_autogenargs['qt4'] = '-no-rpath' # not sure if that's needed
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
120
70 by Marcin Wojdyr
changes in configuration file
121
# handle cross-compilation
122
if _target:
203 by Marcin Wojdyr
rearranged conf.py and modified README
123
    autogenargs += ' --host=' + _target
124
    # FFTW2 configure script fails to set correct CC automatically
125
    module_autogenargs['fftw2'] = autogenargs + (' CC=%s-gcc' % _target)
126
    # cross-compilation of cctbx python extensions is currently not supported
127
    if 'build-boost-python-extensions' not in "".join(_cctbx_configure_args):
128
        _cctbx_configure_args += ['--build-boost-python-extensions=False']
129
    # prepare Toolchain file for cmake
70 by Marcin Wojdyr
changes in configuration file
130
    import crosscmake as _cs
131
    cmakeargs += ' ' + _cs.write_toolchain(_target, prefix, buildroot)
184 by Marcin Wojdyr
set `Path' for wine
132
    # if Wine is used during build, it must know where DLLs are
133
    # (this trick may not work with all wine configurations)
134
    os.environ['Path'] = ";".join(r"Z:\%s\bin" % p for p in
135
                                      (prefix, _cs.find_root_path(_target)))
70 by Marcin Wojdyr
changes in configuration file
136
869 by Marcin Wojdyr
don't use $RELEASE, use devtools from release branch instead
137
# If $RELEASE is set, it confuses openssl config script. Unset it just in case.
638 by Marcin Wojdyr
conf.py: unset $RELEASE for openssl, it confuses its config script
138
module_extra_env['openssl'] = {'RELEASE': ''}
139
198 by Marcin Wojdyr
on Windows, always use lib not lib64
140
if _for_windows:
70 by Marcin Wojdyr
changes in configuration file
141
    module_autogenargs['ccif'] = autogenargs + ' --with-regex=regex'
253 by Marcin Wojdyr
conf.py: don't add --large-address-aware for MinGW with target x86_64
142
    if not _target or "x86_64" not in _target:
143
        os.environ['LDFLAGS'] += ' -Wl,--large-address-aware'
70 by Marcin Wojdyr
changes in configuration file
144
447 by Marcin Wojdyr
OSX qt4: add -no-framework, removed -no-rpath
145
if sys.platform == 'darwin':
146
    if sys.maxsize > 2**32:
147
        # openssl on OSX builds 32-bit version by default, it needs this hint
148
        module_extra_env['openssl'] = {'KERNEL_BITS': '64'}
149
    module_autogenargs['qt4'] = '-no-framework'
1166 by Marcin Wojdyr
osx: if SDK is set pass it as an option to Qt and sip
150
    if 'SDKROOT' in os.environ:
151
        module_autogenargs['qt4'] += ' -sdk ' + os.environ['SDKROOT']
152
        module_autogenargs['sip'] = '--universal --arch x86_64 --sdk ' + os.environ['SDKROOT']
594 by Charles Ballard
set --enable-framework for python build on darwin, also requires removal of --enable-shared
153
    module_autogenargs['python'] = autogenargs.replace("--enable-shared"," ") + ( " -enable-framework=%s/Library/Frameworks" % prefix)
778 by Marcin Wojdyr
conf.py: set LIBXML2_LIBS/CFLAGS on OSX
154
    # On OSX skip libs included in 10.6+ SDK
816 by Marcin Wojdyr
conf.py: more modules skipped by default (platform-dependent), on OSX add
155
    skip += ['zlib', 'libxml2', 'libxslt', 'lapack', 'sqlite3', 'curl']
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
156
    # and those included in XQuartz and used only by X11 programs
816 by Marcin Wojdyr
conf.py: more modules skipped by default (platform-dependent), on OSX add
157
    skip += ['pixman', 'cairo']
778 by Marcin Wojdyr
conf.py: set LIBXML2_LIBS/CFLAGS on OSX
158
    os.environ['LIBXML2_LIBS']='-lxml2'
159
    os.environ['LIBXML2_CFLAGS']='-I/usr/include/libxml2'
729 by Marcin Wojdyr
qt4: remove -no-sse2 option from 64-bit build
160
    # on Mac Qt can be compiled only with Apple compiler
724 by Marcin Wojdyr
conf.py: on Mac use Apple compiler when building Qt
161
    _qt4_env = module_extra_env.setdefault('qt4', {})
162
    _qt4_env['CC'] = '/usr/bin/gcc'
163
    _qt4_env['CXX'] = '/usr/bin/g++'
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
164
    # XQuartz pc files are needed to build gtk
810 by Marcin Wojdyr
conf.py: add /usr/X11/ in a couple of places for building coot on OSX
165
    os.environ.setdefault('PKG_CONFIG_PATH',
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
166
                          '/usr/lib/pkgconfig:%s/lib/pkgconfig' % _x11dir)
816 by Marcin Wojdyr
conf.py: more modules skipped by default (platform-dependent), on OSX add
167
    module_extra_env.setdefault('coot', {}).setdefault('CPPFLAGS',
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
168
                                                       '-I%s/include' % _x11dir)
816 by Marcin Wojdyr
conf.py: more modules skipped by default (platform-dependent), on OSX add
169
else:
170
    skip += ['gettext']
432 by Marcin Wojdyr
build openssl on 64-bit OSX with option darwin64-x86_64-cc
171
729 by Marcin Wojdyr
qt4: remove -no-sse2 option from 64-bit build
172
if _target or sys.maxsize <= 2**32: # probably building for 32-bit system
730 by Marcin Wojdyr
conf.py: fix syntax after the last commit
173
    # for pre Pentium4
174
    module_autogenargs['qt4'] = module_autogenargs.get('qt4','') + ' -no-sse2'
729 by Marcin Wojdyr
qt4: remove -no-sse2 option from 64-bit build
175
1028 by Marcin Wojdyr
moved --with-python=false for boost from ccp4.xml to conf.py
176
# with-python=false is a workaround for bjam bug.
177
# Python path is not written to project-config.jam, but is detected
178
# correctly later on.
179
module_autogenargs['boost'] = '--with-python=false'
180
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
181
check_sysdeps = False # we don't have system modules
182
63 by Marcin Wojdyr
updated ccp4-jhbuild
183
# this is needed to use file ccp4.xml
1 by Marcin Wojdyr
initial revision of jhbuild config
184
use_local_modulesets = True
185
modulesets_dir = os.path.dirname(os.path.abspath(__file__))
869 by Marcin Wojdyr
don't use $RELEASE, use devtools from release branch instead
186
moduleset = 'ccp4.xml'
49 by Marcin Wojdyr
added shared/static static options to autogenargs,
187
modules = ['default']
312 by Marcin Wojdyr
use new jhbuild option for tinderbox: help_website
188
help_website=None
3 by Marcin Wojdyr
added jhbuild copy, jh script, .bzrignore
189
241 by Marcin Wojdyr
tweaked conf.py
190
# read local settings from ~/.cjrc or $(pwd)/cj.rc if these files exist
191
for _local_config in (os.path.expanduser("~/.cjrc"), "cj.rc"):
192
    if os.path.exists(_local_config):
193
        execfile(_local_config)
70 by Marcin Wojdyr
changes in configuration file
194
461 by Marcin Wojdyr
conf.py: fixed handling of F77/FC
195
if 'FC' in os.environ:
196
    os.environ.setdefault('F77', os.environ['FC'])
1161 by Marcin Wojdyr
set F90 - used by numpy/scipy
197
    os.environ.setdefault('F90', os.environ['FC'])
461 by Marcin Wojdyr
conf.py: fixed handling of F77/FC
198
656 by Marcin Wojdyr
very minor changes to conf.py
199
if '--compiler' not in " ".join(_cctbx_configure_args):
200
    if os.getenv('CC') == 'icc':
201
        _cctbx_configure_args += ['--compiler=icc']
202
    elif _for_windows:
203
        _cctbx_configure_args += ['--compiler=mingw']
517 by Marcin Wojdyr
conf.py: moved cctbx --compiler flag after cj.rc, and set it only for icc
204
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
205
# Tcl extension in diff-image and ccp4mapwish can be only built as shared.
206
if _build_static:
207
     skip += ["ccp4mapwish"]
208
else:
482 by Marcin Wojdyr
conf.py: clean up tcl configuration
209
    if _for_windows:
210
        _tcldir = _tcldir.replace("\\", "/") # \->/ is needed for MinGW
211
        _tcllib = _tcllib.replace('.', '') # on Windows it's tcl84 not tcl8.4
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
212
    # set Tcl paths for diff-image and ccp4mapwish
213
    module_autogenargs.setdefault('diff-image', autogenargs+" --enable-tcl")
482 by Marcin Wojdyr
conf.py: clean up tcl configuration
214
    if _tcldir:
494 by Marcin Wojdyr
reverted accidental change in the previous commit
215
        _tc = "%s -I%s/include" % (os.environ.get('CPPFLAGS',''), _tcldir)
482 by Marcin Wojdyr
conf.py: clean up tcl configuration
216
        for _m in ['diff-image', 'ccp4mapwish']:
217
            module_extra_env.setdefault(_m, {}).setdefault("CPPFLAGS", _tc)
218
        os.environ['TCL_LIB_SPEC'] = '-L%s/lib -l%s' % (_tcldir, _tcllib)
219
    else:
220
        os.environ['TCL_LIB_SPEC'] = '-l' + _tcllib
196 by Marcin Wojdyr
misc changes:
221
1118 by Marcin Wojdyr
add scipy
222
for _m in ['numpy', 'scipy']:
223
    _me = module_extra_env.setdefault(_m, {})
224
    _me.setdefault('FFLAGS', '-fPIC')
225
    _me.setdefault('BLAS', '%s/lib' % prefix)
226
    _me.setdefault('LAPACK', '%s/lib' % prefix)
1120 by Marcin Wojdyr
fix scipy compilation on osx
227
    # note https://github.com/numpy/numpy/issues/1171
228
    _numpy_ldflags = os.getenv('LDFLAGS') + (' -L%s/lib ' % prefix)
229
    if sys.platform == "darwin":
230
      _numpy_ldflags += '-bundle -lpython2.7'
231
    else:
232
      _numpy_ldflags += '-shared'
233
    _me.setdefault('LDFLAGS', _numpy_ldflags)
834 by Marcin Wojdyr
updated coot-0.8
234
765 by Ville Uski
Apply Stuart's patches to compile pixie with ccp4mg, and tiff with pixie.
235
if sys.platform == "darwin":
236
  module_extra_env.setdefault('pixie',{}).setdefault('LIBS','-lz')
237
else:
238
  module_extra_env.setdefault('pixie',{}).setdefault('LIBS','-ljpeg -lz')
707 by Marcin Wojdyr
conf.py: numpy doesn't build with LDFLAGS/FFLAGS set (in general)
239
810 by Marcin Wojdyr
conf.py: add /usr/X11/ in a couple of places for building coot on OSX
240
if sys.platform == "darwin":
241
    # autoconf AC_PATH_XTRA macro is silly
242
    for _m in ['gtkglext', 'freeglut']:
243
        _env = module_extra_env.setdefault(_m, {})
818 by Marcin Wojdyr
conf.py: tweak flags related to X11 and AC_PATH_XTRA macro on OSX
244
        _env.setdefault("LDFLAGS", os.getenv('LDFLAGS','') +
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
245
                                   ' -L%s/lib -L%s/lib' % (_x11dir, prefix))
818 by Marcin Wojdyr
conf.py: tweak flags related to X11 and AC_PATH_XTRA macro on OSX
246
        _env.setdefault('CPPFLAGS', os.getenv('CPPFLAGS','') +
841 by Marcin Wojdyr
conf.py: keep path to the X11 dir on Mac in one place
247
                                    ' -I%s/include' % _x11dir)
919 by Marcin Wojdyr
conf.py: -headerpad_max_install_names for coot
248
    # coot neads bigger headerpad
249
    module_extra_env['coot'].setdefault('LDFLAGS', os.getenv('LDFLAGS') +
250
      ' -L%s/lib -L%s/lib -Wl,-headerpad_max_install_names' % (_x11dir, prefix))
810 by Marcin Wojdyr
conf.py: add /usr/X11/ in a couple of places for building coot on OSX
251
203 by Marcin Wojdyr
rearranged conf.py and modified README
252
# this is used internally to pass the arguments set above to cctbx
101 by Marcin Wojdyr
updated ccp4-jhbuild
253
os.environ['SCONS_ARGS'] = "-j %d" % jobs
209 by Marcin Wojdyr
add variable _cctbx_modules to conf.py
254
os.environ['CCTBX_FLAGS'] = " ".join(_cctbx_configure_args + [_cctbx_modules])
215 by Marcin Wojdyr
misc. changes in conf.py and ccp4.xml
255
213 by Marcin Wojdyr
conf.py: make pkg-config work with cross-compiler
256
# hack: avoid adding /usr/* paths to PKG_CONFIG_PATH in jhbuild/config.py
376 by Marcin Wojdyr
a few minor changes
257
if _target:
258
    os.environ.setdefault('PKG_CONFIG_PATH', '')
239 by Marcin Wojdyr
added install-check.c and updated README
259
260
if os.path.exists(os.path.join(modulesets_dir, 'install-check')):
261
    installprog = os.path.join(modulesets_dir, 'install-check')