summaryrefslogtreecommitdiffstats
path: root/examples/libgcc-initial.yml
blob: 3f2bd2ee2c128bf159171840359dc95ee3fae3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
tasks:
  configure:
    args:
      host: 'platform'
      target: 'platform'
    inherit:
      task: 'gcc:compile'
    build_depends:
      - task: 'binutils:install'
        args:
          target: 'target'
    depends:
      - task: 'gcc:header-stubs'
    run: |
      cd gcc-build
      make configure-target-libgcc

      # A hack borrowed from OpenEmbedded:
      # We can build an initial libgcc without having to rebuild the whole gcc
      # afterwards by manipulating the Makefile
      sed -i -r \
        -e 's@^(INHIBIT_LIBC_CFLAGS =).*@\1 -Dinhibit_libc@' \
        gcc/libgcc.mvars
      sed -i -r \
        -e 's@^(thread_header =).*@\1 gthr-single.h@' \
        -e 's@^(enable_shared =).*@\1 no@' \
        {{target.gnu_triplet}}/libgcc/Makefile

  compile:
    args:
      host: 'platform'
      target: 'platform'
    inherit:
      task: 'libgcc-initial:configure'
    build_depends:
      - task: 'binutils:install'
        args:
          target: 'target'
    depends:
      - task: 'gcc:header-stubs'
    run: |
      cd gcc-build
      make -j8 all-target-libgcc

  install:
    args:
      host: 'platform'
      target: 'platform'
    inherit:
      task: 'libgcc-initial:compile'
    build_depends:
      - task: 'binutils:install'
        args:
          target: 'target'
    output:
      default: {}
    run: |
      cd gcc-build
      make DESTDIR={{destdir}} install-target-libgcc
      ln -s libgcc.a {{destdir}}{{host.prefix}}/lib/gcc/{{target.gnu_triplet}}/11.2.0/libgcc_eh.a