summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 540e645bcc5047ee0578541fa8db03806421c61e (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
# shellcheck disable=SC2034,SC2086,SC2128,SC2148,SC2154,SC2164
# Maintainer: Toria <ninetailedtori@uwu.gal>
# Maintainer: Darjan Krijan [https://disc-kuraudo.eu]

url="https://www.amd.com/en/developer/aocc.html"
_major=5-2
pkgver=5.2.0

_fetch_data=$(curl -sA 'Mozilla' "${url}") && {
    _major=$(echo "${_fetch_data}" | grep -oP 'aocc-\K\d+-\d+(?=-eula)' -- | head -1)
    pkgver=$(echo "${_fetch_data}" | grep -oP 'aocc-compiler-\K\d+\.\d+\.\d+' -- | head -1)
}

DLAGENTS=("https::/usr/bin/curl -A 'Mozilla' -fLC - --retry 3 --retry-delay 3 -o %o %u")
pkgname=aocc
pkgrel=1
pkgdesc="AMD Optimizing C/C++ Compiler"
arch=('x86_64')
license=('custom')
makedepends=('curl')
options=('staticlibs' '!strip' 'libtool')
optdepends=('environment-modules')
source=(
    "https://download.amd.com/developer/eula/aocc/aocc-${_major}/aocc-compiler-${pkgver}.tar"
    "modulefile"
)
install=aocc.install
sha256sums=(
    "$(echo "${_fetch_data}" | grep -oP '\w{64}(?=</td>)' | sed -n '1p')"
    '1740216760f755dc031d54f06c29333bca73f728d89a706f405b41e737bfc56f'
)
# Default compiler flags
# This by default sets your flags to CFLAGS, but you may replace them.
_default_flags="${CFLAGS}"

# path hardcoded in aocc.install. if you change this, change paths there as well
_aocc_prefix=/opt/aocc

package() {
    prefix=${pkgdir}${_aocc_prefix}
    mkdir -p ${prefix}

    cp -rp ${srcdir}/${pkgname}-compiler-${pkgver}/* ${prefix}

    ln -s ${_aocc_prefix}/bin/clang   ${prefix}/bin/aocc-clang
    ln -s ${_aocc_prefix}/bin/clang++ ${prefix}/bin/aocc-clang++
    ln -s ${_aocc_prefix}/bin/flang   ${prefix}/bin/aocc-flang

    # Default flags the compilers should use
    # This only works together with calling the "aocc-" prefixed symlinks above
    # Verbose output should read "Configuration file: /opt/aocc/bin/aocc.cfg"
    echo "${_default_flags}" > ${prefix}/bin/aocc.cfg

    # env-modules (optional)
    cp ${srcdir}/modulefile ${prefix}
    mkdir -p ${pkgdir}/etc/modules/modulefiles
    ln -s ${_aocc_prefix}/modulefile ${pkgdir}/etc/modules/modulefiles/${pkgname}
}