summaryrefslogtreecommitdiff
path: root/devel/cross-gdb/Makefile
blob: 2891be9589da1f2a088b2efca5c7ebb743707d86 (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
# New ports collection makefile for:	cross-gdb
# Date created:		11 June 2007
# Whom:			Stanislav Sedov <stas@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	gdb
PORTVERSION=	6.7.1
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_SOURCEWARE}
MASTER_SITE_SUBDIR=	gdb/releases
PKGNAMEPREFIX=	${TGTARCH}-${TGTABI}-

PATCH_SITES=	ftp://ftp.rtems.com/pub/rtems/SOURCES/
PATCH_DIST_STRIP=	-p1

MAINTAINER=	stas@FreeBSD.org
COMMENT=	GNU gdb port for cross-target development

#
# Temporary hack to dial with dependencies during package builds for
# slave ports.
#
.if defined(PACKAGE_BUILDING)
BUILD_DEPENDS=	${OURTARGET}-as:${PORTSDIR}/devel/${OURTARGET}-binutils
.else
BUILD_DEPENDS=	${OURTARGET}-as:${PORTSDIR}/devel/cross-binutils
.endif

USE_BZIP2=	yes
USE_GMAKE=	yes
GNU_CONFIGURE=	yes
ALL_TARGET=	all info

DEPENDS_ARGS=	TGTARCH="${TGTARCH}" TGTABI="${TGTABI}"

CONFIGURE_TARGET=	--target=${OURTARGET}
CONFIGURE_ARGS+=	--disable-nls \
			--exec-prefix=${EPRFX}/

OURTARGET=	${TGTARCH}-${TGTABI}

MAN1=		${OURTARGET}-gdb.1 \
		${OURTARGET}-gdbtui.1

INFO=		${OURTARGET}-annotate \
		${OURTARGET}-gdb \
		${OURTARGET}-gdbint \
		${OURTARGET}-stabs

EPRFX=		${PREFIX}/libexec/${OURTARGET}-gdb

.if defined(WITH_RTEMS_PATCHES)
PATCHFILES+=	${PORTNAME}-${PORTVERSION}-rtems4.8-20071216.diff
.endif

.if !defined(TGTARCH) || !defined(TGTABI)
PKGNAMEPREFIX=	cross-
OURTARGET=	cross	# to generate correct dependency list
IGNORE=		you should define TGTARCH and TGTABI to build port
.endif

#
# Macro to fix up info referencies
#
FIXREFS=	${SH} -c '${REINPLACE_CMD} -E \
		-e "s,$$0\.(texi|info),${OURTARGET}-$$0.\1,g" \
		-e "s,(@file)\{$$0\},\1\{${OURTARGET}-$$0\},g" $$*' --

post-patch:
#
# Patch and rename info files
#
.for FILE in annotate gdb gdbint stabs
	@${FIXREFS} ${FILE} ${WRKSRC}/gdb/doc/${FILE}.texinfo \
		${WRKSRC}/gdb/doc/Makefile.in
	@${MV} ${WRKSRC}/gdb/doc/${FILE}.texinfo \
		${WRKSRC}/gdb/doc/${OURTARGET}-${FILE}.texinfo
.endfor

# Don't install run.1 manpage, we'll install it by hand
	@${REINPLACE_CMD} -E -e 's,^(install:)[[:space:]]+install-man,\1,' \
		${WRKSRC}/sim/common/Makefile.in

#
# Don't install certain infofiles
#
	@${REINPLACE_CMD} -E -e 's,^(install:).*,\1,' \
		${WRKSRC}/etc/Makefile.in \
		${WRKSRC}/bfd/doc/Makefile.in

post-install:
#
# Install handy symlinks
#
	@${LN} -sf ${EPRFX}/bin/${OURTARGET}-gdb ${PREFIX}/bin/${OURTARGET}-gdb
	@${ECHO} "@exec ${LN} -sf ${EPRFX}/bin/${OURTARGET}-gdb " \
		"${PREFIX}/bin/${OURTARGET}-gdb" >> ${TMPPLIST}
	@${ECHO} "@unexec ${RM} -f ${PREFIX}/bin/${OURTARGET}-gdb" \
		>> ${TMPPLIST}

#
# Install link for emulator if exists
#
	@if [ -e "${EPRFX}/bin/${OURTARGET}-run" ]; then \
		${LN} -sf ${EPRFX}/bin/${OURTARGET}-run \
			${PREFIX}/bin/${OURTARGET}-run && \
		${ECHO} "@exec ${LN} -sf ${EPRFX}/bin/${OURTARGET}-run " \
			"${PREFIX}/bin/${OURTARGET}-run" >> ${TMPPLIST} && \
		${ECHO} "@unexec ${RM} -f ${PREFIX}/bin/${OURTARGET}-run" \
			>> ${TMPPLIST}; \
	fi

#
# Generate packing list
#
	@${FIND} ${EPRFX}/ ! -type d | ${SED} 's,^${PREFIX}/,,' >> ${TMPPLIST}
	@${FIND} -ds ${EPRFX}/ -type d | \
		${SED} -E -e 's,(.*),@unexec rmdir \1 2>/dev/null || true,' >> \
		${TMPPLIST}

.include <bsd.port.mk>