0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 14:13:36 +00:00
termux-packages/packages/openjdk-17/0030-Update-hardcoded-paths-to-work-in-termux.patch

573 lines
30 KiB
Diff

From aa5840c43ce552624fed1b29c76364cb86ded2fe Mon Sep 17 00:00:00 2001
From: Henrik Grimler <grimler@termux.dev>
Date: Tue, 6 Jul 2021 18:29:24 +0700
Subject: [PATCH] Update hardcoded paths to work in termux
---
src/hotspot/os/linux/os_linux.cpp | 10 +++++--
.../share/utilities/virtualizationSupport.cpp | 2 +-
.../classes/sun/nio/fs/LinuxFileSystem.java | 2 +-
.../sun/nio/fs/LinuxFileSystemProvider.java | 2 +-
.../share/classes/sun/net/www/MimeTable.java | 5 ++--
.../sun/security/jca/ProviderConfig.java | 2 +-
.../net/dns/ResolverConfigurationImpl.java | 2 +-
.../unix/native/libjava/ProcessImpl_md.c | 2 +-
.../unix/native/libjava/TimeZone_md.c | 6 ++--
.../com/sun/java/swing/plaf/gtk/Metacity.java | 11 +++-----
.../com/sun/media/sound/SoftSynthesizer.java | 8 +++---
.../classes/sun/font/SunFontManager.java | 2 +-
.../share/classes/sun/print/PSPrinterJob.java | 4 +--
.../sun/awt/X11/MotifColorUtilities.java | 2 +-
.../sun/print/PrintServiceLookupProvider.java | 28 +++++++++----------
.../unix/classes/sun/print/UnixPrintJob.java | 2 +-
.../classes/sun/print/UnixPrintService.java | 8 +++---
.../unix/native/common/awt/fontpath.c | 25 ++++++++---------
.../util/prefs/FileSystemPreferences.java | 2 +-
.../classes/sun/security/krb5/Config.java | 2 +-
.../internal/ccache/FileCredentialsCache.java | 2 +-
.../security/smartcardio/PlatformPCSC.java | 4 +--
.../linux/native/libsaproc/symtab.c | 2 +-
.../jpackage/internal/LinuxDebBundler.java | 6 ++--
.../internal/LinuxPackageBundler.java | 4 +--
.../jdk/jpackage/internal/resources/utils.sh | 2 +-
26 files changed, 74 insertions(+), 73 deletions(-)
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 31fc882b0344..e815b0afd7c1 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1382,7 +1382,13 @@ const char* os::dll_file_extension() { return ".so"; }
// This must be hard coded because it's the system's temporary
// directory not the java application's temp directory, ala java.io.tmpdir.
-const char* os::get_temp_directory() { return "/tmp"; }
+const char* os::get_temp_directory() {
+#ifndef __ANDROID__
+ return "/tmp";
+#else
+ return "@TERMUX_PREFIX@/tmp";
+#endif
+}
static bool file_exists(const char* filename) {
struct stat statbuf;
@@ -2238,7 +2244,7 @@ void os::Linux::print_process_memory_info(outputStream* st) {
}
bool os::Linux::print_ld_preload_file(outputStream* st) {
- return _print_ascii_file("/etc/ld.so.preload", st, "/etc/ld.so.preload:");
+ return _print_ascii_file("@TERMUX_PREFIX@/etc/ld.so.preload", st, "@TERMUX_PREFIX@/etc/ld.so.preload:");
}
void os::Linux::print_uptime_info(outputStream* st) {
diff --git a/src/hotspot/share/utilities/virtualizationSupport.cpp b/src/hotspot/share/utilities/virtualizationSupport.cpp
index 5a2e8651efaf..971f74af5605 100644
--- a/src/hotspot/share/utilities/virtualizationSupport.cpp
+++ b/src/hotspot/share/utilities/virtualizationSupport.cpp
@@ -52,7 +52,7 @@ void VirtualizationSupport::initialize() {
// the open-vm-tools have a different guest lib name
// on some distros e.g. SLES12 the open-vm-tools are the default,
// so use the different libname as a fallback
- dlHandle = os::dll_load("/usr/lib64/libguestlib.so.0", ebuf, sizeof ebuf);
+ dlHandle = os::dll_load("@TERMUX_PREFIX@/lib/libguestlib.so.0", ebuf, sizeof ebuf);
}
#endif
if (dlHandle == NULL) {
diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
index a3153b31329f..594a26c111ce 100644
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
@@ -118,7 +118,7 @@ class LinuxFileSystem extends UnixFileSystem {
*/
@Override
List<UnixMountEntry> getMountEntries() {
- return getMountEntries("/etc/mtab");
+ return getMountEntries("@TERMUX_PREFIX@/etc/mtab");
}
diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
index a1c2aed4bd24..23c7df39c31b 100644
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
@@ -104,7 +104,7 @@ class LinuxFileSystemProvider extends UnixFileSystemProvider {
FileTypeDetector getFileTypeDetector() {
String userHome = StaticProperty.userHome();
Path userMimeTypes = Path.of(userHome, ".mime.types");
- Path etcMimeTypes = Path.of("/etc/mime.types");
+ Path etcMimeTypes = Path.of("@TERMUX_PREFIX@/etc/mime.types");
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
new MimeTypesFileTypeDetector(etcMimeTypes));
diff --git a/src/java.base/share/classes/sun/net/www/MimeTable.java b/src/java.base/share/classes/sun/net/www/MimeTable.java
index b20566bdc8b9..8c3b8cfcd02c 100644
--- a/src/java.base/share/classes/sun/net/www/MimeTable.java
+++ b/src/java.base/share/classes/sun/net/www/MimeTable.java
@@ -57,9 +57,8 @@ public class MimeTable implements FileNameMap {
mailcapLocations = new String[] {
System.getProperty("user.mailcap"),
StaticProperty.userHome() + "/.mailcap",
- "/etc/mailcap",
- "/usr/etc/mailcap",
- "/usr/local/etc/mailcap",
+ "@TERMUX_PREFIX@/etc/mailcap",
+ "@TERMUX_PREFIX@/local/etc/mailcap",
};
return null;
}
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
index 7a9022e8769c..9964dd4a6224 100644
--- a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
+++ b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
@@ -98,7 +98,7 @@ final class ProviderConfig {
Boolean o = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
public Boolean run() {
- File file = new File("/usr/lib/libpkcs11.so");
+ File file = new File("@TERMUX_PREFIX@/lib/libpkcs11.so");
if (file.exists() == false) {
return Boolean.FALSE;
}
diff --git a/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java b/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
index d46138f23b74..4d626da8f2cc 100644
--- a/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
+++ b/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
@@ -64,7 +64,7 @@ public class ResolverConfigurationImpl
try {
BufferedReader in =
- new BufferedReader(new FileReader("/etc/resolv.conf"));
+ new BufferedReader(new FileReader("@TERMUX_PREFIX@/etc/resolv.conf"));
String line;
while ((line = in.readLine()) != null) {
int maxvalues = maxperkeyword;
diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c
index 3854f36daf08..8d9cc64e178b 100644
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c
@@ -230,7 +230,7 @@ xmalloc(JNIEnv *env, size_t size)
static const char*
defaultPath(void)
{
- return ":/bin:/usr/bin";
+ return ":@TERMUX_PREFIX@/bin";
}
static const char*
diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c
index 94dfc207f965..0d0ffdab0ee9 100644
--- a/src/java.base/unix/native/libjava/TimeZone_md.c
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c
@@ -60,9 +60,9 @@ static char *isFileIdentical(char* buf, size_t size, char *pathname);
#endif
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
-static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
-static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
-static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
+static const char *ETC_TIMEZONE_FILE = "@TERMUX_PREFIX@/etc/timezone";
+static const char *ZONEINFO_DIR = "@TERMUX_PREFIX@/share/zoneinfo";
+static const char *DEFAULT_ZONEINFO_FILE = "@TERMUX_PREFIX@/etc/localtime";
#else
static const char *SYS_INIT_FILE = "/etc/default/init";
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
index 042ca1878747..0be96292517a 100644
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
@@ -482,13 +482,10 @@ class Metacity implements SynthConstants {
String[] dirs = new String[] {
userHome + sep + ".themes",
System.getProperty("swing.metacitythemedir"),
- "/usr/X11R6/share/themes",
- "/usr/X11R6/share/gnome/themes",
- "/usr/local/share/themes",
- "/usr/local/share/gnome/themes",
- "/usr/share/themes",
- "/usr/gnome/share/themes", // Debian/Redhat/Solaris
- "/opt/gnome2/share/themes" // SuSE
+ "@TERMUX_PREFIX@/share/themes",
+ "@TERMUX_PREFIX@/share/gnome/themes",
+ "@TERMUX_PREFIX@/local/share/themes",
+ "@TERMUX_PREFIX@/local/share/gnome/themes",
};
URL themeDir = null;
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
index 70b8b622df9c..7dc6d97d452c 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
@@ -685,11 +685,11 @@ public final class SoftSynthesizer implements AudioSynthesizer,
File[] systemSoundFontsDir = new File[] {
/* Arch, Fedora, Mageia */
- new File("/usr/share/soundfonts/"),
- new File("/usr/local/share/soundfonts/"),
+ new File("@TERMUX_PREFIX@/share/soundfonts/"),
+ new File("@TERMUX_PREFIX@/local/share/soundfonts/"),
/* Debian, Gentoo, OpenSUSE, Ubuntu */
- new File("/usr/share/sounds/sf2/"),
- new File("/usr/local/share/sounds/sf2/"),
+ new File("@TERMUX_PREFIX@/share/sounds/sf2/"),
+ new File("@TERMUX_PREFIX@/local/share/sounds/sf2/"),
};
/*
diff --git a/src/java.desktop/share/classes/sun/font/SunFontManager.java b/src/java.desktop/share/classes/sun/font/SunFontManager.java
index 870009612f77..824a07db37c4 100644
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java
@@ -3448,7 +3448,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
public void register1dot0Fonts() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
- String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
+ String type1Dir = "@TERMUX_PREFIX@/openwin/lib/X11/fonts/Type1";
registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
false, false);
return null;
diff --git a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
index 4645aabd8615..2d3d6bfccc00 100644
--- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
+++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
@@ -1630,7 +1630,7 @@ public class PSPrinterJob extends RasterPrinterJob {
String osname = System.getProperty("os.name");
if (osname.equals("Linux") || osname.contains("OS X")) {
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lpr";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lpr";
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-P" + printer;
}
@@ -1652,7 +1652,7 @@ public class PSPrinterJob extends RasterPrinterJob {
} else {
ncomps+=1; //add 1 arg for lp
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lp";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lp";
execCmd[n++] = "-c"; // make a copy of the spool file
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-d" + printer;
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
index f42a180532e3..9acecdb14c4a 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
@@ -412,7 +412,7 @@ class MotifColorUtilities {
if (!pFile.exists())
{
// Must be a system palette
- paletteFilePath = "/usr/dt/palettes/" + paletteFile;
+ paletteFilePath = "@TERMUX_PREFIX@/dt/palettes/" + paletteFile;
pFile = new File(paletteFilePath);
if (!pFile.exists())
{
diff --git a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
index 79fc2fd15eef..7fb0c803ccd1 100644
--- a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
+++ b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
@@ -81,10 +81,10 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
// List of commands used to deal with the printer queues on AIX
String[] lpNameComAix = {
- "/usr/bin/lsallq",
- "/usr/bin/lpstat -W -p|/usr/bin/expand|/usr/bin/cut -f1 -d' '",
- "/usr/bin/lpstat -W -d|/usr/bin/expand|/usr/bin/cut -f1 -d' '",
- "/usr/bin/lpstat -W -v"
+ "@TERMUX_PREFIX@/bin/lsallq",
+ "@TERMUX_PREFIX@/bin/lpstat -W -p|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f1 -d' '",
+ "@TERMUX_PREFIX@/bin/lpstat -W -d|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f1 -d' '",
+ "@TERMUX_PREFIX@/bin/lpstat -W -v"
};
private static final int aix_lsallq = 0;
private static final int aix_lpstat_p = 1;
@@ -172,13 +172,13 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
static int cmdIndex = UNINITIALIZED;
String[] lpcFirstCom = {
- "/usr/sbin/lpc status | grep : | sed -ne '1,1 s/://p'",
- "/usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'"
+ "@TERMUX_PREFIX@/bin/lpc status | grep : | sed -ne '1,1 s/://p'",
+ "@TERMUX_PREFIX@/bin/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 -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort"
+ "@TERMUX_PREFIX@/bin/lpc status all | grep : | sed -e 's/://'",
+ "@TERMUX_PREFIX@/bin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort"
};
String[] lpcNameCom = {
@@ -188,7 +188,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
static int getBSDCommandIndex() {
- String command = "/usr/sbin/lpc status all";
+ String command = "@TERMUX_PREFIX@/bin/lpc status all";
String[] names = execCmd(command);
if ((names == null) || (names.length == 0)) {
@@ -757,7 +757,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
if (cmdIndex == UNINITIALIZED) {
cmdIndex = getBSDCommandIndex();
}
- String command = "/usr/sbin/lpc status " + name + lpcNameCom[cmdIndex];
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + name + lpcNameCom[cmdIndex];
String[] result = execCmd(command);
if (result == null || !(result[0].equals(name))) {
@@ -779,7 +779,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
static String getDefaultPrinterNameSysV() {
String defaultPrinter = "lp";
- String command = "/usr/bin/lpstat -d";
+ String command = "@TERMUX_PREFIX@/bin/lpstat -d";
String [] names = execCmd(command);
if (names == null || names.length == 0) {
@@ -801,7 +801,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
private PrintService getNamedPrinterNameSysV(String name) {
- String command = "/usr/bin/lpstat -v " + name;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -v " + name;
String []result = execCmd(command);
if (result == null || result[0].indexOf("unknown printer") > 0) {
@@ -813,7 +813,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
private String[] getAllPrinterNamesSysV() {
String defaultPrinter = "lp";
- String command = "/usr/bin/lpstat -v|/usr/bin/expand|/usr/bin/cut -f3 -d' ' |/usr/bin/cut -f1 -d':' | /usr/bin/sort";
+ String command = "@TERMUX_PREFIX@/bin/lpstat -v|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f3 -d' ' |@TERMUX_PREFIX@/bin/cut -f1 -d':' | @TERMUX_PREFIX@/bin/sort";
String [] names = execCmd(command);
ArrayList<String> printerNames = new ArrayList<>();
@@ -870,7 +870,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
try {
final String[] cmd = new String[3];
if (isAIX()) {
- cmd[0] = "/usr/bin/sh";
+ cmd[0] = "@TERMUX_PREFIX@/bin/sh";
cmd[1] = "-c";
cmd[2] = "env LC_ALL=C " + command;
} else {
diff --git a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
index 4f810d947d49..41ae71fb589d 100644
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
@@ -882,7 +882,7 @@ public class UnixPrintJob implements CancelablePrintJob {
ncomps+=1;
}
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lpr";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lpr";
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-P" + printer;
}
diff --git a/src/java.desktop/unix/classes/sun/print/UnixPrintService.java b/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
index 2a11a6e2d058..d07da584dc7b 100644
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
@@ -231,7 +231,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
PrintServiceLookupProvider.getBSDCommandIndex();
}
- String command = "/usr/sbin/lpc status " + printer
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + printer
+ lpcStatusCom[PrintServiceLookupProvider.cmdIndex];
String[] results= PrintServiceLookupProvider.execCmd(command);
@@ -280,7 +280,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
// On AIX there should not be a blank after '-a'.
- String command = "/usr/bin/lpstat -a" + printer;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -a" + printer;
String[] results= PrintServiceLookupProvider.execCmd(command);
// Remove headers and bogus entries added by remote printers.
@@ -336,7 +336,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
}
int qlen = 0;
- String command = "/usr/sbin/lpc status " + printer
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + printer
+ lpcQueueCom[PrintServiceLookupProvider.cmdIndex];
String[] results = PrintServiceLookupProvider.execCmd(command);
@@ -365,7 +365,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
private QueuedJobCount getQueuedJobCountAIX() {
// On AIX there should not be a blank after '-a'.
- String command = "/usr/bin/lpstat -a" + printer;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -a" + printer;
String[] results= PrintServiceLookupProvider.execCmd(command);
// Remove headers and bogus entries added by remote printers.
diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c
index fa5fc982327e..222af29cef33 100644
--- a/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -66,19 +66,18 @@ extern Display *awt_display;
* various flavors of Linux
*/
static char *fullLinuxFontPath[] = {
- "/usr/X11R6/lib/X11/fonts/TrueType", /* RH 7.1+ */
- "/usr/X11R6/lib/X11/fonts/truetype", /* SuSE */
- "/usr/X11R6/lib/X11/fonts/tt",
- "/usr/X11R6/lib/X11/fonts/TTF",
- "/usr/X11R6/lib/X11/fonts/OTF", /* RH 9.0 (but empty!) */
- "/usr/share/fonts/ja/TrueType", /* RH 7.2+ */
- "/usr/share/fonts/truetype",
- "/usr/share/fonts/ko/TrueType", /* RH 9.0 */
- "/usr/share/fonts/zh_CN/TrueType", /* RH 9.0 */
- "/usr/share/fonts/zh_TW/TrueType", /* RH 9.0 */
- "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType", /* Debian */
- "/usr/X11R6/lib/X11/fonts/Type1",
- "/usr/share/fonts/default/Type1", /* RH 9.0 */
+ "@TERMUX_PREFIX@/share/fonts/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/truetype",
+ "@TERMUX_PREFIX@/share/fonts/tt",
+ "@TERMUX_PREFIX@/share/fonts/TTF",
+ "@TERMUX_PREFIX@/share/fonts/OTF",
+ "@TERMUX_PREFIX@/share/fonts/ja/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/ko/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/zh_CN/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/zh_TW/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/Type1",
+ "@TERMUX_PREFIX@/share/fonts/default/Type1",
+ "/system/fonts",
NULL, /* terminates the list */
};
#elif defined(_AIX)
diff --git a/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java b/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
index b30a23465c52..f92872239dfd 100644
--- a/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
+++ b/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
@@ -182,7 +182,7 @@ class FileSystemPreferences extends AbstractPreferences {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
String systemPrefsDirName =
- System.getProperty("java.util.prefs.systemRoot","/etc/.java");
+ System.getProperty("java.util.prefs.systemRoot","@TERMUX_PREFIX@/etc/.java");
systemRootDir =
new File(systemPrefsDirName, ".systemPrefs");
// Attempt to create root dir if it does not yet exist.
diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
index fadb115245f5..b7c4b392d705 100644
--- a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
@@ -930,7 +930,7 @@ public class Config {
} else if (osname.contains("OS X")) {
name = findMacosConfigFile();
} else {
- name = "/etc/krb5.conf";
+ name = "@TERMUX_PREFIX@/etc/krb5.conf";
}
if (DEBUG) {
System.out.println("Native config name: " + name);
diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
index f0379c04e915..6b37c25f3250 100644
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
@@ -600,7 +600,7 @@ public class FileCredentialsCache extends CredentialsCache
(new InputStreamReader(p.getInputStream(), ISO_8859_1));
String s1 = null;
if ((command.length == 1) &&
- (command[0].equals("/usr/bin/env"))) {
+ (command[0].equals("@TERMUX_PREFIX@/bin/env"))) {
while ((s1 = commandResult.readLine()) != null) {
if (s1.length() >= 11) {
if ((s1.substring(0, 11)).equalsIgnoreCase
diff --git a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
index 38fa3da9ea76..f7dc33afb91a 100644
--- a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
+++ b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
@@ -46,8 +46,8 @@ class PlatformPCSC {
private final static String PROP_NAME = "sun.security.smartcardio.library";
- private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so";
- private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so";
+ private final static String LIB1 = "@TERMUX_PREFIX@/lib/libpcsclite.so";
+ private final static String LIB2 = "@TERMUX_PREFIX@/local/lib/libpcsclite.so";
private final static String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC";
PlatformPCSC() {
diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
index e147cdecaf9b..7a9b9d2706f7 100644
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
@@ -53,7 +53,7 @@ typedef struct symtab {
// should be possible to change this, but in a Java environment there
// is no obvious place to put a user interface to do it. Maybe this
// could be set with an environment variable.
-static const char debug_file_directory[] = "/usr/lib/debug";
+static const char debug_file_directory[] = "@TERMUX_PREFIX@/lib/debug";
/* The CRC used in gnu_debuglink, retrieved from
http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. */
diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
index a4533b101c93..4aefbd7888c2 100644
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
@@ -414,7 +414,7 @@ public class LinuxDebBundler extends LinuxPackageBundler {
final String installDir = LINUX_INSTALL_DIR.fetchFrom(params);
if (!StandardBundlerParam.isRuntimeInstaller(params)
- || (isInstallDirInUsrTree(installDir) || installDir.startsWith("/usr/"))) {
+ || (isInstallDirInUsrTree(installDir) || installDir.startsWith("@TERMUX_PREFIX@/"))) {
debianFiles.add(new DebianFile(
getConfig_CopyrightFile(params),
"resource.copyright-file"));
@@ -446,8 +446,8 @@ public class LinuxDebBundler extends LinuxPackageBundler {
final String packageName = PACKAGE_NAME.fetchFrom(params);
final Path installPath;
- if (isInstallDirInUsrTree(installDir) || installDir.startsWith("/usr/")) {
- installPath = Path.of("/usr/share/doc/", packageName, "copyright");
+ if (isInstallDirInUsrTree(installDir) || installDir.startsWith("@TERMUX_PREFIX@/")) {
+ installPath = Path.of("@TERMUX_PREFIX@/share/doc/", packageName, "copyright");
} else {
installPath = Path.of(installDir, packageName, "share/doc/copyright");
}
diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java
index ce327cd2743c..624452b526e9 100644
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBundler.java
@@ -340,7 +340,7 @@ abstract class LinuxPackageBundler extends AbstractBundler {
}
protected static boolean isInstallDirInUsrTree(String installDir) {
- return Set.of("/usr/local", "/usr").contains(installDir);
+ return Set.of("@TERMUX_PREFIX@/local", "@TERMUX_PREFIX@").contains(installDir);
}
private final BundlerParamInfo<String> packageName;
@@ -368,7 +368,7 @@ abstract class LinuxPackageBundler extends AbstractBundler {
}
return dir;
}
- return "/opt";
+ return "@TERMUX_PREFIX@/opt";
},
(s, p) -> s
);
diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/utils.sh b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/utils.sh
index 1ed96076282c..7673dc0e9b48 100644
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/utils.sh
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/utils.sh
@@ -92,7 +92,7 @@ _uninstall_default_mime_handler ()
#
uninstall_default_mime_handler ()
{
- for f in /usr/share/applications/defaults.list /usr/local/share/applications/defaults.list; do
+ for f in @TERMUX_PREFIX@/share/applications/defaults.list @TERMUX_PREFIX@/local/share/applications/defaults.list; do
_uninstall_default_mime_handler "$f" "$@"
done
}
--
2.44.0