summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8e28c1675c6ec107522e79f912a6e7f82f5ccb19 (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
# Maintainer:  Vitalii Kuzhdin <vitaliikuzhdin@gmail.com>

_name="libyuv"
pkgname="lib32-${_name}"
_commit="464c51a0353c71f08fe45f683d6a97a638d47833" # r2426
pkgver="r2426+${_commit::9}"
pkgrel=1
pkgdesc="Library for YUV scaling (32-bit)"
arch=('x86_64')
url="https://chromium.googlesource.com/libyuv/libyuv"
license=('LicenseRef-libavif')
depends=('lib32-gcc-libs' 'lib32-glibc' 'lib32-libjpeg-turbo' "${_name}>=${pkgver}")
makedepends=('cmake>=2.8.12' 'git') # 'lib32-gtest'
provides=("${_name}.so")
source=("git+${url}#commit=${_commit}")
sha512sums=('1a149818c4cddaef7963606cac5d6f1e2b6ccf700507ceca7e77f3206853c5f6818044c12af362d1f065c63e1aa9a8f3fde052e86841773417eb98f8ad2d8c69')

pkgver() {
  cd "${srcdir}/${_name}"
  printf "r%s+%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}


prepare() {
  cd "${srcdir}/${_name}"
  sed -e 's|yuvconvert ${JPEG_LIBRARY}|${ly_lib_shared} ${JPEG_LIBRARY}|' \
      -e 's|DESTINATION lib|DESTINATION lib32|g' \
      -e '/DESTINATION include/d' \
      -e '/yuvconvert/d' \
      -e '/yuvconstants/d' \
      -i 'CMakeLists.txt'
}

build() {
  export CFLAGS+=" -m32"
  export CXXFLAGS+=" -m32"
  export LDFLAGS+=" -m32"
  export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
  local cmake_options=(
    -G 'Unix Makefiles'
    -B "${_name}/build"
    -S "${_name}"
    -Wno-dev
    -DCMAKE_BUILD_TYPE:STRING='None'
    -DCMAKE_INSTALL_PREFIX:PATH='/usr'
    # -DCMAKE_INSTALL_LIBDIR='lib32'
    -DCMAKE_POLICY_VERSION_MINIMUM=3.5
    -DTEST:BOOL=OFF
  )
  
  cd "${srcdir}"
  cmake "${cmake_options[@]}"
  cmake --build "${_name}/build"
}

# check() {
#   local excluded_tests=""
#   local ctest_flags=(
#     --test-dir "${_name}/build"
#     --output-on-failure
#     --parallel $(nproc)
#     --exclude-regex "${excluded_tests}"
#   )
# 
#   cd "${srcdir}"
#   ctest "${ctest_flags[@]}"
# }

package() {
  cd "${srcdir}"
  DESTDIR="${pkgdir}" cmake --install "${_name}/build"

  cd "${pkgdir}/usr"
  rm -rf "bin" "include" "share"
}