summaryrefslogtreecommitdiff
path: root/elements/gnu-toolchain/gcc.bst
blob: 37f7a5b6a269137b296c502ec4f978901e244a0c (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
kind: manual

description:
  Full featured native compiler which builds everything after gnu-toolchain.bst

sources:
- kind: git
  url: upstream:gcc-tarball
  track: baserock/gcc-7.1.0
  ref: 3b0dbcfa2e5d12bd80cab1b35f08653d61fe7838

depends:
- filename: gnu-toolchain/stage2.bst
  type: build
- gnu-toolchain/fhs-dirs.bst
- gnu-toolchain/linux-api-headers.bst
- gnu-toolchain/glibc.bst
- gnu-toolchain/zlib.bst
- gnu-toolchain/m4-tarball.bst

variables:
  gcc-arch-flags: ''

  (?):
    # ARM platforms vary a lot even within a single architecture revision,
    # and require tweaks such as this to produce a useful compiler.
    # This is a default configuration that has worked for some targets.
    - arch in ["armv7b", "armv7l"]:
        gcc-arch-flags: --with-arch=armv7-a
    - arch in ["armv7blhf", "armv7lhf"]:
        gcc-arch-flags: >
                        --with-arch=armv7-a
                        --with-cpu=cortex-a9
                        --with-tune=cortex-a9
                        --with-fpu=vfpv3-d16
                        --with-float=hard

    - arch in ["armv8b64", "armv8l64", "ppc64b", "ppc64l", "x86_64"]:
        lib: lib64

environment:
  PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin

config:

  configure-commands:
  - mkdir o

  # Configure flag notes:    
  #   1. An attempt to stop anything going in %{prefix}/lib64 (which doesn't
  #      fully work; we will need to hobble the multilib configuration in
  #      config/i386/t-linux64 if we really want to kill /lib64).
  #   2. Avoid having more than one copy of ZLib in use on the system
  #   3. Multilib does not make sense in Baserock.
  - |
    cd o && ../configure %{gcc-arch-flags}                      \
              --prefix="%{prefix}"                              \
      `# [1]` --libdir=%{prefix}/lib                            \
              --disable-bootstrap                               \
      `# [2]` --with-system-zlib                                \
      `# [3]` --disable-multilib                                \
              --enable-languages=c,c++,fortran                  \
              --build=%{target}                                 \
              --host=%{target}                                  \
              --target=%{target}

  build-commands:
  - cd o && make

  install-commands:
  - cd o && make DESTDIR="%{install-root}" install
  - ln -s gcc "%{install-root}%{prefix}/bin/cc"
  - |
    for fortran_alias in f77 f90 f95; do
      ln -s gfortran "%{install-root}%{prefix}/bin/$fortran_alias"
    done

  strip-commands:
  - |
    %{stage3-strip-binaries}

  (?):
    # GCC is not passing the correct host/target flags to GMP's configure
    # script, which causes it to not use the machine-dependent code for
    # the platform and use the generic one instead.  However, the generic
    # code results on an undefined reference to `__gmpn_invert_limb' in
    # ARMv7.  Fix the invocation of GMP's configure script so that GMP can
    # use the machine-dependent code.
    - arch.startswith("armv5"):
        build-commands:
          (<):
          - sed -i "s/--host=none/--host=armv5/" o/Makefile
          - sed -i "s/--target=none/--target=armv5/" o/Makefile
    - arch.startswith("armv7"):
        build-commands:
          (<):
          - sed -i "s/--host=none/--host=armv7a/" o/Makefile
          - sed -i "s/--target=none/--target=armv7a/" o/Makefile

public:
  bst:
    split-rules:
      runtime:
        - |
          %{prefix}/%{lib}/lib*.so*

      devel:
        (>):
        - |
          %{bindir}/*
        - |
          %{prefix}/%{lib}/lib*.a
        - |
          %{prefix}/%{lib}/lib*.las
        - |
          %{prefix}/lib/gcc
        - |
          %{prefix}/lib/gcc/**
        - |
          %{libexecdir}/gcc
        - |
          %{libexecdir}/gcc/**
        - |
          %{prefix}/%{target}
        - |
          %{prefix}/%{target}/*

      debug:
        (>):
        - |
          %{datadir}/gcc-*/
        - |
          %{datadir}/gcc-*/**