summaryrefslogtreecommitdiff
path: root/cross/cross-binutils/Makefile
blob: 9b2a27afce732ed6453c18eba6684f74dea775cb (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
# $NetBSD: Makefile,v 1.3 2016/07/09 06:37:58 wiz Exp $
#
# GNU binutils configured to hold `as many targets as the cross system is
# capable of using'.  Configures and builds everything except gas, which
# gets built at cross-pkg build time (it's target specific).

DISTNAME=		binutils-2.17
PKGREVISION=		4
PKGNAME=		cross-binutils-2.17.0.0
CATEGORIES=		cross lang
MASTER_SITES=		${MASTER_SITE_GNU:=binutils/}

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		http://www.gnu.org/
COMMENT=		Unified GNU binutils for cross build environments
LICENSE=		gnu-gpl-v2 AND gnu-lgpl-v2

BUILDLINK_TRANSFORM+=	rm:-Werror

USE_TOOLS+=		gm4 pod2man yacc
USE_LIBTOOL=		yes

GNU_CONFIGURE=		yes
GNU_CONFIGURE_PREFIX=	${PREFIX}/cross
CONFIGURE_ARGS+=	--with-windres
CONFIGURE_ARGS+=	--enable-64-bit-bfd
CONFIGURE_ARGS+=	--enable-targets=all

# Ensure that --host is not included as default
CONFIGURE_ARGS+=	--target=i386-linux

MAKE_ARGS+=		CFLAGS="${CFLAGS}"
BUILD_TARGET=		all-binutils all-ld

PLIST_SUBST+=		LOCALBASE=${LOCALBASE:Q}

BINDIR=			${PREFIX}/cross/libexec/binutils

# Prevent the need to run texi2pod.pl and pod2man hence
# the need for perl as build dependency.
post-patch:
.for _file_ in ld/ldver.texi ld/ld.1 gas/doc/gasver.texi gas/doc/as.1
	if [ -f ${WRKSRC}/${_file_} ]; then				\
		${TOUCH} ${WRKSRC}/${_file_};				\
	fi
.endfor
	${RM} -rf ${WRKSRC}/etc ${WRKSRC}/gas

INSTALLATION_DIRS=	bin cross/lib/ldscripts cross/include cross/libexec/binutils
do-install:
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/addr2line ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/ar ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/coffdump ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/cxxfilt ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/nlmconv ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/nm-new ${DESTDIR}${BINDIR}/nm
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/objcopy ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/objdump ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/ranlib ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/readelf ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/size ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/srconv ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/strings ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/strip-new ${DESTDIR}${BINDIR}/strip
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/sysdump ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/sysinfo ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/windres ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/ld/ld-new ${DESTDIR}${BINDIR}/ld
	libtool --mode=install ${INSTALL_PROGRAM} ${WRKSRC}/binutils/nlmconv ${DESTDIR}${BINDIR}
	libtool --mode=install ${INSTALL_DATA} ${WRKSRC}/bfd/libbfd.la ${DESTDIR}${PREFIX}/cross/lib
	libtool --mode=install ${INSTALL_DATA} ${WRKSRC}/intl/libintl.a ${DESTDIR}${PREFIX}/cross/lib
	libtool --mode=install ${INSTALL_DATA} ${WRKSRC}/opcodes/libopcodes.la ${DESTDIR}${PREFIX}/cross/lib
	libtool --mode=install ${INSTALL_DATA} ${WRKSRC}/libiberty/libiberty.a ${DESTDIR}${PREFIX}/cross/lib
	${INSTALL_DATA} ${WRKSRC}/include/ansidecl.h ${DESTDIR}${PREFIX}/cross/include
	${INSTALL_DATA} ${WRKSRC}/include/symcat.h ${DESTDIR}${PREFIX}/cross/include
	${INSTALL_DATA} ${WRKSRC}/bfd/bfd.h ${DESTDIR}${PREFIX}/cross/include
	for f in ${WRKSRC}/ld/ldscripts/*; do ${INSTALL_DATA} $${f} ${DESTDIR}${PREFIX}/cross/lib/ldscripts; done
	${INSTALL_SCRIPT} ${WRKSRC}/cross-env ${DESTDIR}${BINDIR}
	ln -s ${PREFIX}/cross/libexec/binutils/cross-env ${DESTDIR}${PREFIX}/bin/cross-env

post-build:
	${SED} -e 's|@@PREFIX@@|${PREFIX}/cross|' < ${FILESDIR}/cross-env > \
		${WRKSRC}/cross-env

.include "../../mk/bsd.pkg.mk"