aboutsummaryrefslogtreecommitdiffstats
path: root/devel/binutils/Makefile
blob: fb4af67d85431a545fcd9e602e699af45bbcfbfb (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
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

PORTNAME=   binutils
PORTVERSION=    2.25.1
PORTEPOCH=  1
PORTREVISION?=  2
CATEGORIES= devel
MASTER_SITES=   SOURCEWARE/binutils/releases

MAINTAINER?=    bapt@FreeBSD.org
COMMENT?=   GNU binary tools

LICENSE=    GPLv3 LGPL3
LICENSE_COMB=   multi

BUILD_DEPENDS=  ${LOCALBASE}/lib/libgmp.so:math/gmp \
        ${LOCALBASE}/lib/libmpfr.so:math/mpfr

CONFLICTS=  libbfd-[0-9]*

OPTIONS_DEFINE= NLS

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

USES=       bison gmake libtool tar:bzip2 compiler:env
GNU_CONFIGURE=  yes

.if defined(PKGNAMEPREFIX)
BUTARGET?=  ${PKGNAMEPREFIX}${OPSYS:tl}
OPTIONS_EXCLUDE=    NLS
INFO_PATH=  ${PKGNAMEPREFIX:S/-$//}/info
CONFIGURE_ARGS+=    --disable-shared \
            --target=${BUTARGET}
.else
CFLAGS+=    -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
CONFIGURE_ARGS+=    --with-system-zlib \
            --with-gmp=${LOCALBASE} \
            --with-mpfr=${LOCALBASE}
INFO=       as \
        binutils \
        gprof \
        bfd \
        ld
.endif

CONFIGURE_ARGS+=    --disable-werror \
            --with-sysroot=/

MAKE_ENV+=  ac_cv_func_sbrk=0

OPTIONS_SUB=    yes
NLS_USES=   gettext
NLS_CONFIGURE_ENABLE=   nls

.include <bsd.port.pre.mk>

# Actual earliest version may differ slightly
.if ${ARCH} != ia64 && ${ARCH} != mips && ${ARCH} != mips64 && !defined(PKGNAMEPREFIX) && (${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 34 || ${COMPILER_TYPE} == gcc)
CONFIGURE_ARGS+=    --enable-gold --enable-plugins
PLIST_SUB+= GOLD=""
.else
PLIST_SUB+= GOLD="@comment "
.endif

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

post-install:
.if !defined(PKGNAMEPREFIX)
    ${INSTALL_DATA} ${WRKSRC}/include/plugin-api.h ${STAGEDIR}${PREFIX}/include/
    @${FIND} -ds ${STAGEDIR}${PREFIX}/${CONFIGURE_TARGET} ! -type d | \
        ${SED} -e 's,^${STAGEDIR}${PREFIX}/,,' >> ${TMPPLIST}
    ${RM} ${STAGEDIR}${PREFIX}/include/ansidecl.h
    ${REINPLACE_CMD} '/#include "ansidecl.h"/d' ${STAGEDIR}${PREFIX}/include/bfd.h
.else
.if ${PKGNAMEPREFIX:S/-$//} != ${BUTARGET}
    ${RM} -rf ${STAGEDIR}${PREFIX}/${PKGNAMEPREFIX:S/-$//}
.endif
    ${LN} -fs ../../bin/${BUTARGET}-size ${STAGEDIR}${PREFIX}/${BUTARGET}/bin/size
.endif
.for tool in ${BUREMOVE}
    @${RM} -f ${STAGEDIR}${PREFIX}/bin/${BUTARGET}-${tool} \
        ${STAGEDIR}${PREFIX}/man/man1/${BUTARGET}-${tool}.1 \
        ${STAGEDIR}${PREFIX}/${BUTARGET}/bin/${tool}
.endfor
.if defined(BUREMOVE) && ${BUREMOVE:Mld}
    @${RM} -rf ${STAGEDIR}${PREFIX}/${BUTARGET}/lib/ldscripts
.endif

.include <bsd.port.post.mk>