| 49 |  | * principles | 
          
            | 50 |  | * extracting the flags | 
          
            | 51 |  | * caching built libraries | 
          
            | 52 |  | * harbours | 
          
            | 53 |  | * usage | 
          
            | 54 |  | * writing harbour files | 
          
            |  | 52 | When the developer uses the Coastline, he is working with 3 directories. | 
          
            |  | 53 | The first one is the directory with Coastline checkout, in the scripts referred to as `HSCT_HOME`. | 
          
            |  | 54 | Second one is the build directory where the building happens. | 
          
            |  | 55 | And the last one is directory with HelenOS sources (`HSCT_HELENOS_ROOT`). | 
          
            |  | 56 |  | 
          
            |  | 57 | The build directory needs to be initialized first. | 
          
            |  | 58 | During initialization, headers and libraries from HelenOS source tree are copied to the build directory and used compiler/linker flags are extracted and prepared for further use. | 
          
            |  | 59 | These are stored in the `helenos/` subdirectory. | 
          
            |  | 60 | A shell script `helenos/env.sh` contains settings of various paths and also the flags for the compiler and the linker. | 
          
            |  | 61 | To initialize the build directory, you need to call | 
          
            |  | 62 |  | 
          
            |  | 63 | {{{ | 
          
            |  | 64 | $HSCT_HOME/hsct.sh init /path/to/HelenOS/source/tree | 
          
            |  | 65 | }}} | 
          
            |  | 66 |  | 
          
            |  | 67 | If you specify a profile (e.g. `ia32`) as a third argument, the initialization would prepare the build directory for that profile. | 
          
            |  | 68 | Specifying the word `build` as a last (fourth) argument would force a complete rebuild for the specified profile. | 
          
            |  | 69 |  | 
          
            |  | 70 | Once the directory is initialized, the user can build the ported software. | 
          
            |  | 71 | The build is invoked by calling `hsct.sh` in the following manner: | 
          
            |  | 72 |  | 
          
            |  | 73 | {{{ | 
          
            |  | 74 | hsct.sh build <package> | 
          
            |  | 75 | }}} | 
          
            |  | 76 |  | 
          
            |  | 77 |  | 
          
            |  | 78 | This would download the tarballs, unpack them and run `configure` and `make` (or alternatives) for the given software. | 
          
            |  | 79 |  | 
          
            |  | 80 | Once the build is complete, the user can either package the software into a tarball or directly copy the application to HelenOS source tree. | 
          
            |  | 81 | Running | 
          
            |  | 82 |  | 
          
            |  | 83 | {{{ | 
          
            |  | 84 | hsct.sh install <package> | 
          
            |  | 85 | }}} | 
          
            |  | 86 |  | 
          
            |  | 87 | would copy the application (library) to HelenOS source tree that was specified during initialization. | 
          
            |  | 88 | Executing | 
          
            |  | 89 |  | 
          
            |  | 90 | {{{ | 
          
            |  | 91 | hsct.sh archive <package> | 
          
            |  | 92 | }}} | 
          
            |  | 93 |  | 
          
            |  | 94 | would create a tarball in `archives/` subdirectory. | 
          
            |  | 95 | Unpacking this tarball into `uspace/overlay` would effectively install the package. | 
          
            |  | 96 |  | 
          
            |  | 97 |  | 
          
            |  | 98 | If you do not want to rebuild the software yourself, you can download [http://helenos.alisma.cz/coastline/matrix/ pre-built packages]. | 
          
            |  | 99 | Please note that these packages are not 100% up-to-date with mainline and sometimes may not work or may work only partially. | 
          
            |  | 100 |  | 
          
            |  | 101 |  | 
          
            |  | 102 | === Porting new software === | 
          
            |  | 103 |  | 
          
            |  | 104 | * harbour files | 
          
            |  | 105 | * `$shipname`, `$shipsources` and `$shiptugs` | 
          
            |  | 106 | * `build()` and `package()` functions | 
          
            |  | 107 | * common issues | 
          
            |  | 108 | * forcing cross-compilation | 
          
            |  | 109 | * naming clashes |