summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c238031aaf8262dab1127900cde14d380482091e (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
# $Id$
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Eric Belanger <eric@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>

_target=aarch64-linux-gnu
_pkgname=pcre
pkgname=${_target}-pcre
pkgver=8.41
pkgrel=1
pkgdesc='A library that implements Perl 5-style regular expressions'
arch=('any')
url='http://www.pcre.org/'
license=('BSD')
depends=(
#'gcc-libs' 'readline' 
'zlib-aarch64'
#'bzip2'
'bash')
validpgpkeys=('45F68D54BBE23FB3039B46E59766E084FB0F43D8') # Philip Hazel
source=("https://ftp.pcre.org/pub/pcre/$_pkgname-$pkgver.tar.bz2"{,.sig})
md5sums=('c160d22723b1670447341b08c58981c1'
         'SKIP')

prepare() {
  cd $_pkgname-$pkgver
  # apply patch from the source array (should be a pacman feature)
  local filename
  for filename in "${source[@]}"; do
    if [[ "$filename" =~ \.patch$ ]]; then
      msg2 "Applying patch ${filename##*/}"
      patch -p1 -N -i "$srcdir/${filename##*/}"
    fi
  done
  # avoid compiler default flags
  sed -i "s,/usr/\(include\|lib\),/usr/${_target:?}/\1," pcre-config.in
  :
}

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 \
    --host=${_target} \
    --prefix=/usr/${_target} \
    --enable-unicode-properties \
    --enable-pcre16 \
    --enable-pcre32 \
    --enable-jit \
    --enable-pcregrep-libz \
    --disable-cpp \
#    --enable-pcregrep-libbz2 \
#    --enable-pcretest-libreadline
fi
  make
}

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
}

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

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

package() {
  cd $_pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENCE "$pkgdir/usr/${_target}/share/licenses/$_pkgname/LICENSE"

  mkdir -p "$pkgdir/usr/bin"

  # delete everything but the script
  mv "$pkgdir/usr/${_target}/bin/pcre-config" "$pkgdir/usr/bin/${_target}-pcre-config"
  rm -f "$pkgdir/usr/${_target}/bin"/*

  # restore the script
  install -Dm755 "$pkgdir/usr/bin/${_target}-pcre-config" "$pkgdir/usr/${_target}/bin/pcre-config"
}

# vim:set ts=2 sw=2 et: