summaryrefslogtreecommitdiff
path: root/comms/java-simple-serial-connector/Makefile
blob: 9199c17736728846a4082ac556aa45aa089e0377 (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

PORTNAME=	java-simple-serial-connector
PORTVERSION=	2.8.0
PORTREVISION=	1
DISTVERSIONPREFIX=	v
CATEGORIES=	comms java

MAINTAINER=	kevans@FreeBSD.org
COMMENT=	Library for working with serial ports from Java

LICENSE=	LGPL3

USE_GITHUB=	yes
GH_ACCOUNT=	scream3r

MAJOR_MINOR=	${PORTVERSION:C/(.*)\.[0-9]*/\\1/}
USE_JAVA=	yes
USE_ANT=	yes
ALL_TARGET=	dist
CXXFLAGS+=	-I${JAVA_HOME}/include -I${JAVA_HOME}/include/freebsd
WRKSRC_LIBS=	${WRKSRC}/src/java/libs

PLIST_FILES=	${JAVA_HOME}/jre/lib/ext/jssc-${PORTVERSION}.jar

.include <bsd.port.pre.mk>

.if ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
JSSC_ARCH=		arm
.else
JSSC_ARCH=		${ARCH}
.endif

post-extract:
	@${CP} ${FILESDIR}/build.xml.in ${WRKSRC}/build.xml
	@${REINPLACE_CMD} -e 's|%%PORTVERSION%%|${PORTVERSION}|' ${WRKSRC}/build.xml

pre-build:
	${RM} -r ${WRKSRC_LIBS}/*
	${MKDIR} ${WRKSRC_LIBS}/freebsd
	(cd ${WRKSRC}/src/cpp/_nix_based && ${CXX} ${CXXFLAGS} ${CPPFLAGS} -shared -fPIC -o ${WRKSRC_LIBS}/freebsd/libjSSC-${MAJOR_MINOR}_${JSSC_ARCH}.so jssc.cpp)
	${STRIP_CMD} ${WRKSRC_LIBS}/freebsd/libjSSC-${MAJOR_MINOR}_${JSSC_ARCH}.so

do-install:
	@${MKDIR} ${STAGEDIR}${JAVA_HOME}/jre/lib/ext
	${CP} ${WRKSRC}/build/jssc-${PORTVERSION}.jar ${STAGEDIR}${JAVA_HOME}/jre/lib/ext

.include <bsd.port.post.mk>