summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5159e51ebbe54f5db47333d5628b47dc53a1c485 (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
# Maintainer: Pellegrino Prevete <pellegrinoprevete@gmail.com>

# shellcheck disable=SC2034
_module="ee"
_platform="ps2"
target="mips64r5900el-${_platform}-elf"
_bu="binutils"
_base="toolchain"
pkgname=("${target}-${_bu}")
pkgver="v2.38.0"
pkgrel=1
_pkgdesc=("A set of programs to assemble and manipulate binary and object files "
          "for the Sony PlayStation® 2 videogame system (binutils, ${_target}).")
pkgdesc="${_pkgdesc[*]}"
arch=('x86_64')
license=('BSD')
_github="https://github.com/ps2dev"
_local="ssh://git@127.0.0.1:/home/git"
url="${_github}/${_bu}-gdb"
checkdepends=('shellcheck')
makedepends=("libgmp-static"
             "mpfr-static"
             "libmpc-static"
             "zstd-static")
optdepends=()
provides=("${_platform}-${_module}-${_bu}")
_branch="${_module}-${pkgver}"
_commit="04d85a33e7dd7a10b937dca8855a526c4b92601a"
source=("${pkgname}::git+${_github}/${_bu}-gdb#commit=${_commit}")
# source=("${pkgname}::git+${_local}/${_platform}-${_bu}-gdb#branch=${_branch}")
sha256sums=('SKIP')

_n_cpu="$(getconf _NPROCESSORS_ONLN)"
_make_opts=(-j "${_n_cpu}")

cflags=(-static
        -O2
        -Wno-implicit-function-declaration)

ldflags=(${LDFLAGS}
         -Bstatic
         -s)

# shellcheck disable=SC2154
build() {
  local _target

  local _cflags=(${cflags[@]})

  local _ldflags=(${ldflags[@]})

  local _build_opts=(${_make_opts[@]}
                     CFLAGS="${_cflags[*]}"
                     CPPFLAGS="${_cflags[*]}"
                     LDFLAGS="${_ldflags[*]}")

  cd "${srcdir}/${pkgname}"

  for _target in "${target}"; do
    rm -rf "build-${_target}"
    mkdir -p "build-${_target}"
    cd "build-${_target}"
    local _configure_opts=(--prefix="/usr"
                           --infodir="/usr/share/info"
                           --target="${_target}"
                           --disable-separate-code
                           --disable-sim
                           --disable-nls)

    "../configure" ${_configure_opts[@]}

    make "${_build_opts[@]}"
    
    cd ..
  done
}

# shellcheck disable=SC2154
package() {
  local _target
  cd "${srcdir}/${pkgname}"
  for _target in "${target}"; do
    cd "build-${_target}"
    make DESTDIR="${pkgdir}" "${_make_opts[@]}" install-strip
    cd ..
  done
}