aboutsummaryrefslogtreecommitdiffstats
path: root/devel/android-tools-fastboot/Makefile
blob: de2ff840700e59b1c1d40d4aef0719dc83222bdd (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
# $FreeBSD$

PORTNAME=   android-tools-fastboot
DISTVERSIONPREFIX=  android-
DISTVERSION?=   8.0.0_r4
PORTREVISION?=  0
CATEGORIES= devel sysutils
MASTER_SITES=   https://anonscm.debian.org/cgit/android-tools/android-tools.git/plain/debian/:manpage
DISTFILES=  fastboot.1?id=706e754:manpage
EXTRACT_ONLY=   ${DISTFILES:N*\:manpage:C/:.*//}

MAINTAINER= jbeich@FreeBSD.org
COMMENT=    Android Fastboot protocol CLI tool

LICENSE=    APACHE20 BSD2CLAUSE PD
LICENSE_COMB=   multi
LICENSE_FILE_PD=    ${WRKSRC}/libselinux/NOTICE

LIB_DEPENDS=    libpcre.so:devel/pcre

USE_GITHUB= yes
GH_ACCOUNT= android jbeich:extras,libselinux
GH_PROJECT= platform_system_core platform_system_extras:extras \
        platform_external_libselinux:libselinux
GH_TAGNAME?=    android-7.1.2_r17:libselinux
GH_SUBDIR=  libselinux:libselinux

# Emulate GH_COMMIT without causing desync
.ifdef DISTVERSIONSUFFIX
GH_REVISION=    ${DISTVERSIONSUFFIX:S/-g//} # snapshot
.else
GH_REVISION=    f6a78079a81a # generated by: make update-revision
.endif

CONFLICTS_INSTALL?= ${PORTNAME}-devel-*

USES=       compiler:c++11-lib pkgconfig uidfix
BUILD_WRKSRC=   ${WRKSRC}/fastboot
INSTALL_WRKSRC= ${BUILD_WRKSRC}
MAKEFILE?=  ${.CURDIR}/files/Makefile
MAKE_ENV=   BINDIR="${PREFIX}/bin" EXTRADIR="${FILESDIR}" \
        FILESDIR="${DOCSDIR}" REVISION="${GH_REVISION}" \
        MANDIR="${PREFIX}/man/man" \
        LIBPCRE="${LOCALBASE}/lib/libpcre.a"
PLIST_FILES=    bin/fastboot \
        man/man1/fastboot.1.gz
PORTDOCS=   *
SUB_FILES=  pkg-message

OPTIONS_DEFINE= BASH DOCS
OPTIONS_SUB=    yes

.if make(makesum) # for optional distfiles
.MAKEFLAGS: WITH="${OPTIONS_DEFINE}"
.endif

BASH_GH_ACCOUNT=    mbrubeck:bashcomp
BASH_GH_PROJECT=    android-completion:bashcomp
BASH_GH_TAGNAME=    c1b0656:bashcomp
BASH_PLIST_FILES=   etc/bash_completion.d/fastboot
BASH_VARS=      LICENSE+=MIT

DOCS_MAKE_ARGS_OFF= FILES="" FILESDIR=""

post-extract:
    @${CP} ${_DISTDIR}/${DISTFILES:M*\:manpage:C/:.*//} \
        ${BUILD_WRKSRC}/${DISTFILES:M*\:manpage:C/\?.*//}
# Adjust paths relative to core
    @(cd ${WRKSRC_extras} && ${COPYTREE_SHARE} . ${WRKSRC})

post-install-BASH-on:
    ${MKDIR} ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES:H}
    ${INSTALL_DATA} ${WRKSRC_bashcomp}/android \
        ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES}

update-revision:
# https://developer.github.com/v3/repos/commits/#get-a-single-commit
# Pretend to be curl(1) for pretty-printed JSON to help parse with sed(1)
    @${REINPLACE_CMD} -i '' -e "/^GH_REVISION.*$@/s/=.*/=   $$(\
        ${SETENV} HTTP_USER_AGENT=curl ${FETCH_CMD} -qo- \
            https://api.github.com/repos/${GH_ACCOUNT}/${GH_PROJECT}/commits/${GH_TAGNAME} | \
            ${SED} -n '/sha/ { s/.*\"\([0-9a-f]\{12\}\).*/\1/p; q; }' \
        ) # generated by: make $@/" \
        ${.CURDIR}/Makefile

.include <bsd.port.mk>

# XXX Work around !target(makesum)
.ifndef DISTVERSIONSUFFIX
makesum:    update-revision
.endif