summaryrefslogtreecommitdiff
path: root/pcr/lightspark/PKGBUILD
blob: 4a91f68535979ca2a1fcb2cd6ae90688c616cc19 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Maintainer (arch): Daniel Landau <daniel+aur@landau.fi>
# Contributor: sekret, mail=$(echo c2VrcmV0QHBvc3Rlby5zZQo= | base64 -d)
# Contributor: mmm
# Contributor: bslackr <brendan at vastactive dot com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: bill-auger <bill-auger@programmer.net>


pkgname=lightspark
pkgver=0.8.2
pkgrel=2
pkgdesc="An open source flash player implementation"
arch=('armv7h' 'i686' 'x86_64')
url=http://lightspark.github.io/
license=('LGPL3')

depends=('boost-libs' 'cairo' 'curl' 'desktop-file-utils' 'ffmpeg' 'glew' \
         'glibmm' 'llvm' 'pango' 'rtmpdump' 'sdl2_mixer'                  )
optdepends=('gnash-gtk: Gnash fallback support')
makedepends=('cmake' 'nasm' 'boost')
conflicts=('lightspark-git')
install=lightspark.install
source=(https://github.com/lightspark/lightspark/archive/${pkgver}.tar.gz)
sha256sums=('05595a3085bf76ea5c9723f128dcadead5ccf38e177c3a456901ccee3265548a')

# FIXME: FTBS against boost 1.72.0 - see note in prepare()
source+=(include-boostserialization.patch)
sha256sums+=('669b021aebb1bd0f4f8f7c029b963c575eaf3cdee1de194144bc8c9b8b61d2e5')


_version_constraint() # (dep_pkgname [precision])
{
  Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }


  local dep_pkgname=$1
  declare -i req_precision=$2
  local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  local def_precision=$(( n_dots + 1 ))
  local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  local pkgver_rx='[0-9A-Za-z_]+'
  pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
                                               # but some pkgver have it (eg: 5.15.10+kde+r130)
  local subver_rx='\.'${pkgver_rx}
  local pkgrel_rx='[0-9]+'
  local garbage_rx='[^0-9].*'
  local capture_rx=${pkgver_rx}
  for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  local version pkgrel has_dot_char version_min version_max constraint_string
  declare -i subver subver_inc pkgrel_inc

  if   [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  then version=${BASH_REMATCH[1]} # pkgver cut to the requested precision
       #unused=${BASH_REMATCH[2]} # discarded pkgver segments
       pkgrel=${BASH_REMATCH[3]}  # pkgrel with non-numerics right-trimmed
       has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
       subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
       version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
       subver_inc=$(( subver + 1 ))
       pkgrel_inc=$(( pkgrel + 1 ))
       version_min=$(   (( ! is_prec_valid    )) && echo ${full_version%-*}-${pkgrel} || \
                                                    echo ${version}                      )
       version_max=$( ( (( ! is_prec_valid    )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
                      ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc}      ) || \
                                                    echo ${subver_inc}                         )
       constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"

       Log "Applied version constraint: '${constraint_string}'"
  else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
       exit 1
  fi

  unset -f Log

  echo -n "${constraint_string}"
}


prepare()
{
  cd "${srcdir}"/${pkgname}-${pkgver}/

  [ -d build ] && rm -rf build/* || mkdir build

  # FIXME: FTBS against boost 1.72.0 - next upstream release should have this patch applied
  # https://labs.parabola.nu/issues/2568
  # https://github.com/lightspark/lightspark/pull/409
  # i686 still has boost-libs 1.71.0
  [[ "${CARCH}" != 'i686' ]] && patch -Np1 < "${srcdir}"/include-boostserialization.patch
}

build()
{
  cd "${srcdir}"/${pkgname}-${pkgver}/build

  cmake -DCMAKE_INSTALL_PREFIX=/usr         \
        -DCOMPILE_PLUGIN=1                  \
        -DCMAKE_BUILD_TYPE=Release          \
        -DGNASH_EXE_PATH=/usr/bin/gtk-gnash \
        -DAUDIO_BACKEND="pulseaudio sdl"   ..
  make CFLAGS=-Wno-dev
}

package()
{
  # pin to strongly-coupled dependency versions
  depends=( ${depends[*]/boost-libs/} $(_version_constraint 'boost-libs') )

  cd "${srcdir}"/${pkgname}-${pkgver}/build

  make DESTDIR="${pkgdir}/" install

  local _boost_ver=$(pacman -S --print-format='%v' boost-libs)
  depends+=("boost-libs>=${_boost_ver}" "boost-libs<$((${_boost_ver%%.*} + 1))")
}