CrossCompilingXorgJhbuild

Exactly one page like "CrossCompilingXorg" found, redirecting to page.

Clear message

Below is a sample ~/.jhbuildrc file to cross compile build X. Replace arm-none-linux-gnueabi with your toolchain. It assumes that you have export'ed DISCIMAGE to where you want to install to.

   1 #######################################################################################
   2 # This is a checkout and build configuration for building Xorg
   3 #
   4 # This can be copied to ~/.jhbuildrc  and then run 'jhbuild build xserver'
   5 #
   6 #######################################################################################
   7 
   8 moduleset = 'http://cgit.freedesktop.org/xorg/util/modular/plain/xorg.modules'
   9 checkoutroot = '~/sources/xorg/git'
  10 modules = [ 'xorg' ]
  11 prefix = os.environ['DISCIMAGE'] +'/usr/local'
  12 
  13 autogenargs = ' --disable-static'
  14 autogenargs += ' --disable-dri2 --with-driver=dri'
  15 autogenargs += ' --cache-file=' + checkoutroot + '/autoconf-cache'
  16 # lots of people really like to always look in /var/log, but change if
  17 # you want the log files out of place
  18 autogenargs += ' --with-log-dir=/var/log'
  19 autogenargs += ' --with-mesa-source=' + checkoutroot + '/mesa'
  20 autogenargs += ' --enable-malloc0returnsnull'
  21 
  22 os.environ['ACLOCAL'] = 'aclocal -I ' + prefix + '/share/aclocal/'
  23 os.environ['INSTALL'] = os.path.expanduser('~/bin/install-check')
  24 
  25 # Enabled debugging for xserver
  26 os.environ['CFLAGS'] = '-g'
  27 os.environ['CPPFLAGS'] = '-g'
  28 
  29 # Setup environment for cross compiling
  30 
  31 os.environ['BUILD'] = 'i686-pc-linux-gnuaout'
  32 os.environ['HOST'] = 'arm-none-linux-gnueabi'
  33 os.environ['TARGET'] = 'arm-none-linux-gnueabi'
  34 
  35 cross_compile_prefix = os.environ['CROSS_COMPILE']
  36 tools = {'ADDR2LINE': 'addr2line',
  37         'AS': 'as', 'CC': 'gcc', 'CPP': 'cpp',
  38         'CPPFILT': 'c++filt', 'CXX': 'g++',
  39         'GCOV': 'gcov', 'LD': 'ld', 'NM': 'nm',
  40         'OBJCOPY': 'objcopy', 'OBJDUMP': 'objdump',
  41         'READELF': 'readelf', 'SIZE': 'size',
  42         'STRINGS': 'strings', 'AR': 'ar', 
  43         'RANLIB': 'ranlib', 'STRIP': 'strip'}
  44 
  45 tools_args = str()
  46 for tool in tools.keys():
  47         fullpath_tool = cross_compile_prefix + tools[tool]
  48         os.environ[tool] = fullpath_tool
  49 
  50 autogenargs += ' --build='+os.environ['BUILD']
  51 autogenargs += ' --host='+os.environ['HOST']
  52 autogenargs += ' --target='+os.environ['TARGET']
  53 
  54 for tool in ('AR', 'RANLIB', 'STRIP', 'AS', 'OBJDUMP', 'NM'):
  55         autogenargs += ' '+tool+'="'+os.environ[tool]+'" '
  56 
  57 module_autogenargs['libGL'] = autogenargs + ' --without-demos --with-dri-drivers="swrast" --disable-glw'
  58 module_autogenargs['libXt'] = autogenargs + ' --disable-install-makestrs'
  59 module_autogenargs['xserver'] = autogenargs + ' --enable-debug'
  60 module_autogenargs['pixman'] = autogenargs + ' --disable-gtk'
  61 module_autogenargs['hal'] = autogenargs + ' --disable-pci-ids'
  62 module_autogenargs['libXfont'] = autogenargs + ' --disable-freetype'
  63 
  64 # For expat and zlib
  65 os.environ['CFLAGS'] += ' -I' + os.environ['DISCIMAGE'] + '/usr/local/include/'
  66 os.environ['CPPFLAGS'] += ' -IHello -I' + os.environ['DISCIMAGE'] + '/usr/local/include/'
  67 os.environ['LDFLAGS'] = ' -L' + os.environ['DISCIMAGE'] + '/usr/local/lib/'
  68 os.environ['LDFLAGS'] += ' -Wl,--rpath -Wl,' + '/usr/local/lib/'  #rpath is relative to where it is run from - DISCIMAGE 
  69 
  70 # Just in case zlib or expat were installed here
  71 os.environ['CFLAGS'] += ' -I' + os.environ['DISCIMAGE'] + '/usr/include/'
  72 os.environ['CPPFLAGS'] += ' -I' + os.environ['DISCIMAGE'] + '/usr/include/'
  73 os.environ['LDFLAGS'] += ' -L' + os.environ['DISCIMAGE'] + '/usr/lib/'
  74 os.environ['LDFLAGS'] += ' -Wl,--rpath -Wl,' + '/usr/lib/'