summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1883f79e5d88f6f48c120e7fe4a59f162995b9fa (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Maintainer: Martchus <martchus@gmx.net>

# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.

_android_arch=armv7a-eabi
pkgname=android-${_android_arch}-boost
pkgver=1.84.0
pkgrel=1
_srcname=boost_${pkgver//./_}
arch=('any')
pkgdesc="Free peer-reviewed portable C++ source libraries (Android, ${_android_arch})"
url="https://www.boost.org/"
license=('custom')
depends=("android-${_android_arch}-bzip2"
         "android-${_android_arch}-icu"
         "android-${_android_arch}-zlib"
         "android-${_android_arch}-zstd")
makedepends=('android-environment')
if [[ $_android_arch == aarch64 ]] || [[ $_android_arch == x86-64 ]]; then
makedepends+=("android-${_android_arch}-openmpi")
optdepends+=("android-${_android_arch}-openmpi: for mpi support")
fi
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/$_srcname.tar.bz2"
        "boost-1.81.0-phoenix-multiple-definitions.patch"
        "boost-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch"
        "disable-version-check.patch")
md5sums=('9cbfb9076ed06384471802b850698a6d'
         'cb1c25777e9b85af62366e7c930244b8'
         '991daf28f76ea0383620ccaf971decba'
         '6290eb4fa0cab451aac92e12e85ef073')

prepare() {
  cd "${srcdir}/$_srcname"
  source android-env ${_android_arch}

  # https://github.com/boostorg/phoenix/issues/111
  patch -Np1 -i ../boost-1.81.0-phoenix-multiple-definitions.patch

  # https://github.com/boostorg/ublas/pull/97
  patch -Np2 -i ../boost-ublas-c++20-iterator.patch
  patch -p1 -i ../disable-version-check.patch
}

build() {
  cd "${srcdir}/$_srcname"
  source android-env ${_android_arch}

  # Platform specific patches
  case "$_android_arch" in
      aarch64)
          _boost_arch=arm
          _boost_address_model=64
          ;;
      armv7a-eabi)
          _boost_arch=arm
          _boost_address_model=32
          ;;
      x86)
          _boost_arch=x86
          _boost_address_model=32
          ;;
      x86-64)
          _boost_arch=x86
          _boost_address_model=64
          ;;
      *)
          ;;
  esac

  ./bootstrap.sh -with-toolset=gcc

  # support for OpenMPI
  if [[ _boost_address_model == 64 ]]; then
    _boost_mpi='using mpi ;'
  else
    _boost_mpi=''
  fi

  userConfigs=$srcdir/$_srcname/user-config.jam

  cat << EOF > "${userConfigs}"
${_boost_mpi}
using clang : android : ${ANDROID_CXX} :
<archiver>${ANDROID_AR} \
<assembler>${ANDROID_AS}
;
EOF

  ./b2 install \
      --prefix="$srcdir/fakeinstall" \
      --user-config="${userConfigs}" \
      --layout=system \
      --with-atomic \
      --with-chrono \
      --with-container \
      --with-date_time \
      --with-exception \
      --with-fiber \
      --with-filesystem \
      --with-graph \
      --with-graph_parallel \
      --with-iostreams \
      --with-locale \
      --with-log \
      --with-math \
      --with-mpi \
      --with-program_options \
      --with-random \
      --with-regex \
      --with-serialization \
      --with-system \
      --with-test \
      --with-thread \
      --with-timer \
      --with-type_erasure \
      --with-wave \
      --with-stacktrace \
      -sICONV_PATH="${ANDROID_PREFIX}" \
      variant=release \
      debug-symbols=off \
      runtime-link=shared \
      link=shared,static \
      target-os=android \
      toolset=clang-android \
      architecture=$_boost_arch \
      threading=multi \
      address-model=$_boost_address_model \
      cflags="${CXXFLAGS}" \
      cxxflags="${CFLAGS}" \
      linkflags="${LDFLAGS}"
}

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

  find "${srcdir}/fakeinstall"/lib -iname '*.a' -exec $ANDROID_STRIP -g {} \;
  find "${srcdir}/fakeinstall"/lib -iname '*.so' -exec $ANDROID_STRIP --strip-unneeded {} \;

  install -dm755 "$pkgdir/${ANDROID_PREFIX_LIB}/"
  cp -a "${srcdir}/fakeinstall"/lib/*.{a,so} "$pkgdir/${ANDROID_PREFIX_LIB}/"
  cp -a "${srcdir}/fakeinstall"/lib/cmake "$pkgdir/${ANDROID_PREFIX_LIB}/"
  cp -a "${srcdir}/fakeinstall"/include "$pkgdir/${ANDROID_PREFIX}/"

  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE_1_0.txt
}