2013-03-29

Introducing HelenOS coastline

I am still trying to bring GCC to HelenOS but the truth is that I haven't made a big progress since my last post. However, I promised another script that would simplify the porting even more. I am not 100% sure it simplifies it that much but it makes the whole process much easier to reproduce. Let me introduce the HelenOS coastline.

The whole process is highly inspired by makepkg package building script from Arch Linux. The idea is that each ported package would have its own script controlling its build process. The simplification comes in a way of prepared variables containing stuff like C compiler flags specific for HelenOS or path to the C cross-compiler. Also, the helper script takes care of downloading of the package tarballs.

The scripts are hosted in my coastline repository on GitHub.

If you want to try it out, first clone the repository:

git clone git://github.com/vhotspur/coastline.git

I would assume that you cloned that into ~/helenos/coast. The repository should contain an incomplete README, a hsct.sh script and few library-named directories.

I am pushing the GCC-related changes into my lp:~vojtech-horky/helenos/gcc-port repository so I would recommend you to check-out that repository as well, for example into ~/helenos/gcc-port. Once you checkout the branch, configure it for ia32 and build it.

Next prepare directory for the ported applications. The idea is that there will be separate directory for each architecture: here I would assume that you are using directory ~/helenos/coast-build/ia32. A configuration file has to be prepared before you can actually build something. Currently, only single value is required. Place the following into ~/helenos/coast-build/ia32/hsct.conf:

root = /home/<username>/helenos/gcc-port

Now you should be able to actually build something. The script is not able to handle dependencies so you have to build the libraries in correct order.

Building zlib is then as simple as typing:

~/helenos/coast/hsct.sh build zlib

This command only builds the library. If you want to actually run it, you need to copy it to the HelenOS source tree, into the /uspace/dist directory and rebuild HelenOS. The copying is done with following command:

~/helenos/coast/hsct.sh install zlib

However, you still need to rebuild HelenOS by running make from ~/helenos/gcc-port.

If you now launch HelenOS, minigzip should be available.

In similar fashion you can build other libraries and try running the tests provided with them inside HelenOS.

I would be glad if you would actually try the script. However, it is still work in progress and it may not always work although I tried hard to make it as safe as possible. I welcome any suggestions how to improve this script. Patches are even more welcomed ;-).

If you have any questions, feel free to ask them either here or on HelenOS mailing list.

Thanks for reading!

7 komentářů:

  1. There will be a day when we will need to run this script from inside HelenOS. Assuming we will have Python, but not a classical Unix shell, shouldn't the script be rather written in Python?

    OdpovědětVymazat
  2. Btw, is the repository public? I get the following error when trying to clone it:

    [jermar@gorgo software]$ git clone git@github.com:vhotspur/coastline.git
    Cloning into 'coastline'...
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly

    OdpovědětVymazat
  3. Btw, is the repository public?

    Hmm, somehow GitHub has different opinion of what is read-only... I changed the link, it should work now. Thanks for noticing.

    shouldn't the script be rather written in Python?

    First of all, I am not very strong with Python and the script is mostly about launching other programs, thus Unix shell was quite natural choice. But even if it would be written in Python, we would still need to have the Unix shell there because of the configure scripts. Anyway, it is just a temporary tool that makes porting efforts better reproducible. Nothing more, nothing less.

    OdpovědětVymazat
  4. Ok, I managed to install zlib and libgmp. It looks like http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.bz2 has disappeared in the meantime, preventing the build of libmpfr.

    Once you have the directory structure, it is quite easy to work with the script, still I have some ideas how to improve the user experience:

    How about supporting a hosted mode in which the coastline repo would be cloned directly into the HelenOS tree root and initialized by something like hsct.sh init-hosted? Switching between the coast-build and the HelenOS source tree could be then automated.

    Do you think it will be once possible to support also pcc, binutils and even python builds in coastline?

    OdpovědětVymazat
  5. Ok, I managed to install zlib and libgmp. It looks like http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.bz2 has disappeared in the meantime, preventing the build of libmpfr.
    First of all, thanks for trying it. The link was fixed, you may need to remove empty file from the sources/ folder.

    How about supporting a hosted mode in which the coastline repo would be cloned directly into the HelenOS tree root and initialized by something like hsct.sh init-hosted?
    I am not 100% sure about cloning the repo directly into the HelenOS tree but adding an option to create the config file sounds like a good idea.

    Switching between the coast-build and the HelenOS source tree could be then automated.
    What you mean by switch here?

    Do you think it will be once possible to support also pcc, binutils and even python builds in coastline?
    Yes. I think it is a good idea to have the ported applications in a different repository and leave in the source tree only the libraries/programs created primarily for HelenOS. I am planning to try to move PCC to coastline and, maybe, eventually remove it from the HelenOS source tree. But it is too early for that. Regarding Python - that should be relatively easy: it uses my old configure helper script and actually some of the patches sent to the ML correspond (more or less) with my GCC branch.

    OdpovědětVymazat
    Odpovědi
    1. > What you mean by switch here?

      Go to coast-build, build zlib, go to HelenOS dir, rebuild, go to coast-build, build something else, go to HelenOS dir, rebuild etc...

      Vymazat
  6. And of course, a formal description of harbour dependencies and transitive installation of these dependencies would be nice. If everything POSIX-like will be eventually moved to coastline, we could move the entire libposix there too.

    OdpovědětVymazat