summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d643d456a0037a389fb7b1a82c76f191a1fa39fa (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: pingplug < aur at pingplug dot me >
# Contributor: Schala Zeal < schalaalexiazeal at gmail dot com >
# Contributor: ant32 < antreimer at gmail dot com >
# Contributor: Alexey Pavlov < Alexpux at gmail dot com >
# Contributor: Ray Donnelly < mingw dot android at gmail dot com >

_android_arch=aarch64

pkgname=android-${_android_arch}-icu
pkgver=78.2
pkgrel=1
arch=('any')
pkgdesc="International Components for Unicode library (Android ${_android_arch})"
groups=('android-icu')
depends=('android-ndk')
makedepends=('android-environment'
             'autoconf-archive'
             'patchelf')
options=(!strip !buildflags staticlibs !emptydirs)
license=('custom')
url="https://icu.unicode.org/"
source=("https://github.com/unicode-org/icu/releases/download/release-${pkgver}/icu4c-${pkgver}-sources.tgz")
md5sums=('2bf8db43ccdc837e402ac773f17c7cf8')

prepare() {
    cd "${srcdir}/icu/source"

    autoreconf -fi
}

build() {
    cd "${srcdir}/icu/source"
    mkdir -p nativebuild && pushd nativebuild
    CC=gcc CXX=g++ ../configure \
        --enable-static \
        --disable-shared
    make $MAKEFLAGS
    popd

    source android-env ${_android_arch}

    unset CPPFLAGS

    target=${_android_arch/x86-/x86_}-linux-android

    ./configure \
        --host=${target} \
        --target=${target} \
        --build="${CHOST}" \
        --prefix="${ANDROID_PREFIX}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --enable-shared \
        --enable-static \
        --with-cross-build="${PWD}/nativebuild" \
        --with-data-packaging=library \
        --enable-release \
        --disable-rpath \
        --disable-extras \
        --disable-tools \
        --disable-tests \
        --disable-samples
    make $MAKEFLAGS
}

package() {
    cd "${srcdir}/icu/source"
    source android-env ${_android_arch}

    make install DESTDIR="${pkgdir}"
    rm -rf "${pkgdir}/${ANDROID_PREFIX_SHARE}/man"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
    rm -f "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so.*

    # Fix the libraries soname

    for f in $(ls "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so); do
        patchelf --set-soname $(basename "$f") "$f"
    done

    install -vDm 644 "${srcdir}/icu/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}