Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. Most programs in the repository are regularly and automatically compiled
  2. by the autobuild server, compiled binaries are available at
  3. http://builds.kolibrios.org. The autobuild server uses the build system Tup,
  4. data for it are located in files named Tupfile.lua over the repository.
  5.  
  6. -------------------------------------------------------------------------------
  7.  
  8. Q1. I want to build one program and I don't want to know anything about Tup.
  9. Q2. I want to build one program using Tup.
  10. Q3. I want to add a program to the autobuild.
  11. Q4. I want to build the entire system.
  12. Q5. I'm sure that I want to build the entire system.
  13.     The autobuild server does this, after all.
  14. Q6. I don't want to keep a zoo of compilers and tools required for Q5,
  15.     but I still want to build as many programs as possible with what I have.
  16.  
  17. -------------------------------------------------------------------------------
  18.  
  19. Q1. I want to build one program and I don't want to know anything about Tup.
  20. A1. Fine. You will need a corresponding compiler, obviously.
  21.  
  22.   * For a FASM program, get FASM at http://flatassembler.net/download.php.
  23.     To compile, find the main .asm file of the program and run
  24.         path/to/fasm <input.asm>
  25.     The compiler will automatically select the name for output, using
  26.     base name of input and extension based on file format. Though, you can
  27.     give also output name explicitly, as the second argument.
  28.  
  29.     If the compiler produces an error "file not found" regarding 'lang.inc',
  30.     the program can be compiled using different languages of interface.
  31.     Create a file 'lang.inc' in the same folder as <input.asm> like follows:
  32.         lang fix en
  33.     Here the last word selects the language. Valid languages are
  34.     en, ru, et, it, sp. Not all programs provide all translations,
  35.     en should always be available, ru is the most frequent after en.
  36.  
  37.   * For a NASM program, get NASM at http://www.nasm.us/.
  38.     To compile, find the main .asm file of the program and run
  39.         path/to/nasm -f bin -o <output> <input.asm>
  40.     Multi-language is rarely supported in this category, but you could still
  41.     see sometimes an error "file not found" regarding 'lang_nasm.inc'. If so,
  42.     create a file 'lang_nasm.inc' in the same folder as <input.asm> like follows:
  43.         %define lang 'en'
  44.     Read the entry about fasm for description of valid languages.
  45.  
  46.   * For a c-- program, try to avoid compiling it and instead rewrite the code
  47.     in a normal language like assembler or C. If you absolutely need
  48.     to compile, note that the compiler has been abandoned long ago, so
  49.     don't look for an official site. It is possible to find the compiler
  50.     somewhere on http://board.kolibrios.org, but be prepared to several tries
  51.     because there are several slightly different compiler versions, not all of
  52.     which are able to build all programs.
  53.     There is no Linux version, but Windows version runs fine under Wine.
  54.  
  55.   * For a GCC program, get the toolchain at
  56.     http://ftp.kolibrios.org/users/Serge/new/Toolchain/.
  57.  
  58.     Under Windows, you need the package with "msys" in name and MinGW;
  59.     after installing MinGW, unpack the package to
  60.     \MinGW\msys\1.0\home\autobuild\tools\win32, the package assumes
  61.     exactly this path. Run MinGW shell.
  62.  
  63.     Under Linux, you need the package with "linux" in name
  64.     and runtime library cloog; e.g. for Debian-based distributives
  65.     use apt-get install libcloog-isl4. Unpack the package to
  66.     /home/autobuild/tools/win32, the package assumes exactly this path.
  67.  
  68.     In both MinGW and Linux, make sure that the command
  69.         /home/autobuild/tools/win32/bin/kos32-gcc
  70.     invokes the compiler.
  71.  
  72.     If the program uses libraries, you will also need to either compile
  73.     them separately or download SDK, if they are included to SDK.
  74.     Compiling is ultimately a sequence of calls to kos32-gcc and kos32-ld,
  75.     but filling exact parameters can be tricky, so maybe you want to
  76.     use Tup - proceed to Q2/A2 - or Make, if a maintainer has provided
  77.     Makefile.
  78.  
  79.   * For a MSVC program, get the compiler as a part of Visual Studio,
  80.     Express Edition is fine, or as a part of Windows SDK.
  81.     For obvious reasons, there is no Linux version, but the compiler runs file
  82.     under Wine.
  83.  
  84.     If the program uses libraries, you will also need to either compile
  85.     them separately or download SDK, if they are included to SDK.
  86.     Compiling is ultimately a sequence of calls to cl.exe and link.exe,
  87.     but filling exact parameters can be tricky, so maybe you want to
  88.     use Tup - proceed to Q2/A2 - or Make, if a maintainer has provided
  89.     Makefile.
  90.  
  91.   * For any language, if the program is KolibriOS binary, the compiled binary
  92.     can optionally be compiled with kpack. Windows version of kpack
  93.     can be downloaded at http://diamond.kolibrios.org/prg/kpack.exe,
  94.     Linux version can be compiled from sources at
  95.     (repository)/programs/other/kpack/linux.
  96.  
  97.   * The kernel can optionally be compiled with kerpack.
  98.     Linux version can be compiled from sources at
  99.     (repository)/programs/other/kpack/kerpack_linux.
  100.     There is no Windows version.
  101.  
  102. Q2. I want to build one program using Tup.
  103. A2. You will still need the corresponding compiler as described in Q1/A1.
  104.     You will also need Tup, get it at http://gittup.org/tup/index.html.
  105.     Make sure that the corresponding compiler is somewhere in PATH
  106.     and can be invoked without explicit path. For Linux, note that
  107.     all programs are invoked without extension, like
  108.         fasm
  109.     or
  110.         kos32-gcc
  111.     with one exception: MSVC linker is invoked as link.exe to avoid conflict
  112.     with link from coreutils. Under Linux, c--, cl, link.exe should be scripts
  113.     invoking Wine with the corresponding binary. The interaction tup+wine
  114.     does not work by default; ultimately, invoking scripts should be like:
  115.         c--: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/C--.exe $*
  116.         cl: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/cl.exe -I/path/to/cl/include $*
  117.         link.exe: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/link.exe $*
  118.     where nosetsid.so is compiled as a 32-bit shared library
  119.     from C file with one line "int setsid() { return -1; }".
  120.  
  121.     If the program does not use any libraries, run
  122.         tup init
  123.     in the directory with the program. Then,
  124.         tup
  125.     without arguments will build the program with default settings.
  126.     Subsequent runs will not do anything unless any file that was used
  127.     during the compilation - not necessarily the main file - is changed;
  128.     after that, the program will be recompiled.
  129.     By default, tup will not track files outside the directory with "tup init";
  130.     if tracking files in program directory is not sufficient for you,
  131.     consider adding updater.full_deps=1 to tup config - see tup manual
  132.     for details, for Linux it requires setting tup as suid root - or extending
  133.     tup data to the entire repository as described in Q6/A6.
  134.  
  135.     Settings can be configured using the file tup.config. Look to
  136.     tup.config.template in the repository root for complete list;
  137.     for most programs, only CONFIG_LANG and CONFIG_KPACK_CMD have effect.
  138.  
  139.     If the program uses libraries or helper files for gcc/msvc and you don't
  140.     want to build everything at once like Q6/A6, set
  141.         CONFIG_HELPERDIR=.
  142.     in tup.config, copy programs/use_gcc.lua or programs/use_msvc.lua
  143.     and helpers for used libraries, if any, to the directory of the program.
  144.     use_gcc.lua and use_msvc.lua do not require additional configuration;
  145.     in helpers for used libraries, set path to library in the first line.
  146.     Since copied helpers are local files not for the repository, you may use
  147.     absolute pathes specific for your machine.
  148.     This was designed so that no repository files need to be modified:
  149.     Tupfile.lua for the program is able to use either local helpers when
  150.     CONFIG_HELPERDIR is set, or repository helpers when the entire repository
  151.     is built.
  152.     You will also need compiled libraries. If they are included in SDK, use them.
  153.     Otherwise, compile them using the same process. Note that for a library,
  154.     "tup init" needs to be called in the library directory with include/ and lib/,
  155.     even if Tupfile.lua is present only in src/; libraries will be put in lib/.
  156.  
  157. Q3. I want to add a program to the autobuild.
  158. A3. Select a program from repository which uses same language and libraries.
  159.     Copy Tupfile.lua from that program to your program.
  160.     Change names of source and binary files accordingly.
  161.     If external files are referenced, correct relative pathes accordingly:
  162.     e.g. when programs/develop/libraries/menuetlibc_example/Tupfile.lua
  163.     references ../../../use_menuetlibc.lua, it resolves to
  164.     programs/use_menuetlibc.lua, if your program is built by
  165.     programs/other/super_program/Tupfile.lua, the path should be
  166.     ../../use_menuetlibc.lua. Commit.
  167.  
  168.     After that, the program will be built regularly.
  169.     To include the binary in kolibri.img or kolibri.iso, add it to one of
  170.     lists in data/Tupfile.lua. Select the section corresponding to the used
  171.     language so that people who build images without your compiler would still
  172.     be able to do so.
  173.  
  174. Q4. I want to build the entire system.
  175. A4. Why? Even the person who has configured the autobuild server does not build
  176.     everything on her computer.
  177.  
  178.     If you want to create your own image of the system, it is much simpler to
  179.     start from existing one and modify it, building only what is necessary.
  180.     If you don't know how to modify an image, don't expect that the build
  181.     system will magically do it for you. The build system uses mtools for
  182.     image manipulation; if you have configured mtools, you can just use them
  183.     directly. There are also other ways of image manipulation, which would
  184.     be closed for you once you decide to become attached to the build system.
  185.  
  186.     If you want to verify or debug your changes in Q3/A3, it is normally
  187.     sufficient to build just what you have changed as in Q2/A2.
  188.     To be extra sure, you can build from the repository root as in Q6/A6
  189.     limiting to your compiler and FASM for some helper tasks;
  190.     any possible differences between this mode and actions of the autobuild
  191.     server are due to environment issues, like Windows vs Linux,
  192.     and would not be resolved anyway.
  193.  
  194.     If you just want it, note that the full build requires all compilers
  195.     listed in Q1/A1 and Linux. MinGW and Cygwin will not help you.
  196.  
  197. Q5. I'm sure that I want to build the entire system.
  198.     The autobuild server does this, after all.
  199. A5. The autobuild server has one concrete configuration with 64-bit Linux.
  200.     The developers are slightly interested in compiling programs in different
  201.     systems, but nobody needs portability of actions that only one server
  202.     does anyway.
  203.  
  204.     So, don't expect support from developers. Though, here goes the instruction
  205.     in interest of completeness.
  206.  
  207.   * Configure all compilers as described in Q2/A2.
  208.   * Configure kpack and kerpack as described in Q2/A2.
  209.     They are optional for Q2/A2, but required here,
  210.     the image just could not contain all programs in unpacked form.
  211.   * Configure mtools, so that mformat, mmd and mcopy are somewhere in PATH.
  212.   * Configure mkisofs.
  213.   * For full duplication of the autobuild server configure build variants:
  214.     create directories build-eng, build-rus, ... in the root of repository for
  215.     every subdirectory in data/ except data/common. Create files
  216.     build-eng/tup.config, build-rus/tup.config, ... with
  217.     CONFIG_BUILD_TYPE=eng, rus, ... correspondingly. This will switch
  218.     to out-of-tree builds for every variant. If one build type is sufficient
  219.     for you, you may skip this step.
  220.   * Run
  221.         tup init
  222.     in the root of repository.
  223.   * Run
  224.         tup
  225.     anywhere inside repository.
  226.   * If everything went good, there should be files kolibri.img and kolibri.iso
  227.     in every build-* directory. When you want to update,
  228.     rerun tup without arguments.
  229.  
  230. Q6. I don't want to keep a zoo of compilers and tools required for Q5,
  231.     but I still want to build as many programs as possible with what I have.
  232. A6.
  233.   * Configure all compilers you want to use as described in Q2/A2.
  234.   * Create tup.config in the root of repository. Disable all compilers you
  235.     don't want to use there; comments in tup.config.template should help you.
  236.   * Optionally, configure kpack and kerpack as described in Q2/A2.
  237.   * Run
  238.         tup init
  239.     in the root of repository.
  240.   * Run
  241.         tup
  242.     anywhere inside repository.
  243.