summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bc2cb3ed1536f2e322b4e3beac89eb3d95abf874 (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
pkgname=mingw-w64-libbacktrace-git
pkgver=r21.5a99ff7
pkgrel=2
pkgdesc="Library to produce symbolic backtraces (mingw-w64)"
arch=('any')
url="https://github.com/ianlancetaylor/libbacktrace"
license=('BSD')
depends=('mingw-w64-zlib')
makedepends=('mingw-w64-configure' 'git')
provides=('mingw-w64-libbacktrace')
conflicts=('mingw-w64-libbacktrace')
options=('!buildflags' '!strip' 'staticlibs')
source=("git+https://github.com/ianlancetaylor/libbacktrace.git")
sha256sums=('SKIP')

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

pkgver() {
  cd "libbacktrace"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare () {
  cd "libbacktrace"
  curl -L https://github.com/ianlancetaylor/libbacktrace/pull/28.patch | patch -p1
  # dont allow undefined symbols to build the dll
  sed -i "83ilibbacktrace_la_LDFLAGS = -no-undefined" Makefile.am
  # unknown macro AM_ENABLE_MULTILIB
  sed -i "s|AM_ENABLE_MULTILIB(, ..)|AC_MSG_NOTICE(["hello"])|g" configure.ac
  autoreconf -vfi
}

build() {
  cd "libbacktrace"
  for _arch in ${_architectures}; do
    mkdir -p "build-${_arch}" && pushd "build-${_arch}"
    OBJCOPY=/usr/bin/${_arch}-objcopy ${_arch}-configure ..
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "$srcdir/libbacktrace/build-${_arch}"
    make DESTDIR="$pkgdir/" install
    ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
  done
}