summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6f63862bd8176d1a022df5267a9e3f674931a081 (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
149
150
151
152
# Maintainer: dreieck
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>

pkgbase='gdb-debug-git'
pkgname=('gdb-debug-git' 'gdb-debug-common-git')
pkgver=16.0.50.20241117_git.r120242.c0e7f910641
pkgrel=1
pkgdesc="The GNU Debugger from git. Compiled with debug information."
arch=(
  'i686'
  'x86_64'
)
url="http://www.gnu.org/software/gdb/"
license=('GPL3')
makedepends=(
  'git'
  'source-highlight'
)
options=(
  'debug'
  '!libtool'
  '!strip'
)
source=('gdb::git+https://sourceware.org/git/binutils-gdb.git')
sha256sums=('SKIP')

# options+=('ccache')

pkgver() {
  cd "$srcdir/gdb"

  # _ver="$(git describe --tags | sed -E -e 's|^gdb-||' -e 's|-branchpoint||' -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  # _ver="$(sed -E -e "s|DATE|$(git log -1 --date=format:'%Y%m%d' --format='%ad')|" gdb/version.in | tr '-' '_')"
  _ver="$(sed -E -e "s|DATE|$(date +%Y%m%d)|" gdb/version.in | tr '-' '_')"
  _rev="$(git rev-list --count HEAD)"
  # _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Could not determine version."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_hash}"
  fi
}

build() {
  cd "$srcdir/gdb"

  [[ -d build ]] || mkdir -p build
  cd build
  _DEBUG_FLAGS='-Og -fno-lto -gdwarf-5 -ggdb -gno-strict-dwarf -g3 -gpubnames -grecord-gcc-switches -fno-eliminate-unused-debug-symbols -fvar-tracking -fvar-tracking-assignments -fdebug-types-section -fno-stack-protector -fno-omit-frame-pointer -D_FORTIFY_SOURCE=0 -DDEBUG'
  CFLAGS="  ${_DEBUG_FLAGS} -fcommon"
  CXXFLAGS="${_DEBUG_FLAGS} -fpermissive"
  export CFLAGS
  export CXXFLAGS

  ../configure \
    --prefix=/usr \
    --disable-nls \
    --disable-gold \
    --disable-ld \
    --disable-gprofng \
    --enable-source-highlight \
    --enable-tui \
    --with-system-readline \
    --with-python=/usr/bin/python \
    --with-guile=guile-3.0 \
    --with-system-gdbinit=/etc/gdb/gdbinit \
    --enable-default-compressed-debug-sections-algorithm=zstd \
    --enable-year2038 \
    --enable-libada \
    --enable-libssp \
    --disable-lto \
    --disable-gdbtk \
    --enable-plugins \
    --enable-threading \
    --enable-libbacktrace \
    --enable-libctf \
    --disable-werror \
    --with-debuginfod \
    --without-libunwind-ia64 \
    --with-system-zlib \
    --with-zstd \
    --with-expat \
    --with-intel-pt \
    --with-xxhash \
    --with-lzma \
    --without-tcl \
    --without-tk \
    --with-x \
    --with-babeltrace

  make
}

package_gdb-debug-git() {
  depends=(
    'babeltrace'
    'expat'
    "gdb-common=${pkgver}"
    'guile'
    'libbacktrace'
    'libelf'
    'libipt'
    'mpfr'
    'ncurses'
    'python'
    'source-highlight'
    'xxhash'
    'xxhash'
    'xz'
    'zlib'
  )
  optdepends=(
    'debuginfod: Retrieve debugging information at runtime from specified debuginfod servers.'
    'insight: For a GUI to GDB.'
  )
  provides=(
    "gdb=${pkgver}"
    "gdb-debug=${pkgver}"
    "gdb-git=${pkgver}"
  )
  conflicts=('gdb')
  backup=(etc/gdb/gdbinit)

  cd "$srcdir/gdb/build"

  # install only gdb, otherwise it would install files already provided by binutils
  make DESTDIR="$pkgdir/" install-gdb

  # install "custom" system gdbinit
  install -dm755 "$pkgdir"/etc/gdb
  touch "$pkgdir"/etc/gdb/gdbinit

  # comes from gdb-common
  rm -r "$pkgdir/usr/share/gdb/"
}

package_gdb-debug-common-git() {
  provides=(
    "gdb-common=${pkgver}"
    "gdb-common-git=${pkgver}"
    "gdb-debug-common=${pkgver}"
  )
  conflicts=('gdb-common')
  depends=('python-pygments' 'guile')
  cd "$srcdir/gdb/build"
  make -C gdb/data-directory DESTDIR="$pkgdir" install
}