blob: 5ccb0940794eb613739383f4e29e9c676e42e4e4 (
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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# $NetBSD: Makefile,v 1.31 2021/12/11 17:28:25 gdt Exp $
# Please do not drop this; a new update cycle is likely very soon.
DISTNAME= unifi-6.5.54
CATEGORIES= net
MASTER_SITES= -http://dl.ubnt.com/unifi/${PKGVERSION_NOREV}/UniFi.unix.zip
EXTRACT_SUFX= .zip
# Updates must be tested to not only build but actually function under
# at least NetBSD 9/amd64 with actual UBNT hardware.
MAINTAINER= gdt@NetBSD.org
HOMEPAGE= https://www.ubnt.com/download/unifi/
# The content that belongs in NEWS are often in a blog.
#BLOGPAGE= https://community.ui.com/releases
COMMENT= Provisioning software for network products made by Ubiquiti
LICENSE= ubiquiti-license
# Bundled firmware images cannot be redistributed
RESTRICTED= No permission to redistribute
NO_BIN_ON_CDROM= ${RESTRICTED}
NO_BIN_ON_FTP= ${RESTRICTED}
NO_SRC_ON_CDROM= ${RESTRICTED}
NO_SRC_ON_FTP= ${RESTRICTED}
DISTFILES= ${DEFAULT_DISTFILES}
EXTRACT_ONLY= ${DEFAULT_DISTFILES}
# Unifi bundles snappy-java-1.0.5.jar, which contains native code.
# We can use the bundled snappy-java but we must recompile the native portion
# because it only ship linux binaries. The rcd script takes care of loading the
# correct library.
SNAPPY_JAVA= snappy-java-1.0.5.4
# github.mk only works for the main MASTER_SITES definition and does
# not support SITES
SITES.${SNAPPY_JAVA}.tar.gz= -https://github.com/xerial/snappy-java/archive/${SNAPPY_JAVA:S/snappy-java-//}.tar.gz
DISTFILES+= ${SNAPPY_JAVA}.tar.gz
EXTRACT_ONLY+= ${SNAPPY_JAVA}.tar.gz
SNAPPY= snappy-1.0.5
SITES.${SNAPPY}.tar.gz= http://download.openpkg.org/components/cache/snappy/ \
http://ftp.NetBSD.org/pub/pkgsrc/distfiles/snappy-java10/
DISTFILES+= ${SNAPPY}.tar.gz
EXTRACT_ONLY+= ${SNAPPY}.tar.gz
CHECK_SHLIBS_SKIP= unifi/lib/native/*
INSTALLATION_DIRS= unifi
# Emulated JDK doesn't work due to epoll issues. Also, would require
# matching emulated native libraries, and we only compile actual
# native libaries.
# NetBSD openjdk11 fails to listen to https, so disable for now
PKG_JVMS_ACCEPTED= openjdk8
PKGSRC_MAKE_ENV+= JAVA_HOME=${PKG_JAVA_HOME}
USE_LANGUAGES= c c++ # for snappy JNI library
USE_TOOLS+= gmake pax
WRKSRC= ${WRKDIR}
# Upstream documents 3.4.15, but 3.4.4 actually works. Avoid mongodb4 because it
# has a problematic license.
DEPENDS+= mongodb>=3.4.4:../../databases/mongodb3
FILES_SUBST+= UNIFI_USER=${UNIFI_USER:Q} UNIFI_GROUP=${UNIFI_GROUP:Q}
FILES_SUBST+= JAVA=${PKG_JAVA_HOME}/bin/java
RCD_SCRIPTS= unifi
UNIFI_USER?= unifi
UNIFI_GROUP?= unifi
PKG_USERS_VARS= UNIFI_USER
PKG_GROUPS_VARS= UNIFI_GROUP
PKG_GROUPS= ${UNIFI_GROUP}
PKG_USERS= ${UNIFI_USER}:${UNIFI_GROUP}
.for d in data logs run work
OWN_DIRS_PERMS+= ${PREFIX}/unifi/${d} ${UNIFI_USER} ${UNIFI_GROUP} 0700
.endfor
.include "../../mk/bsd.prefs.mk"
post-extract:
# drop executable bit
find ${WRKSRC}/UniFi -type f -print0 | xargs -0 chmod -x
mkdir ${WRKDIR}/${SNAPPY_JAVA}/target
ln -s ${WRKDIR}/${SNAPPY} ${WRKDIR}/${SNAPPY_JAVA}/target
# drop platform specific binaries
# as far as we know, these are for cloud access to your controller
ls -R ${WRKDIR}/UniFi/lib/native
rm -rf ${WRKDIR}/UniFi/lib/native/Windows
.if (${OPSYS} != "Linux")
rm -rf ${WRKDIR}/UniFi/lib/native/Linux
.else
. if (${MACHINE_ARCH} != "aarch64")
rm -rf ${WRKDIR}/UniFi/lib/native/Linux/aarch64
. endif
. if (${MACHINE_ARCH} != "earmv7")
rm -rf ${WRKDIR}/UniFi/lib/native/Linux/armv7
. endif
. if (${MACHINE_ARCH} != "x86_64")
rm -rf ${WRKDIR}/UniFi/lib/native/Linux/x86_64
. endif
.endif
.if (${OPSYS} != "Darwin")
rm -rf ${WRKDIR}/UniFi/lib/native/Mac
.else
. if (${MACHINE_ARCH} != "x86_64")
rm -rf ${WRKDIR}/UniFi/lib/native/Mac/x86_64
. endif
.endif
do-build:
# bundled mongod is a linux binary; replace with symlink to native binary
rm -f ${WRKSRC}/UniFi/bin/mongod
ln -s ${PREFIX}/bin/mongod ${WRKSRC}/UniFi/bin/mongod
cd ${WRKDIR}/${SNAPPY_JAVA} && ${BUILD_MAKE_CMD} native
do-install:
cd ${WRKSRC}/UniFi && pax -rw . ${DESTDIR}${PREFIX}/unifi
${INSTALL_LIB} ${WRKDIR}/${SNAPPY_JAVA}/target/snappy-1.0.5-Default/libsnappyjava.so ${DESTDIR}${PREFIX}/unifi/lib
.include "../../mk/java-vm.mk"
.include "../../mk/bsd.pkg.mk"
|