From 9c617a99340541fdd9caea24d89a75dd25fbd071 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 26 Apr 2018 19:28:22 +0000
Subject: gdb: update to 8.1

---
 abs/core/gdb/PKGBUILD    | 74 +++++++++++++++++++++++++++++++++---------------
 abs/core/gdb/gdb.install | 18 ------------
 2 files changed, 51 insertions(+), 41 deletions(-)
 delete mode 100644 abs/core/gdb/gdb.install

diff --git a/abs/core/gdb/PKGBUILD b/abs/core/gdb/PKGBUILD
index 6e0648b..12c1933 100644
--- a/abs/core/gdb/PKGBUILD
+++ b/abs/core/gdb/PKGBUILD
@@ -1,43 +1,71 @@
-# $Id: PKGBUILD 172148 2012-11-30 04:20:34Z allan $
+# $Id$
 # Maintainer: Allan McRae <allan@archlinux.org>
 # Contributor: Jan de Groot <jgc@archlinux.org>
 
-pkgname=gdb
-pkgver=7.5.1
+pkgbase=gdb
+# gdb-common is a package that contains files common for all cross compiled versions
+# of gdb (for arm/avr/...)
+pkgname=(gdb gdb-common)
+pkgver=8.1
 pkgrel=1
-pkgdesc="The GNU Debugger"
-arch=('i686' 'x86_64')
-url="http://www.gnu.org/software/gdb/"
-license=('GPL3')
-depends=('ncurses' 'expat' 'python2')
-makedepends=('texinfo')
-backup=('etc/gdb/gdbinit')
-options=('!libtool')
-install=gdb.install
-source=(http://ftp.gnu.org/gnu/gdb/${pkgname}-${pkgver}.tar.bz2{,.sig})
-md5sums=('3f48f468b24447cf24820054ff6e85b1'
-         '31ab569c78a01d3f946c6fe0336175fe')
+pkgdesc='The GNU Debugger'
+arch=(x86_64)
+url='http://www.gnu.org/software/gdb/'
+license=(GPL3)
+makedepends=(texinfo python guile2.0 ncurses expat xz)
+source=(https://ftp.gnu.org/gnu/gdb/${pkgname}-${pkgver}.tar.xz{,.sig})
+sha1sums=('641861f7d3f22b6a23bc3e801f0ff29a78375490'
+          'SKIP')
+validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3') # Joel Brobecker
+
+prepare() {
+  cd gdb-$pkgver
+
+  # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
+  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
+}
 
 build() {
-  cd ${srcdir}/${pkgname}-${pkgver}
+  cd gdb-$pkgver
   
   ./configure --prefix=/usr --disable-nls \
     --with-system-readline \
-    --with-python=/usr/bin/python2 \
+    --with-python=/usr/bin/python3 \
+    --with-guile=guile-2.0 \
     --with-system-gdbinit=/etc/gdb/gdbinit
   make
 }
 
-package() {
-  cd ${srcdir}/${pkgname}-${pkgver}
-  make DESTDIR=${pkgdir} install
+package_gdb-common() {
+  depends=(python guile2.0)
+
+  cd gdb-$pkgver
+  make DESTDIR=$pkgdir install
+
+  # resolve conflicts with binutils
+  rm $pkgdir/usr/include/{ansidecl,bfd,bfdlink,dis-asm,plugin-api,symcat}.h
+  rm $pkgdir/usr/share/info/bfd.info
+  rm $pkgdir/usr/lib/{libbfd,libopcodes}.a
+
+  rm -r $pkgdir/usr/{bin,include,lib,share/info,share/man}
+}
+
+package_gdb() {
+  depends=(ncurses expat xz mpfr gdb-common=$pkgver)
+  backup=(etc/gdb/gdbinit)
+
+  cd gdb-$pkgver
+  make DESTDIR=$pkgdir install
 
   # install "custom" system gdbinit
   install -dm755 $pkgdir/etc/gdb
   touch $pkgdir/etc/gdb/gdbinit
 
   # resolve conflicts with binutils
-  rm ${pkgdir}/usr/include/{ansidecl,bfd,bfdlink,dis-asm,symcat}.h
-  rm ${pkgdir}/usr/lib/{libbfd,libiberty,libopcodes}.a
-  rm ${pkgdir}/usr/share/info/{bfd,configure,standards}.info
+  rm $pkgdir/usr/include/{ansidecl,bfd,bfdlink,dis-asm,plugin-api,symcat}.h
+  rm $pkgdir/usr/share/info/bfd.info
+  rm $pkgdir/usr/lib/{libbfd,libopcodes}.a
+
+  # comes from gdb-common
+  rm -r $pkgdir/usr/share/gdb/
 }
diff --git a/abs/core/gdb/gdb.install b/abs/core/gdb/gdb.install
deleted file mode 100644
index 986ec54..0000000
--- a/abs/core/gdb/gdb.install
+++ /dev/null
@@ -1,18 +0,0 @@
-infodir=usr/share/info
-filelist=(annotate.info gdb.info gdb.info-1 gdb.info-2 gdb.info-3 gdb.info-4 gdbint.info gdbint.info-1 gdbint.info-2 stabs.info)
-
-post_install() {
-  for file in ${filelist[@]}; do
-    install-info $infodir/$file.gz $infodir/dir 2> /dev/null
-  done
-}
-
-post_upgrade() {
-  post_install $1
-}
-
-pre_remove() {
-  for file in ${filelist[@]}; do
-    install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
-  done
-}
-- 
cgit v0.12

