summaryrefslogtreecommitdiff
path: root/base/binutils/Makefile
blob: a8abb91af840de95cff2b9be9a737055f5f0ab68 (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

PORTNAME=	binutils
PORTVERSION=	2.33.1
PORTEPOCH=	0
PORTREVISION=	1
CATEGORIES=	base
MASTER_SITES=	SOURCEWARE/binutils/releases
PKGNAMEPREFIX=	${OPSYS:tl}-
VALID_CATEGORIES=	base

COMMENT=	GNU binary tools for base

LICENSE=	GPLv3 LGPL3
LICENSE_COMB=	multi

LICENSE_FILE_GPLv3=	${WRKSRC}/COPYING3
LICENSE_FILE_LGPL3=	${WRKSRC}/COPYING3.LIB

TARGETARCH=	${ARCH:S/amd64/x86_64/}
BUTARGET=	${TARGETARCH}-unknown-${OPSYS:tl}${OSREL}

USES=		bison:alias cpe gmake libtool tar:bzip2 compiler:env
CPE_VENDOR=	gnu
GNU_CONFIGURE=	yes
INFO_PATH=	${PKGNAMEPREFIX:S/-$//}/share/info

BUTARGET?=	${PKGNAMEPREFIX}unknown-${OPSYS:tl}${OSREL}
PLIST_SUB=	BUTARGET=${BUTARGET}

TEST_TARGET=	check

PATCHDIR=	${.CURDIR}/../../devel/binutils/files

CONFIGURE_ARGS+=	--disable-host-shared \
			--disable-shared \
			--disable-nls \
			--with-system-zlib \
			--with-sysroot="/" \
			--enable-relro=no \
			--enable-x86-relax-relocations=no \
			--target=${BUTARGET}
PREFIX=	/usr
MAKE_ENV+=	ac_cv_func_sbrk=0
MAKE_ARGS+=	LIBDL=""

BUREMOVE=	addr2line \
		ar \
		c++filt \
		dlltool \
		elfedit \
		gprof \
		objcopy \
		nlmconv \
		nm \
		ranlib \
		readelf \
		size \
		strings \
		strip \
		windmc \
		windres

OPTIONS_DEFINE=	RELRO STATIC 
RELRO_DESC=	enable -z relro in ELF linker by default

RELRO_CONFIGURE_ON=	--enable-relro
RELRO_CONFIGURE_OFF=	--enable-relro=no

STATIC_LDFLAGS+=	-all-static

.include <bsd.port.pre.mk>

.if ${ARCH} == "amd64" || ${ARCH} == "i386"
PLIST_SUB+=	I386=""
.else
PLIST_SUB+=	I386="@comment "
.endif
.if ${ARCH} == "amd64"
PLIST_SUB+=	AMD64=""
.else
PLIST_SUB+=	AMD64="@comment "
.endif
.if ${ARCH:Mmips*}
PLIST_SUB+=	MIPS=""
.else
PLIST_SUB+=	MIPS="@comment "
.endif
.if ${ARCH:Mpowerpc*}
PLIST_SUB+=	POWERPC=""
.else
PLIST_SUB+=	POWERPC="@comment "
.endif
.if ${ARCH:Msparc*}
PLIST_SUB+=	SPARC=""
.else
PLIST_SUB+=	SPARC="@comment "
.endif

.if ${HOSTARCH} == "amd64"
CONFIGURE_TARGET=	x86_64-unknown-freebsd${OSREL}
.elif ${HOSTARCH} == "powerpcspe"
CONFIGURE_TARGET=	powerpc-unknown-freebsd${OSREL}
.else
CONFIGURE_TARGET=	${HOSTARCH}-unknown-freebsd${OSREL}
.endif

post-patch:
	${REINPLACE_CMD} -e "s/-ldl//g" ${WRKSRC}/gold/testsuite/Makefile.in

post-install:
	${RM} -r ${STAGEDIR}${PREFIX}/${PKGNAMEPREFIX:S/-$//}
	${RM} ${STAGEDIR}${PREFIX}/${BUTARGET}/lib/ldscripts/i386bsd.*
	@if [ -d ${STAGEDIR}${PREFIX}/${INFO_PATH:H} ] ; then rm -rf ${STAGEDIR}${PREFIX}/${INFO_PATH:H}; fi
	@${RM} -r ${STAGEDIR}${PREFIX}/include
	@${RM} -r ${STAGEDIR}${PREFIX}/lib
.for tool in ${BUREMOVE}
	@${RM} ${STAGEDIR}${PREFIX}/bin/${tool} \
	    ${STAGEDIR}${MANPREFIX}/man/man1/${tool}.1 \
	    ${STAGEDIR}${PREFIX}/${BUTARGET}/bin/${tool}
.endfor
	@${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains
	${INSTALL_DATA} ${.CURDIR}/files/freebsd-binutils.mk ${STAGEDIR}${PREFIX}/share/toolchains/

.include <bsd.port.post.mk>