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

# shellcheck disable=SC2034
target="dvp"
_platform="ps2"
_bu="binutils"
_pkg="${_bu}-gdb"
_base="toolchain"
pkgname="${target}-binutils"
pkgver="v2.14"
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}/${_pkg}"
_branch="${_module}-${pkgver}"
_commit="9cca5c1781d1a03b9b3b61a3e5270cdb9c69295e"
source=("${pkgname}::git+${_github}/${_pkg}#commit=${_commit}")
# source=("${pkgname}::git+${_local}/${_platform}-${_pkg}#branch=${_branch}")
sha256sums=('SKIP')

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

# shellcheck disable=SC2154
build() {
  local _target

  local _cflags=(-D_FORTIFY_SOURCE=0
                 -O2
                 -Wno-implicit-function-declaration)

  local _ldflags=(${LDFLAGS}
                  -s)

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

  export CFLAGS=""

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

  for _target in "${target}"; do
    rm -rf "build-${_target}"
    mkdir -p "build-${_target}"
    cd "build-${_target}"
    local _configure_opts=(--prefix="/usr"
                           --with-sysroot="/usr/${target}"
                           --libdir="/usr/${target}/lib"
                           --infodir="/usr/${target}/share/info"
                           --mandir="/usr/${target}/man"
                           --target="${target}"
                           --disable-nls
                           --disable-build-warnings)

    "../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}" install # ${_make_opts[@]}
    cd ..
  done
}