]> rtime.felk.cvut.cz Git - hercules2020/hercules-compiler.git/blob - README.md
Update changelog for 2018.12.14-1 release
[hercules2020/hercules-compiler.git] / README.md
1 This is Debian packaging of the Hercules compiler provided by ETHZ.
2
3 Compiling the compiler manually
4 ===============================
5
6 To compile the compiler, without creating the Debian package, run:
7
8     apt install quilt cmake ninja-build python3
9
10     git submodule update --init
11     export QUILT_PATCHES=debian/patches
12     export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
13     quilt push -a
14
15     make
16     make install
17
18 This will install the compiler and related stuff into
19 ~/opt/hercules-compiler.
20
21 Creating Debian packages
22 ========================
23
24 Simple method
25 -------------
26
27 A simple method to create a native Debian package is the following:
28
29     apt install build-essential cmake ninja-build python3 gcc-5 g++-5
30     make create-orig-tgz
31     dpkg-buildpackage -b -uc
32
33 Note that gcc-5 may not be available in newer distributions such as
34 Debian Stretch. It is possible to compile it from source. For example
35 download its
36 [Debian source package](http://ftp.debian.org/debian/pool/main/g/gcc-5/)
37 and build it with `DEB_BUILD_OPTIONS="nolang=ada,fortran,java,objc"
38 dpkg-buildpackage -b -uc -us`.
39
40 Sbuild method - native
41 ----------------------
42
43 You can also use the sbuild tool to create the native package. The
44 advantage is that the build happens in a clean environment, ensuring
45 that only distribution-provided packages are used for building.
46
47 Setup the sbuild chroot as documented at
48 [Debian Wiki](https://wiki.debian.org/sbuild) and then build the
49 package with:
50
51     make create-orig-tgz
52     sbuild
53
54 Sbuild method - cross
55 ---------------------
56
57 Cross-compilation for different architecture is more complex,
58 especially in case of Ubuntu Xenial. Se let's start with simpler
59 variant - Debian Stretch.
60
61 ### Debian Stretch ###
62
63 For Debian Stretch, setup the chroot as above and install
64 qemu-user-static to both your host system and the build chroot:
65
66     sudo apt-get install qemu-user-static
67     sbuild-apt <chroot-name> apt-get install qemu-user-static
68
69 Then build the package with:
70
71     make create-orig-tgz
72     sbuild --host=arm64
73
74 ### Ubuntu Xenial (TX2) ###
75
76 Setup the chroot as above. Ubuntu Xenial does not have
77 qemu-user-static package so copy the static binaries from your host:
78
79     sudo apt-get install qemu-user-static
80         cp /usr/bin/qemu-aarch64-static /path/to/your/chroot/xenaial/usr/bin
81
82 Then modify /etc/apt/sources.list to contain the URL of arm64 package
83 repository. This is the sources.list that I use:
84
85     deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main universe multiverse restricted
86     deb-src http://cz.archive.ubuntu.com/ubuntu/ xenial main universe
87
88     deb [arch=arm64] http://ports.ubuntu.com/ xenial main universe multiverse restricted
89
90 Furthermore, Xenial has too old packages to cross build LLVM. For that
91 reason, we backport the following packages: `cmake_3.7.2-1` from
92 Debian Stretch and `ninja-build_1.8.2-1` from Debian unstable. Just
93 download the corresponding source packages (from e.g.
94 <https://packages.debian.org/source/stretch/cmake>) and run
95
96     sbuild -d xenial cmake_3.7.2-1.dsc
97         sbuild -d xenial ninja-build_1.8.2-1.dsc
98
99 Then install the created packages into the xenial chroot.
100
101 Then build the package by
102
103     make create-orig-tgz
104         sbuild --host=arm64 -d xenial --add-depends="libc6-dev, libstdc++-5-dev" --build-failed-commands='%s'
105
106 The `--build-failed-commands` switch ensures that a shell is run if
107 the build fails to allow investigating the problem.