Subject: Re: pkg/36828: sun-jre6 check libs problem
To: None <gnats-bugs@NetBSD.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: pkgsrc-bugs
Date: 08/24/2007 17:18:28
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Aug 24, 2007 at 12:30:01PM +0000, pkgsrc@blackmouse.biz wrote:
> Problem in install on system without X (server or bulk-build)
> 
> => Checking for missing run-time search paths in sun-jre6-6.0.1nb1
> ERROR: /usr/pkg/java/sun-6/bin/javaws: 	libX11.so.6 => not found
> ERROR: /usr/pkg/java/sun-6/bin/policytool: 	libX11.so.6 => not found
> ERROR: *** The programs/libs shown above will not find the listed
> ERROR:     shared libraries at runtime.
> ERROR:     Please fix the package (add -Wl,-R.../lib in the right places)!
> *** Error code 1

The Sun JRE and JDK seem to need libX11.so.6.  Can you see if the
attached patch fixes the problem?  If you are running Linux natively,
it should fail and tell you to install the X11 libraries.  Otherwise,
pkgsrc will build and install pkgsrc/x11/libX11 to satisfy this
requirement.

	Thanks,

	-- Johnny Lam <jlam@pkgsrc.org>

--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sun-jre6.diff"

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/sun-jre6/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile	22 Aug 2007 14:03:49 -0000	1.5
+++ Makefile	24 Aug 2007 17:14:34 -0000
@@ -4,7 +4,7 @@
 
 DISTNAME=	jre-6u1-linux-${DIST_ARCH}
 PKGNAME=	sun-jre6-6.0.1
-PKGREVISION=	1
+PKGREVISION=	2
 MASTER_SITES=	# empty
 
 DOWNLOAD_NAME=	Java Runtime Environment (JRE) 6u1
@@ -43,6 +43,35 @@
 PLIST_SUBST+=	SUN_JRE6_USE_JCE="@comment "
 .endif
 
+# Some of the binaries require libX11, so ensure that requirement is
+# satisfied when the package is installed on the native OS.
+#
+.if defined(EMUL_IS_NATIVE)
+.  if ${X11_TYPE} == "native"
+.    if ${EMUL_ARCH} == "x86_64"
+LIBX11=		${X11PREFIX}/lib64/libX11.so.6
+.    else
+LIBX11=		${X11PREFIX}/lib/libX11.so.6
+.    endif
+.    if !exists(${LIBX11})
+PKG_FAIL_REASON+=	"${LIBX11} does not exist.  Please install the" \
+			"X11 library packages for your system."
+.    endif
+.  else
+.    include "../../x11/libX11/buildlink3.mk"
+LIBX11=		${X11PREFIX}/lib/libX11.so.6
+.  endif
+
+PLIST_SUBST+=		LIBX11=
+
+.PHONY: create-library-symlinks
+post-install: create-library-symlinks
+create-library-symlinks:
+	${RUN}${LN} -fs ${LIBX11} ${JAVA_HOME}/lib/${EMUL_ARCH}
+.else
+PLIST_SUBST+=		LIBX11="@comment "
+.endif
+
 post-extract:
 	${MKDIR} ${WRKSRC}/.systemPrefs
 	${TOUCH} ${WRKSRC}/.systemPrefs/.system.lock
Index: PLIST.linux-i386
===================================================================
RCS file: /cvsroot/pkgsrc/lang/sun-jre6/PLIST.linux-i386,v
retrieving revision 1.2
diff -u -r1.2 PLIST.linux-i386
--- PLIST.linux-i386	23 Aug 2007 18:46:36 -0000	1.2
+++ PLIST.linux-i386	24 Aug 2007 17:14:34 -0000
@@ -144,6 +144,7 @@
 java/sun-6/lib/i386/jli/libjli.so
 java/sun-6/lib/i386/jvm.cfg.default
 java/sun-6/lib/i386/libJdbcOdbc.so
+${LIBX11}java/sun-6/lib/i386/libX11.so.6
 java/sun-6/lib/i386/libawt.so
 java/sun-6/lib/i386/libcmm.so
 java/sun-6/lib/i386/libdcpr.so

--wac7ysb48OaltWcw--