blob: 568cdee4747ff2fb628f58b00d4366a4f4ca145a (
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
|
# Maintainer: Gilbert Gilb's <gilbsgilbert@gmail.com>
pkgname=riscv32-gnu-toolchain-elf-bin
pkgver=2024.09.03
pkgrel=1
pkgdesc="GNU toolchain for riscv32 ELF, including GCC."
arch=('x86_64')
url="https://github.com/riscv-collab/riscv-gnu-toolchain"
license=('GPL2')
provides=(
)
conflicts=(
'riscv32-gnu-toolchain-elf-llvm-bin'
)
optdepends=()
makedepends=()
options=(!strip)
source=(
"https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv32-elf-ubuntu-22.04-gcc-nightly-2024.09.03-nightly.tar.gz"
)
sha512sums=(
"a5db640f65b291b5398b37a6d72835f09a828b7144e788b8efa53afab449150e77e4e5c5e330dac949ac41e83c36aa6b65eca4c018e04aa8bfd4de11f9cdd986"
)
package() {
install -dm755 "${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin "${pkgdir}"/usr/bin "${pkgdir}"/usr/lib/gcc
cp -pR "${srcdir}"/riscv/* "${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin
# Install sysroot
if test -d "${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin/sysroot; then
sysroot=/opt/riscv32-gnu-toolchain-elf-bin/sysroot
else
sysroot=/opt/riscv32-gnu-toolchain-elf-bin/riscv32-unknown-elf
fi
ln -s "${sysroot}" "${pkgdir}"/usr/riscv32-unknown-elf
# Install cross libgcc
ln -s /opt/riscv32-gnu-toolchain-elf-bin/lib/gcc/riscv32-unknown-elf "${pkgdir}"/usr/lib/gcc
# Install binaries
for f in "${srcdir}"/riscv/bin/riscv32-unknown-elf-*; do
f="$(basename "${f}")"
ln -s /opt/riscv32-gnu-toolchain-elf-bin/bin/"${f}" "${pkgdir}"/usr/bin
done
# Also provide target quadruplet to prevent confusing clang
ln -s riscv32-unknown-elf "${pkgdir}"/usr/riscv32-unknown-unknown-elf
ln -s riscv32-unknown-elf "${pkgdir}"/usr/lib/gcc/riscv32-unknown-unknown-elf
find \
"${pkgdir}" \
-name riscv32-unknown-elf \
-type d \
-exec /bin/sh -c 'ln -s riscv32-unknown-elf "$(dirname "$0")"/riscv32-unknown-unknown-elf' {} \;
# Strip
find \
"${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin/bin \
"${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin/lib \
"${pkgdir}"/opt/riscv32-gnu-toolchain-elf-bin/libexec \
-type f \
-exec /bin/sh -c 'if file --no-sandbox "$0" | grep -qE "ELF.*(executable|shared object)"; then strip "$0"; fi' {} \;
}
|