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