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

# shellcheck disable=SC2034
_arch="mips"
_platform="ps2"
_iop="${_arch}el-${_platform}"
_ee="${_arch}64r5900el-${_platform}-elf"
_base="sdk"
_ns="${_platform}${_base}"
_pkgbase="${_platform}${_base}-ports"
_pkg="lz4"
pkgname="${_platform}-${_pkg}"
pkgver="v1.9.4"
_ports_ver="v1.3.0"
pkgrel=1
_pkgdesc=("Extremely Fast Compression algorithm "
          "(Sony Playstation® 2 videogame system port).")
pkgdesc="${_pkgdesc[*]}"
arch=('x86_64')
license=('GPL2')
_ns="${_pkg}"
_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="5ff839680134437dbf4678f3d0c7b371d84f4964"
_ports_commit="e3f9bfd51e3266b3c68de19b76f6d378f6ec643b"
source=("${pkgname}::git+${url}#commit=${_commit}"
        "${_platform}-ports::git+${_ports_url}#commit=${_ports_commit}")
# source=("${pkgname}::git+${_local}/${pkgname}#commit=${_commit}")
sha256sums=('SKIP'
            '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 _rep 
    local _reps=("s~\$ENV{PS2SDK}/ee/include~${_ee_include}~g"
                 "s~\$ENV{PS2SDK}/common/include~${_sdk_include}~g"
                 "s~\$ENV{PS2DEV}/ee/ee~~g"
                 "s~\$ENV{PS2DEV}/ee~~g"
                 "s~\$ENV{PS2DEV}/ports~${pkgdir}/usr/${_ee}~g"
                 "s~\$ENV{PS2DEV}~~g"
                 "s~\$ENV{PS2SDK}/ports~~g"
                 "s~\$ENV{PS2SDK}~~g"
                 "s~CMAKE_FIND_ROOT_PATH ~CMAKE_FIND_ROOT_PATH /usr/${_ee}~g"
                 "s~CMAKE_C_FLAGS_INIT \"~CMAKE_C_FLAGS_INIT \"-std=gnu++11 ~g"
                 "s~-D_EE~-D_EE -r~g")
    for _rep in "${_reps[@]}"; do
        sed -i "${_rep}" "${_platform}dev.cmake"
    done
    local _linker_flags=(-r)
}

build() {

  export CFLAGS=""
  export CXXFLAGS=""
  export CPPFLAGS=""
  export LDFLAGS=""

  local _cmake_opts=(-Wno-dev
                     -DCMAKE_TOOLCHAIN_FILE="${srcdir}/${_platform}-ports/ps2dev.cmake"
                     -DCMAKE_INSTALL_PREFIX="/usr/${_ee}"
                     -DBUILD_SHARED_LIBS=OFF
                     -DLDFLAGS="-L${_ee_lib}"
                     -DCMAKE_BUILD_TYPE=RelWithDebInfo
                     -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON)

  local _site_opts=(-DLZ4_POSITION_INDEPENDENT_LIB=OFF
                    -DLZ4_BUILD_CLI=OFF
                    -DLZ4_BUILD_LEGACY_LZ4C=OFF)

  local _extra_opts=(-G"Unix Makefiles")

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

  local _build="${srcdir}/${pkgname}/build/cmake/build"
  mkdir -p "${_build}"
  cd "${_build}"
  cmake "${_cmake_opts[@]}" "${_site_opts[@]}" "${_extra_opts[@]}" ..
}

# shellcheck disable=SC2154
package() {
  cd "${srcdir}/${pkgname}/build/cmake/build"
  make DESTDIR="${pkgdir}" clean install
}