Date: Wed, 21 May 2014 20:03:15 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r354761 - in head/java/openjdk7: . files Message-ID: <201405212003.s4LK3FPP085818@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Wed May 21 20:03:14 2014 New Revision: 354761 URL: http://svnweb.freebsd.org/changeset/ports/354761 QAT: https://qat.redports.org/buildarchive/r354761/ Log: - Fix printing services. When CUPS is used, ${LOCALBASE}/bin/lpr must be used to print a generated PostScript file. When lpd(8) is used, lpr(1) from base must be used. Also, status command for lpc(8) requires a printer name. If no argument is specified, i.e., "/usr/sbin/lpc status", then it displays the command usage, i.e., "usage: status {all | printer ...}". Unfortunately, "usage" is interpreted as a printer name because ":" is included. Add "all" and adjust an expression for grep(1). [1] - Use /proc/curproc/file to find its executable path if available. It fixes java/icedtea-web, for example. [2] PR: ports/178856 [1] PR: java/189905 [2] Added: head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java (contents, props changed) head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c (contents, props changed) head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java (contents, props changed) Modified: head/java/openjdk7/Makefile Modified: head/java/openjdk7/Makefile ============================================================================== --- head/java/openjdk7/Makefile Wed May 21 19:58:46 2014 (r354760) +++ head/java/openjdk7/Makefile Wed May 21 20:03:14 2014 (r354761) @@ -3,7 +3,7 @@ PORTNAME= openjdk PORTVERSION= ${JDK_MAJOR_VERSION}.${PORT_MINOR_VERSION}.${PORT_BUILD_NUMBER} -PORTREVISION= 4 +PORTREVISION= 5 PORTEPOCH= 1 CATEGORIES= java devel MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}u${JDK_MINOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/ \ @@ -130,7 +130,8 @@ MAKE_ENV+= EXTRA_CFLAGS=-DLIBICONV_PLUG post-patch: @${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|" \ - ${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp + ${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp \ + ${WRKSRC}/jdk/src/share/classes/sun/print/PSPrinterJob.java .if empty(ICONV_LIB) @${REINPLACE_CMD} 's| -liconv||' \ ${WRKSRC}/Makefile \ Added: head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java Wed May 21 20:03:14 2014 (r354761) @@ -0,0 +1,36 @@ +--- jdk/src/share/classes/sun/print/PSPrinterJob.java ++++ jdk/src/share/classes/sun/print/PSPrinterJob.java +@@ -1568,9 +1568,31 @@ + } + + String osname = System.getProperty("os.name"); +- if (osname.equals("Linux") || osname.equals("FreeBSD") || osname.equals("NetBSD") || osname.equals("OpenBSD") || osname.equals("OS X")) { ++ if (osname.equals("Linux") || osname.endsWith("BSD") || osname.contains("OS X")) { ++ String lprPath = "/usr/bin/lpr"; ++ if (osname.endsWith("BSD")) { ++ final PrintService pservice = getPrintService(); ++ Boolean isIPPPrinter = ++ (Boolean)java.security.AccessController.doPrivileged( ++ new java.security.PrivilegedAction() { ++ public Object run() { ++ try { ++ Class psClass = ++ Class.forName("sun.print.IPPPrintService"); ++ if (psClass.isInstance(pservice)) { ++ return Boolean.TRUE; ++ } ++ } catch (Throwable t) { ++ } ++ return Boolean.FALSE; ++ } ++ }); ++ if (isIPPPrinter) { ++ lprPath = "%%LOCALBASE%%/bin/lpr"; ++ } ++ } + execCmd = new String[ncomps]; +- execCmd[n++] = "/usr/bin/lpr"; ++ execCmd[n++] = lprPath; + if ((pFlags & PRINTER) != 0) { + execCmd[n++] = "-P" + printer; + } Added: head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c Wed May 21 20:03:14 2014 (r354761) @@ -0,0 +1,38 @@ +--- jdk/src/solaris/bin/java_md_solinux.c ++++ jdk/src/solaris/bin/java_md_solinux.c +@@ -899,8 +899,9 @@ + * onwards the filename returned in DL_info structure from dladdr is + * an absolute pathname so technically realpath isn't required. + * On Linux we read the executable name from /proc/self/exe. +- * As a fallback, and for platforms other than Solaris and Linux, +- * we use FindExecName to compute the executable name. ++ * On FreeBSD we read the executable name from /proc/curproc/file. ++ * As a fallback, and for platforms other than Solaris, Linux, and ++ * FreeBSD, we use FindExecName to compute the executable name. + */ + const char* + SetExecname(char **argv) +@@ -927,9 +928,13 @@ + } + } + } +-#elif defined(__linux__) ++#elif defined(__linux__) || defined(__FreeBSD__) + { ++#if defined(__FreeBSD__) ++ const char* self = "/proc/curproc/file"; ++#else + const char* self = "/proc/self/exe"; ++#endif + char buf[PATH_MAX+1]; + int len = readlink(self, buf, PATH_MAX); + if (len >= 0) { +@@ -937,7 +942,7 @@ + exec_path = JLI_StringDup(buf); + } + } +-#else /* !__solaris__ && !__linux__ */ ++#else /* !__solaris__ && !__linux__ && !__FreeBSD__ */ + { + /* Not implemented */ + } Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java Wed May 21 20:03:14 2014 (r354761) @@ -0,0 +1,17 @@ +--- jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java ++++ jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java +@@ -140,12 +140,12 @@ + static int cmdIndex = UNINITIALIZED; + + String[] lpcFirstCom = { +- "/usr/sbin/lpc status | grep : | sed -ne '1,1 s/://p'", ++ "/usr/sbin/lpc status all | grep ':$' | sed -ne '1,1 s/://p'", + "/usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'" + }; + + String[] lpcAllCom = { +- "/usr/sbin/lpc status all | grep : | sed -e 's/://'", ++ "/usr/sbin/lpc status all | grep ':$' | sed -e 's/://'", + "/usr/sbin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort" + }; +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405212003.s4LK3FPP085818>