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

# shellcheck disable=SC2034
_arch="mips"
_platform="ps2"
_iop="${_arch}el-${_platform}"
_ee="${_arch}64r5900el-${_platform}-elf"
_base="sdk"
_pkgbase="${_platform}${_base}-ports"
_pkg="libjpeg"
pkgname="${_platform}-${_pkg}"
pkgver="v6b"
_ports_ver="v1.3.0"
pkgrel=1
_pkgdesc=("JPEG image codec with accelerated baseline compression and decompression "
          "(Sony Playstation® 2 videogame system port).")
pkgdesc="${_pkgdesc[*]}"
arch=('x86_64')
license=('MIT')
_ns="yaml"
_github="https://github.com/${_ns}"
_local="ssh://git@127.0.0.1:/home/git"
url="${_github}/${_pkg}"
_ports_url="https://github.com/${_platform}dev/${_platform}${_base}-ports"
makedepends=("${_platform}-sdk"
             "cmake")
optdepends=()
_commit="2c891fc7a770e8ba2fec34fc6b545c672beb37e6"
_ports_commit="e3f9bfd51e3266b3c68de19b76f6d378f6ec643b"
source=("${_platform}-ports::git+${_ports_url}#commit=${_ports_commit}")
# source=("${pkgname}::git+${_local}/${pkgname}#commit=${_commit}")
sha256sums=('SKIP')

_ee_include="/usr/${_ee}/include"
_ee_lib="/usr/${_ee}/lib"
_sdk_include="/usr/include/${_platform}${_base}"
_pe_include="/usr/${_ee}/include/pthread-embedded"
_pe_lib="/usr/${_ee}/lib/pthread-embedded"

_ldflags=(-L"${_pe_lib}"
          -L"${_ee_lib}")

prepare() {
  cd "${srcdir}/${_platform}-ports"
  local _sample _samples=()
  _samples=($(find . | grep Makefile))
  for _sample in "${_samples[@]}"; do
    sed -i 's/include $(PS2SDK)\/samples/include $(PS2SDKDATADIR)\/samples/g' "${_sample}"
  done
}

build() {
  export CFLAGS=""
  export CXXFLAGS=""
  export CPPFLAGS=""
  export LDFLAGS=""
  export IOP_CC=""
  export EE_CC=""
  export EE_INCS=""
  export EE_CFLAGS=""
  export EE_CFLAGS=""
  export PS2SDKDATADIR=""

  local _ee_cflags=(-I"${_pe_include}"
                    -L"${_pe_lib}"
                    # '-include' "${srcdir}/${pkgname}/${_pkg}/ee/include/config.h"
                    -I"../include"
                    -I"${_ee_include}"
                    -L"${_ee_lib}")

  local _make_opts=(PS2SDKDATADIR="/usr/share/${_platform}${_base}")
                    # LDFLAGS="${_ldflags[*]}"
                    # EE_CFLAGS="${_ee_cflags[*]}")

  export PS2SDK="${srcdir}/${_platform}${_base}"
  export PS2SDKDATADIR="/usr/share/ps2sdk"

  cd "${srcdir}/${_platform}-ports/"

  PS2SDKDATADIR="/usr/share/ps2sdk" \
  make "${_make_opts[@]}" -C "${_pkg}/src"
}

# shellcheck disable=SC2154
package() {

  export CFLAGS=""
  export CXXFLAGS=""
  export CPPFLAGS=""
  export LDFLAGS=""
  export PS2SDK="/usr"

  local _make_opts=(PS2SDKDATADIR="/usr/share/${_platform}${_base}"
                    DESTDIR="${pkgdir}")

  cd "${srcdir}/${_platform}-ports/"
  PS2SDKDATADIR="/usr/share/ps2sdk" \
  make DESTDIR="${pkgdir}" "${_make_opts[@]}" -C "${_pkg}/src" install
  cd "${pkgdir}/usr"
  mv "ports" "${_ee}"
}