Skip to content

Commit

Permalink
java/sigar: the port had been updated and improved (+)
Browse files Browse the repository at this point in the history
- Switch (temporarily?) to somewhat more developed GitHub fork
- Add Java 11 support, `do-test' target, and remove GCC dependency
- Optimize away PLATFORM_VER variable and just set the LIBNAME (without
  the suffix to make it more obvious that it's a shared object when we
  install things, and in the PLIST_FILES)
- Utilize BUILD_WRKSRC and introduce INVOKE_ANT variable to reduce the
  tautology in targets' recipes
- When symlinking to ${CC} as local compiler, do not assume it lives as
  ${LOCALBASE}/bin/${CC} and call `which ${CC}` explicitly
- Garbage-collect commented out `post-patch' target while we're here

PR:		245867
Submitted by:	Angelo Polo
  • Loading branch information
Alexey Dokuchaev authored and Alexey Dokuchaev committed Jul 16, 2021
1 parent 4512e77 commit a780ad6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
40 changes: 19 additions & 21 deletions java/sigar/Makefile
Expand Up @@ -2,7 +2,7 @@

PORTNAME= sigar
PORTVERSION= 1.7.3
PORTREVISION= 10
PORTREVISION= 11
CATEGORIES= java devel
PKGNAMEPREFIX= java-

Expand All @@ -17,50 +17,48 @@ BROKEN_armv7= fails to compile: jni-build.xml: gcc failed with return code 1

BUILD_DEPENDS= ${ANT_CMD}:devel/apache-ant
LIB_DEPENDS= libsigar.so:devel/sigar
TEST_DEPENDS= ${JAVALIBDIR}/junit.jar:java/junit

USE_GITHUB= yes
GH_ACCOUNT= amishHammer
GH_TAGNAME= b5af695
GH_ACCOUNT= polo-language # amishHammer
GH_TAGNAME= 6719d4d

USES= perl5
USE_PERL5= build
USE_JAVA= yes
JAVA_VERSION= 8
JAVA_RUN= yes
USE_GCC= yes
NO_CCACHE= yes

BUILD_WRKSRC= ${WRKSRC}/bindings/java

ANT_CMD?= ${LOCALBASE}/bin/ant
ANT= ${SETENV} JAVA_HOME=${JAVA_HOME} ${ANT_CMD}
INVOKE_ANT= ${SETENV} PATH=${PATH}:${WRKSRC}/bin JAVA_HOME=${JAVA_HOME} \
${ANT_CMD}

.include <bsd.port.pre.mk>

.if ${OPSYS} == FreeBSD
PLATFORM_VER= 1
LIBNAME= libsigar-${ARCH:S,i386,x86,:S,powerpc64,ppc64,}-${OPSYS:tl}-1
.else
IGNORE= ${OPSYS} platform is not supported
.endif

LIBNAME= libsigar-${ARCH:S,i386,x86,:S,powerpc64,ppc64,}-${OPSYS:tl}-${PLATFORM_VER}.so

PLIST_FILES= %%JAVAJARDIR%%/${PORTNAME}.jar \
%%JAVAJARDIR%%/${LIBNAME}

#post-patch:
# @${REINPLACE_CMD} s/gcc/${CC}/ \
# ${WRKSRC}/bindings/java/hyperic_jni/jni-build.xml
PLIST_FILES= ${JAVAJARDIR}/${PORTNAME}.jar \
${JAVAJARDIR}/${LIBNAME}.so

do-build:
${MKDIR} ${WRKSRC}/bin
.if ${CC} != "gcc"
${LN} -s ${LOCALBASE}/bin/${CC} ${WRKSRC}/bin/gcc
.endif
cd ${WRKSRC}/bindings/java && PATH=${PATH}:${WRKSRC}/bin ${ANT}
${LN} -s `which ${CC}` ${WRKSRC}/bin/gcc
@cd ${BUILD_WRKSRC} && ${INVOKE_ANT} build

do-test:
@cd ${BUILD_WRKSRC} && ${INVOKE_ANT} \
-Djunit.jar="${JAVALIBDIR}/junit.jar" test

do-install:
${INSTALL_DATA} ${WRKSRC}/bindings/java/sigar-bin/lib/sigar.jar \
${STAGEDIR}${JAVAJARDIR}/${PORTNAME}.jar
${INSTALL_LIB} ${WRKSRC}/bindings/java/sigar-bin/lib/libsigar-${ARCH:S,i386,x86,:S,powerpc64,ppc64,}-freebsd-${PLATFORM_VER}.so \
${STAGEDIR}${JAVAJARDIR}/${LIBNAME}
${INSTALL_LIB} ${WRKSRC}/bindings/java/sigar-bin/lib/${LIBNAME}.so \
${STAGEDIR}${JAVAJARDIR}/${LIBNAME}.so

.include <bsd.port.post.mk>
5 changes: 3 additions & 2 deletions java/sigar/distinfo
@@ -1,2 +1,3 @@
SHA256 (amishHammer-sigar-1.7.3-b5af695_GH0.tar.gz) = 548f853d3a0ce4d14e5833917bc6bac5fc42894415bd0b05123ea8e58780aa48
SIZE (amishHammer-sigar-1.7.3-b5af695_GH0.tar.gz) = 1091675
TIMESTAMP = 1626367522
SHA256 (polo-language-sigar-1.7.3-6719d4d_GH0.tar.gz) = d7dd03254a2f0dfa998228306789188e561f051915a479b18ef5f2b6868fb477
SIZE (polo-language-sigar-1.7.3-6719d4d_GH0.tar.gz) = 1091061

0 comments on commit a780ad6

Please sign in to comment.