# -*- 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 # # modified by: Rolf Gebhardt # moduleset = os.environ['PWD']+'/pika.moduleset' module = os.environ.get('MODULE', 'pika-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 " buildarch = os.environ.get('BUILD_ARCH', 'i686') if buildarch != "i686" and buildarch != "x86_64": print ("Warning: BUILD_ARCH not recognized") # 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 + '-' + buildarch + '/' tarballdir = None os.environ['prefix'] = prefix searchprefix = os.environ['PWD']+'/targets/pika-common' + flavour_ext + '-' + buildarch + '/' #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', buildarch + '-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 environment 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'] # Clear DISPLAY (prevents wine from popping up dialogs on some machines) os.environ['DISPLAY'] = '' #Added another common env var name for windres os.environ['RC'] = os.environ['WINDRES'] #Exporting tool flags environment variables os.environ['LDFLAGS'] = '-L'+searchprefix+'/lib' os.environ['CFLAGS'] = '-mms-bitfields -I'+searchprefix+'/include ' 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 \ --with-zlib=no """ 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['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['pika-stable']= autogenargs + """ --disable-python \ --disable-gtk-doc """ module_autogenargs['pika-dev'] = autogenargs + """ --disable-python \ --disable-gtk-doc """ module_autogenargs['pika-gtk3'] = autogenargs + """ --disable-python \ --disable-gtk-doc """ module_autogenargs['gdb'] = autogenargs.replace ("--disable-static", "") module_cmakeargs['openjpeg2'] = cmakeargs + " -DBUILD_PKGCONFIG_FILES=ON" 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'}, 'cairo': {'ax_cv_c_float_words_bigendian': 'no'}, 'json-c': {'ac_cv_func_malloc_0_nonnull': 'yes', 'ac_cv_func_realloc_0_nonnull': 'yes'}, # Erm... this is potentially bad... # Ensure that pika doesn't get the host machine's freetype-config 'pika-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')}, 'pika-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')}, 'pika-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')}, })