summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5aa0e3ee3be516a5da67bd6e94f03881dd2372f9 (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
pkgname=mingw-w64-boost
pkgver=1.86.0
_boostver=${pkgver//./_}
pkgrel=1
pkgdesc="Free peer-reviewed portable C++ source libraries (mingw-w64)"
arch=('any')
url="http://www.boost.org/"
license=('custom')
depends=('mingw-w64-zstd' 'mingw-w64-bzip2' 'mingw-w64-dlfcn')
makedepends=('mingw-w64-gcc' 'mingw-w64-wine' 'mingw-w64-environment')
options=('!strip' '!buildflags' 'staticlibs')
source=("https://boostorg.jfrog.io/artifactory/main/release/${pkgver}/source/boost_${_boostver}.tar.bz2")
sha256sums=('1bed88e40401b2cb7a1f76d4bab499e352fa4d0c5f31c0dbae64e24d34d7513b')

_architectures="32:i686-w64-mingw32 64:x86_64-w64-mingw32"

prepare() {
  # process_handle_windows.cpp:(.text+0x25): undefined reference to `_imp__WSACleanup@0'
  sed -i -e "/if \[ os.name \] = NT/d" -e "/{/d" -e "/}/d" "${srcdir}"/boost_${_boostver}/libs/process/build/Jamfile
  sed -i -e "46ilib ws2_32 ;" -e "57i<target-os>windows:<library>ws2_32" "${srcdir}"/boost_${_boostver}/libs/process/build/Jamfile

  # from_exception.cpp:333:23: error: 'current_exception' is not a member of 'std'
  sed -i "160i#include <exception>" "${srcdir}"/boost_${_boostver}/libs/stacktrace/src/from_exception.cpp
  sed -i "160i\ \ \ \ <target-os>windows:<library>dl" "${srcdir}"/boost_${_boostver}/libs/stacktrace/build/Jamfile.v2

  for _arch in ${_architectures}; do
    source mingw-env "${_arch:3}"

    rm -rf build-${_arch:3}
    cp -r boost_${_boostver} build-${_arch:3}
    pushd build-${_arch:3}

    cat > user-config.jam << EOF
using gcc : mingw64 : ${CXX}
        :
        <rc>${_arch:3}-windres
        <archiver>${_arch:3}-ar
;
EOF
    ./bootstrap.sh --with-toolset=gcc
    popd
  done
}

package() {
  cd "${srcdir}"
  for _arch in ${_architectures}; do
    source mingw-env "${_arch:3}"
    pushd "build-${_arch:3}"
    LD_PRELOAD="" ./b2 -d2 -q ${MAKEFLAGS} \
      target-os=windows \
      variant=release \
      threading=multi \
      threadapi=win32 \
      link=shared,static \
      runtime-link=shared \
      --prefix=${pkgdir}/usr/${_arch:3} \
      --user-config=user-config.jam \
      --without-python --without-mpi --without-graph_parallel \
      cxxflags="${CXXFLAGS}" \
      linkflags="${LDFLAGS}" \
      address-model=${_arch:0:2} \
      architecture=x86 \
      binary-format=pe \
      abi=ms \
      -l0 ${MAKEFLAGS} \
      --layout=system install
    install -d $pkgdir/usr/${_arch:3}/bin
    mv "$pkgdir"/usr/${_arch:3}/lib/*.dll "$pkgdir"/usr/${_arch:3}/bin
    ${_arch:3}-strip --strip-unneeded "$pkgdir"/usr/${_arch:3}/bin/*.dll
    ${_arch:3}-strip -g "$pkgdir"/usr/${_arch:3}/lib/*.a
    popd
  done
}