-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.jhbuildrc
251 lines (197 loc) · 11 KB
/
build.jhbuildrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# -*- mode: python -*-
# This code is licensed under the GPLv2 License
# Derived work from the original freedesktop.org example.jhbuildrc
#
# This jhbuildrc file is created for the purpose of cross compile Gtk+
# with Mingw32 under Linux.
#
# Author: Alberto Ruiz <[email protected]>
#
# modified by: Rolf Gebhardt <[email protected]>
#
moduleset = os.environ['PWD']+'/gimp.moduleset'
module = os.environ.get('MODULE', 'gimp-dev')
modules = [module]
flavour = os.environ.get('BUILD_FLAVOUR', 'rls')
if flavour == 'rls':
flavour_ext = ''
flavour_opt = ''
flavour_cflags = " -g "
else:
flavour_ext = '-dbg'
flavour_opt = "--enable-debug=yes"
flavour_cflags = " -g -O0 "
# checkoutroot: path to download packages elsewhere
# prefix: target path to install the compiled binaries
checkoutroot = os.environ['PWD']+'/checkout/'
prefix = os.environ['PWD'] + '/targets/' + module + flavour_ext + '/'
os.environ['prefix'] = prefix
searchprefix = os.environ['PWD']+'/targets/gimp-common' + flavour_ext + '/'
#The host value is obtained with the result of executing
#the config.guess script on any of the packages.
#This value must be valid for most linux/x86 out there
os.environ['HOST'] = 'x86_64-unknown-linux-gnu'
os.environ['TARGET'] = os.environ.get('MINGW_TARGET', 'i686-w64-mingw32')
os.environ['PKG_CONFIG_LIBDIR'] = ""
addpath('PKG_CONFIG_LIBDIR', os.path.join(searchprefix, 'lib', 'pkgconfig'))
addpath('PKG_CONFIG_LIBDIR', os.path.join(searchprefix, 'share', 'pkgconfig'))
os.environ['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_LIBDIR']
#Prefix for all the tools
mingw_tool_prefix = os.environ.get('MINGW_TOOLPREFIX', os.environ.get('MINGW_LOCATION', '/usr') + '/bin/' + os.environ['TARGET'] + '-')
mingw_tools = {'ADDR2LINE': 'addr2line',
'AS': 'as', 'CC': 'gcc', 'CPP': 'cpp',
'Cppfilt': 'c++filt', 'CXX': 'g++',
'DLLTOOL': 'dlltool', 'DLLWRAP': 'dllwrap',
'GCOV': 'gcov', 'LD': 'ld', 'NM': 'nm',
'OBJCOPY': 'objcopy', 'OBJDUMP': 'objdump',
'READELF': 'readelf', 'SIZE': 'size',
'STRINGS': 'strings', 'WINDRES': 'windres',
'AR': 'ar', 'RANLIB': 'ranlib', 'STRIP': 'strip'}
#Exporting all as enviroment variables with its prefix
mingw_tools_args = str()
for tool in mingw_tools.keys():
fullpath_tool = mingw_tool_prefix + mingw_tools[tool]
os.environ[tool] = fullpath_tool
# Allow enabling ccache
if os.environ.get('MINGW_USE_CCACHE', '') == 'yes':
os.environ['CC'] = 'ccache ' + os.environ['CC']
os.environ['CPP'] = 'ccache ' + os.environ['CPP']
os.environ['CXX'] = 'ccache ' + os.environ['CXX']
#Added another common env var name for windres
os.environ['RC'] = os.environ['WINDRES']
#Exporting tool flags enviroment variables
os.environ['LDFLAGS'] = '-L'+searchprefix+'/lib'
os.environ['CFLAGS'] = '-mms-bitfields -I'+searchprefix+'/include -DLIBXML_STATIC '
os.environ['CPPFLAGS'] = '-I'+searchprefix+'/include'
os.environ['CXXFLAGS'] = '-mms-bitfields'
os.environ['CFLAGS'] += os.environ.get('MINGW_CFLAGS', '')
os.environ['CFLAGS'] += flavour_cflags
os.environ['CXXFLAGS']+= flavour_cflags
# CMake stuff
cmakeargs += ' -DCMAKE_TOOLCHAIN_FILE=' + os.environ['PWD'] + '/toolchain.cmake '
cmakeargs += ' -DCMAKE_FIND_ROOT_PATH="' + searchprefix + ';' + prefix + '" '
#Don't install libraries in lib64, even if compiling on 64-bit machines
use_lib64 = False
#Make scripts run with the interpreter that's running this script
#(required wherever /usr/bin/python is python 3)
import sys
os.environ['PYTHON'] = os.environ.get("PYTHON", sys.executable)
#needed by win32/Makefile.gcc of zlib
os.environ['INCLUDE_PATH'] = prefix+'/include'
os.environ['LIBRARY_PATH'] = prefix+'/lib'
os.environ['BINARY_PATH'] = prefix+'/bin'
#Populating autogenargs
autogenargs = ' --build='+os.environ['HOST']
autogenargs += ' --host='+os.environ['TARGET']
autogenargs += ' --disable-docs'
autogenargs += ' --enable-all-warnings --enable-maintainer-mode'
autogenargs += ' --disable-static'
autogenargs += ' '+flavour_opt
for tool in ('AR', 'RANLIB', 'STRIP', 'AS',
'DLLTOOL', 'OBJDUMP', 'NM', 'WINDRES'):
autogenargs += ' '+tool+'="'+os.environ[tool]+'" '
#Module specific configure arguments
module_autogenargs['zlib'] = ' --prefix='+prefix+' --shared'
module_autogenargs['jasper'] = autogenargs + """ --enable-shared"""
module_autogenargs['gettext'] = autogenargs + """ --without-emacs \
--without-cvs \
--disable-curses \
--disable-java \
--disable-native-java \
--enable-relocatable \
--enable-threads=win32"""
module_autogenargs['glib2'] = autogenargs + """ --disable-gtk-doc \
--disable-modular-tests \
--cache-file=""" + os.environ['PWD'] + "/win32.cache"
module_autogenargs['cairo'] = autogenargs + """ --enable-xlib=no \
--enable-xlib-xrender=no \
--enable-xcb=no \
--enable-xcb-shm=no \
--enable-pthread=no \
--enable-win32-font=yes"""
module_autogenargs['pixman'] = autogenargs + """ --enable-gtk=no"""
module_autogenargs['pango'] = autogenargs + """ --disable-gtk-doc \
--enable-explicit-deps=no \
--with-included-modules"""
module_autogenargs['atk'] = autogenargs + """ --disable-glibtest \
--disable-gtk-doc \
--enable-introspection=no"""
module_autogenargs['gdk-pixbuf2']= autogenargs + """ --with-included-loaders"""
module_autogenargs['gtk2'] = autogenargs + """ --disable-glibtest \
--disable-gtk-doc \
--disable-cups"""
module_autogenargs['gtk3'] = autogenargs + """ --disable-glibtest \
--disable-gtk-doc \
--disable-cups \
--enable-gtk2-dependency"""
module_autogenargs['fontconfig'] = autogenargs + """ --with-arch=i686 \
--enable-libxml2"""
module_autogenargs['icu'] = autogenargs + """ --with-cross-build=$(pwd)/../icu-native/ """
module_autogenargs['libxml2'] = autogenargs + """ --with-python=no \
--with-iconv=yes"""
module_autogenargs['librsvg'] = autogenargs + """ --enable-introspection=no"""
module_autogenargs['libsoup'] = autogenargs + """ --without-apache-httpd"""
module_autogenargs['libwmf'] = autogenargs + """ --disable-gd \
--without-x \
--with-freetype=""" + prefix
module_autogenargs['ghostscript']= autogenargs + """ --without-jasper \
--with-system-libtiff \
--without-x \
--disable-cups \
--disable-contrib """
module_autogenargs['poppler']= autogenargs + """ ac_cv_func_strcpy_s='no'\
ac_cv_func_strcat_s='no' """
module_autogenargs['libgexiv2'] = autogenargs + "--disable-introspection"
module_autogenargs['webkitgtk'] = autogenargs.replace ("--enable-debug=yes", "") + """ \
--with-gtk=2.0 \
--with-target=win32 \
--disable-webkit2 \
--disable-geolocation \
--disable-video \
--disable-spellcheck \
--disable-credential-storage \
--disable-fast-malloc \
--disable-debug \
--disable-debug-symbols \
--disable-debug-features \
\
--disable-gamepad \
--with-acceleration_backend=none"""
module_autogenargs['babl'] = autogenargs + """ --enable-introspection=no"""
module_autogenargs['gegl'] = autogenargs + """ --enable-introspection=no \
--with-sdl=no"""
module_autogenargs['gimp-stable']= autogenargs + """ --disable-python \
--disable-gtk-doc """
module_autogenargs['gimp-dev'] = autogenargs + """ --disable-python \
--disable-gtk-doc """
module_autogenargs['gimp-gtk3'] = autogenargs + """ --disable-python \
--disable-gtk-doc """
module_autogenargs['gdb'] = autogenargs.replace ("--disable-static", "")
module_makeargs['mingw32-pthreads']= " CROSS=" + mingw_tool_prefix
module_extra_env.update (
{'mingw32-pthreads':
{'PREFIX': prefix, 'INSTALL': 'install'},
'webkitgtk':
{'CFLAGS': os.environ['CFLAGS'].replace ("-g", ""),
'CXXFLAGS': os.environ['CXXFLAGS'].replace ("-g", "") + ' -I' + checkoutroot + 'pthreads-w32-2-9-1-release -w'},
'ghostscript':
{'CFLAGS': os.environ['CFLAGS'].replace ("-O0", "").replace ("-mms-bitfields", ""), 'ac_cv_lib_pthread_pthread_create': 'no', 'CC': os.environ['CC'] + " -mms-bitfields"},
'icu-native': {},
'poppler-data':
{'PREFIX': prefix},
'freetype2':
{'LIBPNG_CFLAGS': ' ', 'LIBPNG_LDFLAGS': '-lpng'},
# Ensure that gimp doesn't get the host machine's freetype-config
'gimp-dev':
{'FREETYPE_CONFIG': os.path.join(searchprefix, 'bin', 'freetype-config'),
'ac_cv_lib_bz2_BZ2_bzCompress': 'yes',
'WMF_CONFIG': os.path.join(searchprefix, 'bin', 'libwmf-config')},
'gimp-stable':
{'FREETYPE_CONFIG': os.path.join(searchprefix, 'bin', 'freetype-config'),
'ac_cv_lib_bz2_BZ2_bzCompress': 'yes',
'WMF_CONFIG': os.path.join(searchprefix, 'bin', 'libwmf-config')},
'gimp-gtk3':
{'FREETYPE_CONFIG': os.path.join(searchprefix, 'bin', 'freetype-config'),
'ac_cv_lib_bz2_BZ2_bzCompress': 'yes',
'WMF_CONFIG': os.path.join(searchprefix, 'bin', 'libwmf-config')},
})