aboutsummaryrefslogtreecommitdiff
path: root/devel/android-tools-adb/Makefile
blob: e5a2163485c3edb1eb52232ec8dbf666307b929c (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
97
98
99
100
101
102
103
104
105
106
# $FreeBSD$

PORTNAME=	android-tools-adb
DISTVERSIONPREFIX=	android-
DISTVERSION?=	8.0.0_r24
PORTREVISION?=	0
CATEGORIES=	devel comms

MAINTAINER=	jbeich@FreeBSD.org
COMMENT=	Android debug bridge command line tool

LICENSE=	APACHE20

USE_GITHUB=	yes
GH_ACCOUNT=	android
GH_PROJECT=	platform_system_core

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

CONFLICTS_INSTALL?=	${PORTNAME}-devel-*

USES=		compiler:c++14-lang pkgconfig ssl uidfix
BUILD_WRKSRC=	${WRKSRC}/adb
INSTALL_WRKSRC=	${BUILD_WRKSRC}
TEST_WRKSRC=	${BUILD_WRKSRC}
CPPFLAGS+=	-D_GLIBCXX_USE_C99 # XXX ports/193528
MAKEFILE?=	${.CURDIR}/files/Makefile
MAKE_ENV=	BINDIR="${PREFIX}/bin" EXTRADIR="${FILESDIR}" \
		FILESDIR="${DOCSDIR}" REVISION="${GH_REVISION}"
ALL_TARGET=	all
TEST_TARGET=	test

PLIST_FILES=	bin/adb
PORTDOCS=	*

OPTIONS_DEFINE+=MDNSRESPONDER BASH DOCS TEST TEST_PYTHON
OPTIONS_DEFAULT=MDNSRESPONDER
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/adb
BASH_VARS=		LICENSE+=MIT LICENSE_COMB=multi

DOCS_MAKE_ARGS_OFF=	FILES="" FILESDIR=""

MDNSRESPONDER_LIB_DEPENDS=	libdns_sd.so:net/mDNSResponder
MDNSRESPONDER_USES=		localbase:ldflags
MDNSRESPONDER_LDFLAGS=		-ldns_sd
MDNSRESPONDER_MAKE_ENV_OFF=	MDNSEXT=_unsupported

TEST_BUILD_DEPENDS+=	googlemock>=1.6.0:devel/googlemock \
			googletest>=1.6.0:devel/googletest
TEST_ALL_TARGET=	adb_test

TEST_PYTHON_DESC=	${TEST_DESC:S/tests/python &/}
TEST_PYTHON_GH_PROJECT=	platform_development:development
TEST_PYTHON_BUILD_DEPENDS=${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock
TEST_PYTHON_USES=	python:2.7,build

post-patch:
# XXX Hidden by poudriere/tinderbox, see lindev(4) for FreeBSD < 11.0
	@if [ ! -e /dev/full ]; then \
		${REINPLACE_CMD} -e '/TEST/s/[^ ]*ENOSPC/DISABLED_&/' \
			${WRKSRC}/adb/adb_io_test.cpp; \
	fi

pre-install-TEST-on: do-test

pre-install-TEST_PYTHON-on:
# XXX python tests may leave behind running adb server
	${SETENV} PATH=${BUILD_WRKSRC}:${PATH} \
		PYTHONPATH=${WRKSRC_development}/python-packages \
		${PYTHON_CMD} -m unittest discover -vs ${BUILD_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