aboutsummaryrefslogtreecommitdiffstats
path: root/devel/rebar3/Makefile
blob: b57e02ea9fc3fc9a22b04a958493b56280bdf79a (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
# $FreeBSD$

PORTNAME=   rebar3
PORTVERSION=    3.4.2
PORTEPOCH=  1
CATEGORIES= devel
MASTER_SITES+=  LOCAL/olgeni:deps \
        http://olgeni.olgeni.com/~olgeni/distfiles/:deps \
        https://s3.amazonaws.com/s3.hex.pm/tarballs/:hex
DISTFILES=  rebar3-cache-12${EXTRACT_SUFX}:deps
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX} \
        rebar3-cache-12${EXTRACT_SUFX}

MAINTAINER= olgeni@FreeBSD.org
COMMENT=    Build tool for Erlang

LICENSE=    APACHE20

BUILD_DEPENDS=  ${LOCALBASE}/bin/erl:lang/erlang \
        ${LOCALBASE}/bin/git:devel/git
RUN_DEPENDS=    ${LOCALBASE}/bin/erl:lang/erlang

OPTIONS_DEFINE= BASH ZSH

USE_GITHUB= yes
GH_ACCOUNT= rebar

PLIST_FILES=    bin/${PORTNAME}
PORTEXAMPLES=   rebar.config.sample

BASH_PLIST_FILES=   share/bash-completion/completions/rebar3
ZSH_PLIST_FILES=    share/zsh/site-functions/_rebar3

# from rebar.config
REBAR_DEPS= bbmustache-1.3.0 \
        certifi-0.4.0 \
        cf-0.2.2 \
        cth_readable-1.2.6 \
        erlware_commons-1.0.0 \
        eunit_formatters-0.3.1 \
        getopt-0.8.2 \
        providers-1.6.0 \
        relx-3.23.1 \
        ssl_verify_fun-1.1.1

.for _dep in ${REBAR_DEPS} ${REBAR_PLUGINS}
DISTFILES+= ${_dep}.tar:hex
.endfor

.include <bsd.port.options.mk>

post-extract:
    @${REINPLACE_CMD} -e 's/{vsn, "git"}/{vsn, "${GH_TAGNAME}"}/' ${WRKSRC}/src/rebar.app.src
.for _dep in ${REBAR_DEPS}
    ${MKDIR} ${WRKSRC}/_build/default/lib/${_dep:C/-.*//}
    ${TAR} xOf ${DISTDIR}/${_dep}.tar contents.tar.gz |\
        ${TAR} xfz - -C ${WRKSRC}/_build/default/lib/${_dep:C/-.*//}
.endfor
.for _dep in ${REBAR_PLUGINS}
    ${MKDIR} ${WRKSRC}/_build/default/plugins/${_dep:C/-.*//}
    ${TAR} xOf ${DISTDIR}/${_dep}.tar contents.tar.gz |\
        ${TAR} xfz - -C ${WRKSRC}/_build/default/plugins/${_dep:C/-.*//}
.endfor

    @${MKDIR} ${WRKSRC}/_build/bootstrap/lib
    @${MKDIR} ${WRKSRC}/_build/bootstrap/plugins
.for _dep in ${REBAR_DEPS}
    ${LN} -sf ${WRKSRC}/_build/default/lib/${_dep:C/-.*//} ${WRKSRC}/_build/bootstrap/lib/
.endfor
.for _dep in ${REBAR_PLUGINS}
    ${LN} -sf ${WRKSRC}/_build/default/plugins/${_dep:C/-.*//} ${WRKSRC}/_build/bootstrap/plugins/
.endfor

do-build:
    @${RM} ${WRKSRC}/rebar.lock
    @cd ${WRKSRC} && HOME=${WRKDIR} ./bootstrap

do-install:
    ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
.if ${PORT_OPTIONS:MBASH}
    @${MKDIR} ${STAGEDIR}${PREFIX}/share/bash-completion/completions
    ${INSTALL_DATA} ${WRKSRC}/priv/shell-completion/bash/rebar3 \
        ${STAGEDIR}${PREFIX}/share/bash-completion/completions/rebar3
.endif
.if ${PORT_OPTIONS:MZSH}
    @${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions/
    ${INSTALL_DATA} ${WRKSRC}/priv/shell-completion/zsh/_rebar3 \
        ${STAGEDIR}${PREFIX}/share/zsh/site-functions/
.endif
    @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    ${INSTALL_DATA} ${WRKSRC}/rebar.config.sample ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.mk>