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