summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 777ff3db3a279d4582b5b679d2a3589826e75bfa (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
# $Id$
# Contributor: St├ęphane Gaudreault <stephane@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

_target=aarch64-linux-gnu
pkgname=${_target}-libffi
_pkgname=libffi
pkgver=3.2.1
pkgrel=1
pkgdesc='Portable foreign function interface library'
arch=('any')
url='http://sourceware.org/libffi/'
license=('MIT')
depends=("${_target}-glibc")
source=(ftp://sourceware.org/pub/libffi/libffi-$pkgver.tar.gz)
sha1sums=('280c265b789e041c02e5c97815793dfc283fb1e6')

build() {
  cd $_pkgname-$pkgver
if [ n != "$RUN_PREPARE" ]; then
  if [ 1 = "$ccache" ]; then
    export CC=${CC:-ccache ${_target}-gcc}
    export CXX=${CXX:-ccache ${_target}-g++}
  fi
  unset CFLAGS CXXFLAGS
  ./configure --prefix=/usr/${_target} --disable-static \
    --host=${_target} \
    --enable-pax_emutramp
fi
  make
}

strip() {
  ${_target}-strip "$@"
}

objcopy() {
  ${_target}-objcopy "$@"
}

check() {
  local s readelfarch
  readelfarch='AArch64'
  cd $_pkgname-$pkgver

  s=$(find . -type f "(" -name "*.so*" -o -name "*.a" ")" -print0 | \
    2>/dev/null LC_ALL=C xargs -0 readelf -h | \
    sed -n -e '/File:/h;/Machine:/{/'"$readelfarch"'/!{H;x;p}}' | head -10)

  if [ -n "$s" ]; then
    >&2 echo "some binaries have wrong architecture:"
    >&2 echo "$s"
    return 1
  fi
}

package() {
  cd $_pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm644 LICENSE "$pkgdir"/usr/${_target}/share/licenses/$_pkgname/LICENSE
}