summaryrefslogtreecommitdiff
path: root/core/gcc/PKGBUILD
blob: 4c4a6c17a5fd406fb7bee61693624f8b002ceb41 (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
# remove tsan (thread sanitizer) plugin, not available for i686
pkgname=(
  $(
    printf '%s\n' "${pkgname[@]}" | \
      grep -vFx 'lib32-gcc-libs'
  )
)
unset -f 'package_lib32-gcc-libs'
eval "$(
  declare -f prepare | \
    sed '
      \,/s/lib64/lib/, d
    '
  declare -f build | \
    sed '
      /configure/ s/--enable-multilib/--disable-multilib/
      /configure/ s,--with-bugurl=https://bugs\.archlinux\.org/,--with-bugurl=https://bugs.archlinux32.org/,
      /configure/ s/;$/ --build=$CHOST;/
    '
  declare -f package_gcc-libs | \
    sed '
      s/\$pkgname-multilib//
      s@libsanitizer/{a,l,ub,t}san@libsanitizer/{a,l,ub}san@
      /provides=/s/libtsan.so//
      \@/usr/lib32/@ d
    '
  declare -f package_gcc | \
    sed '
      s/"lib32-gcc-libs[^"]*"//g
      s@make.*tsan.*install@#\0@
    '
  declare -f package_gcc-ada | \
    sed '
      \,cd .*/32/libada,{
        N
        d
      }
    '
)"
eval "$(
  for name in "${pkgname[@]}"; do
    declare -f package_${name} | \
      sed '
        s/$pkgname-multilib//
        s/{,32}//
        \,/lib32/,d
        \,/32/,d
      '
  done
)"

# i486-specific

# no ADA
makedepends=(${makedepends[@]//gcc-ada/})
makedepends_i686+=('gcc-ada')

if [ "${CARCH}" = "i486" ]; then
  package_gcc-ada() {
    touch "$pkgdir/this-is-a-dummy-package"
  }

  eval "$(
    declare -f build | \
      sed '
        /enable-languages/ s/,ada//
      '
  )"

  eval "$(
    declare -f package_gcc | \
      sed '
        s/,gnat-style,gnat_rm,gnat_ugn//
      '
  )"

  # building toolchain (gcc): again, lobtool problems
  # /usr/lib/gcc/i486-pc-linux-gnu/7.3.0/ld: cannot find -lquadmath
  # collect2: error: ld returned 1 exit status
  # libtool: install: error: relink `libgfortran.la' with the above command before installing it
  # make: Leaving directory '/build/gcc/src/gcc-build/i486-pc-linux-gnu/libgfortran'
  # => wrong link order: libgfortran requires libquadmath
  eval "$(
    declare -f package_gcc-libs | \
      sed '
        /for lib in / s/libgfortran/libquadmath libgfortran/
      '
  )"

  # disable CET (Control Flow instructions endbr32/enbr64)
  eval "$(
    declare -f build | \
      sed '
        s/--enable-cet=auto/--disable-cet/
      '
  )"

else

  # force enable CET (Control Flow instructions endbr32/enbr64)
  eval "$(
    declare -f build | \
      sed '
        s/--enable-cet=auto/--enable-cet/
      '
  )"

fi

makedepends_pentium4=("${makedepends_i686[@]}")

source[1]='isl-0.24.tar.xz::https://downloads.sourceforge.net/project/libisl/isl-0.24.tar.xz?ts=gAAAAABhojIcYmUfplFkh4GCklCNjXe6c5A561-eOrQD92l7Dd9Lw5vOoApEOzfk2XL8NElrqvTKrH0enBWHiWCznbwG1pkAaQ%3D%3D&r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Flibisl%2Ffiles%2Fisl-0.24.tar.xz%2Fdownload%3Fuse_mirror%3Ddeac-fra%26download%3D%26failedmirror%3Ddeac-riga.dl.sourceforge.net'

makedepends=(${makedepends[@]//lib32-glibc/})
makedepends=(${makedepends[@]//lib32-gcc-libs/})

# i486-specific: disable PGO/LTO build, uses too much resources,
# also disabling LTO for now
if [ "${CARCH}" = "i486" ]; then
  eval "$(
    declare -f build | \
      sed '
        s/--enable-pgo-build=.*/--disable-pgo-build/
        s/--enable-lto/--disable-lto/
      '
    declare -f package_gcc | \
      sed '
        /make.*lto-plugin.*install/d
        /ln.*liblto_plugin.so/d
      '
  )"
fi