aboutsummaryrefslogtreecommitdiffstats
path: root/devel/gdb/Makefile
blob: b25ee91a123da62c55c99b238199e13580cf85dc (plain) (blame)
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
# Created by: Steven Kreuzer <skreuzer@FreeBSD.org>
# $FreeBSD$

PORTNAME=   gdb
PORTVERSION=    8.0
PORTREVISION=   2
CATEGORIES= devel
MASTER_SITES=   GNU

MAINTAINER= luca.pizzamiglio@gmail.com
COMMENT=    GNU GDB of newer version than comes with the system

LICENSE=    GPLv3

TEST_DEPENDS=   runtest:misc/dejagnu

TEST_TARGET=    check
# XXX: This should be compiler:c++11-lib as GDB doesn't really require
# C++14.  However, clang in 10.3 crashes while building this port.
# Requiring C++14 forces 10.3 to use an external version of clang while
# still using the base system clang on 11.0 and later.
USES=       compiler:c++14-lang cpe iconv gmake libtool tar:xz
USE_CSTD=   gnu89
CPE_VENDOR= gnu
GNU_CONFIGURE=  yes
CONFIGURE_ENV=  CONFIGURED_M4=m4 CONFIGURED_BISON=byacc
CONFIGURE_ARGS= --program-suffix=${PORTVERSION:S/.//g} \
        --enable-targets=all --enable-64-bit-bfd \
        --with-gdb-datadir=${PREFIX}/share/gdb${PORTVERSION:S/.//g} \
        --with-separate-debug-dir=/usr/lib/debug \
        ${ICONV_CONFIGURE_ARG} \
        --with-expat=yes --with-libexpat-prefix=${LOCALBASE} \
        --without-libunwind-ia64
CFLAGS:=    ${CFLAGS:C/ +$//}   # blanks at EOL creep in sometimes
CFLAGS+=    -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable
EXCLUDE=    dejagnu expect sim texinfo intl
EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /}
EXTRA_PATCHES=  ${FILESDIR}/commit-45eba0ab7d \
        ${FILESDIR}/commit-3c3ae77e68 \
        ${FILESDIR}/commit-b5430a3ced \
        ${FILESDIR}/commit-762c974a09 \
        ${FILESDIR}/commit-929edea98d \
        ${FILESDIR}/commit-6e5eab33ab \
        ${FILESDIR}/commit-382b69bbb7 \
        ${FILESDIR}/commit-2af9fc4432 \
        ${FILESDIR}/commit-0b9305edf1 \
        ${FILESDIR}/commit-e6f3b9c319 \
        ${FILESDIR}/commit-4b654465bf \
        ${FILESDIR}/commit-b30ff123fb \
        ${FILESDIR}/commit-48aeef91c2 \
        ${FILESDIR}/commit-0aa37b654c
LIB_DEPENDS+=   libexpat.so:textproc/expat2

VER=        ${PORTVERSION:S/.//g}
PLIST_SUB=  VER=${VER}

# untested elsewhere, might work
ONLY_FOR_ARCHS= aarch64 amd64 armv6 i386 mips powerpc powerpc64 

OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB PYTHON TUI

OPTIONS_DEFAULT=    GDB_LINK KGDB PYTHON TUI PORT_READLINE

OPTIONS_SINGLE= READLINE
OPTIONS_SINGLE_READLINE=    BUNDLED_READLINE PORT_READLINE

GDB_LINK_DESC=      Create ${PREFIX}/bin/gdb symlink
KGDB_DESC=      Kernel Debugging Support
BUNDLED_READLINE_DESC=  from gdb distfile
PORT_READLINE_DESC= from devel/readline port
TUI_DESC=       Text User Interface enabled

OPTIONS_SUB=    yes

BUNDLED_READLINE_CONFIGURE_OFF= --with-system-readline
DEBUG_CFLAGS=       -g
GUILE_CONFIGURE_WITH=   guile
GUILE_USES=     pkgconfig
GUILE_LIB_DEPENDS=  libguile-2.0.so:lang/guile2
PORT_READLINE_USES= readline:port
PYTHON_CONFIGURE_ON=    --with-python=${PYTHON_CMD}
PYTHON_CONFIGURE_OFF=   --without-python
PYTHON_USES=        python
TUI_CONFIGURE_ENABLE=   tui

.include <bsd.port.pre.mk>

.if ! ${PORT_OPTIONS:MBUNDLED_READLINE}
EXCLUDE+=   readline
.endif

.if ${ARCH} == "amd64"
CONFIGURE_TARGET=   x86_64-portbld-freebsd${OSREL}
.endif

.if ${COMPILER_TYPE} == "clang"
CFLAGS+=    -Wno-extended-offsetof
.endif

post-patch:
    @${REINPLACE_CMD} -e 's|$$| [GDB v${PORTVERSION} for FreeBSD]|' \
        ${WRKSRC}/gdb/version.in

post-patch-KGDB-on:
    @${CP} -r ${FILESDIR}/kgdb/*.[ch] ${WRKSRC}/gdb/
    @${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} < ${FILESDIR}/extrapatch-kgdb

do-install:
    ${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \
        ${STAGEDIR}${PREFIX}/bin/gdb${VER}
    ${INSTALL_MAN} ${WRKSRC}/gdb/doc/gdb.1 \
        ${STAGEDIR}${MAN1PREFIX}/man/man1/gdb${VER}.1
    (cd ${WRKSRC}/gdb/data-directory ; \
        ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls )

do-install-KGDB-on:
    ${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \
        ${STAGEDIR}${PREFIX}/bin/kgdb${VER}
    ${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \
        ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1

do-install-TUI-on:
    ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER}

do-install-GDB_LINK-on:
    ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb
.if ${PORT_OPTIONS:MKGDB}
    ${LN} -sf kgdb${VER} ${STAGEDIR}${PREFIX}/bin/kgdb
.endif

do-install-PYTHON-on:
    (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python )
    (cd ${WRKSRC}/gdb/data-directory ; \
        ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python )
. for f in gdb gdb/command gdb/function gdb/printer
    @(cd ${STAGEDIR}${PREFIX}/share/gdb${VER}/python/${f} ; ${CHMOD} 644 *.py* )
. endfor

do-install-GUILE-on:
    (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile )
    (cd ${WRKSRC}/gdb/data-directory ; \
        ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile )

.include <bsd.port.post.mk>