summaryrefslogtreecommitdiff
path: root/databases/postgresql-pljava/Makefile
blob: 0636f267ab15dd5da7a8a1cd16588a54a1e2d52a (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
# $NetBSD: Makefile,v 1.6 2020/05/23 15:30:27 nia Exp $

DISTNAME=	pljava-1.5.0
PKGNAME=	postgresql${PGSQL_VERSION}-${DISTNAME}
CATEGORIES=	databases
MASTER_SITES=	${MASTER_SITE_GITHUB:=tada/}

GITHUB_PROJECT=			pljava
GITHUB_TAG=			V${PKGVERSION_NOREV:S/./_/g}
DISTFILES=			${DEFAULT_DISTFILES} ${DISTNAME}-deps.tar.gz
SITES.${DISTNAME}-deps.tar.gz=	ftp://ftp.NetBSD.org/pub/NetBSD/misc/fhajny/

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	https://github.com/tada/pljava/
COMMENT=	Java Stored Procedures, Triggers, and Functions for PostgreSQL
LICENSE=	modified-bsd

DEPENDS+=	apache-maven-[0-9]*:../../devel/apache-maven
DEPENDS+=	postgresql${PGSQL_VERSION}-server>=0:../../databases/postgresql${PGSQL_VERSION}-server

PGSQL_VERSIONS_ACCEPTED=	95

USE_JAVA2=	7
USE_LANGUAGES=	c c++
TOOLS_BROKEN+=	perl

WRKSRC=		${WRKDIR}/${DISTNAME:S/./_/g}

.include "../../mk/bsd.prefs.mk"
.include "../../mk/compiler.mk"
.include "../../mk/java-vm.mk"

.if !empty(PKG_JVM:Mopenjdk*)
LIBJVM=	${PKG_JAVA_HOME}/jre/lib/${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}/server/libjvm.${PG_LIB_EXT}
.else
LIBJVM=	${PKG_JAVA_HOME}/lib/${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}/server/libjvm.${PG_LIB_EXT}
.endif

SUBST_CLASSES+=		sun
SUBST_STAGE.sun=	pre-configure
SUBST_FILES.sun=	pljava-so/aol.solaris-gcc.properties
SUBST_MESSAGE.sun=	Fix SunOS build target
SUBST_SED.sun=		-e 's,/usr/sfw/include,${PGSQL_PREFIX}/include -I${PKG_JAVA_HOME}/include,'

SUBST_CLASSES+=		jvm
SUBST_MESSAGE.jvm=	Setting default libjvm path
SUBST_STAGE.jvm=	pre-configure
SUBST_FILES.jvm=	pljava-so/src/main/c/Backend.c
SUBST_VARS.jvm=		LIBJVM

MAVEN_FLAGS+=	--offline
MAVEN_FLAGS+=	-Plinkpglibs
MAVEN_FLAGS+=	-Pwnosign
MAVEN_FLAGS+=	-Duser.home=${FAKEHOMEDIR}
MAVEN_FLAGS+=	-Dmaven.repo.local=${WRKDIR}/deps
MAVEN_FLAGS+=	-Dnar.cores=${MAKE_JOBS:U1}
MAVEN_FLAGS+=	-Dpgsql.runpath=${PGSQL_PREFIX}/lib
MAVEN_FLAGS+=	-Dpgsql.runpathpfx=${COMPILER_RPATH_FLAG}
.if ${OPSYS} == "SunOS" && !empty(CC_VERSION:Mgcc*)
MAVEN_FLAGS+=	-Dnar.aolProperties=pljava-so/aol.solaris-gcc.properties
.elif ${OPSYS} == "NetBSD"
MAVEN_FLAGS+=	-Dnar.aolProperties=pljava-so/aol.netbsd.properties
.endif

INSTALL_FLAGS+=	-Dpgconfig.sharedir=${DESTDIR}${PREFIX}/share/postgresql
INSTALL_FLAGS+=	-Dpgconfig.pkglibdir=${DESTDIR}${PREFIX}/lib/postgresql

post-extract:
	${CP} ${PKGDIR}/files/aol.netbsd.properties ${WRKSRC}/pljava-so

do-build:
	${_ULIMIT_CMD} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} mvn ${MAVEN_FLAGS} install

do-install:
	cd ${WRKSRC} && ${SETENV} ${INSTALL_ENV} java ${INSTALL_FLAGS} -jar \
	pljava-packaging/target/pljava-pg${VER:!pg_config --version!:[2]:C/\.[0-9]+$//}-${MACHINE_ARCH:S/x86_64/amd64/}-${OPSYS}-gpp.jar

.include "../../mk/pgsql.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"