diff -uNr tigervnc-1.9.0/unix/vncserver tigervnc-1.9.0.mod/unix/vncserver
--- tigervnc-1.9.0/unix/vncserver	2018-07-16 17:08:55.000000000 +0300
+++ tigervnc-1.9.0.mod/unix/vncserver	2018-09-12 11:14:21.786323593 +0300
@@ -51,7 +51,7 @@
 $vncUserDir = "$ENV{HOME}/.vnc";
 $vncUserConfig = "$vncUserDir/config";
 
-$vncSystemConfigDir = "/etc/tigervnc";
+$vncSystemConfigDir = "@TERMUX_PREFIX@/etc/tigervnc";
 $vncSystemConfigDefaultsFile = "$vncSystemConfigDir/vncserver-config-defaults";
 $vncSystemConfigMandatoryFile = "$vncSystemConfigDir/vncserver-config-mandatory";
 
@@ -60,7 +60,7 @@
 
 $xstartupFile = $vncUserDir . "/xstartup";
 $defaultXStartup
-    = ("#!/bin/sh\n\n".
+    = ("#!@TERMUX_PREFIX@/bin/sh\n\n".
        "unset SESSION_MANAGER\n".
        "unset DBUS_SESSION_BUS_ADDRESS\n".
        "OS=`uname -s`\n".
@@ -74,11 +74,11 @@
        "      ;;\n".
        "  esac\n".
        "fi\n".
-       "if [ -x /etc/X11/xinit/xinitrc ]; then\n".
-       "  exec /etc/X11/xinit/xinitrc\n".
+       "if [ -x @TERMUX_PREFIX@/etc/X11/xinit/xinitrc ]; then\n".
+       "  exec @TERMUX_PREFIX@/etc/X11/xinit/xinitrc\n".
        "fi\n".
-       "if [ -f /etc/X11/xinit/xinitrc ]; then\n".
-       "  exec sh /etc/X11/xinit/xinitrc\n".
+       "if [ -f @TERMUX_PREFIX@/etc/X11/xinit/xinitrc ]; then\n".
+       "  exec sh @TERMUX_PREFIX@/etc/X11/xinit/xinitrc\n".
        "fi\n".
        "[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
        "xsetroot -solid grey\n".
@@ -98,15 +98,15 @@
 
 chop($host = `uname -n`);
 
-if (-d "/etc/X11/fontpath.d") {
-    $fontPath = "catalogue:/etc/X11/fontpath.d";
+if (-d "@TERMUX_PREFIX@/etc/X11/fontpath.d") {
+    $fontPath = "catalogue:@TERMUX_PREFIX@/etc/X11/fontpath.d";
 }
 
-@fontpaths = ('/usr/share/X11/fonts', '/usr/share/fonts', '/usr/share/fonts/X11/');
-if (! -l "/usr/lib/X11") {push(@fontpaths, '/usr/lib/X11/fonts');}
-if (! -l "/usr/X11") {push(@fontpaths, '/usr/X11/lib/X11/fonts');}
-if (! -l "/usr/X11R6") {push(@fontpaths, '/usr/X11R6/lib/X11/fonts');}
-push(@fontpaths, '/usr/share/fonts/default');
+@fontpaths = ('@TERMUX_PREFIX@/share/X11/fonts', '@TERMUX_PREFIX@/share/fonts', '@TERMUX_PREFIX@/share/fonts/X11/');
+if (! -l "@TERMUX_PREFIX@/lib/X11") {push(@fontpaths, '@TERMUX_PREFIX@/lib/X11/fonts');}
+if (! -l "@TERMUX_PREFIX@/X11") {push(@fontpaths, '@TERMUX_PREFIX@X11/lib/X11/fonts');}
+if (! -l "@TERMUX_PREFIX@/X11R6") {push(@fontpaths, '@TERMUX_PREFIX@/X11R6/lib/X11/fonts');}
+push(@fontpaths, '@TERMUX_PREFIX@/share/fonts/default');
 
 @fonttypes = ('misc',
              '75dpi',
@@ -404,8 +404,8 @@
 # If the unix domain socket exists then use that (DISPLAY=:n) otherwise use
 # TCP (DISPLAY=host:n)
 
-if (-e "/tmp/.X11-unix/X$displayNumber" ||
-    -e "/usr/spool/sockets/X11/$displayNumber")
+if (-e "@TERMUX_PREFIX@/tmp/.X11-unix/X$displayNumber" ||
+    -e "@TERMUX_PREFIX@/spool/sockets/X11/$displayNumber")
 {
     $ENV{DISPLAY}= ":$displayNumber";
 } else {
@@ -546,21 +546,21 @@
     }
     close(S);
 
-    if (-e "/tmp/.X$n-lock") {
-	warn "\nWarning: $host:$n is taken because of /tmp/.X$n-lock\n";
+    if (-e "@TERMUX_PREFIX@/tmp/.X$n-lock") {
+	warn "\nWarning: $host:$n is taken because of @TERMUX_PREFIX@/tmp/.X$n-lock\n";
 	warn "Remove this file if there is no X server $host:$n\n";
 	return 0;
     }
 
-    if (-e "/tmp/.X11-unix/X$n") {
-	warn "\nWarning: $host:$n is taken because of /tmp/.X11-unix/X$n\n";
+    if (-e "@TERMUX_PREFIX@/tmp/.X11-unix/X$n") {
+	warn "\nWarning: $host:$n is taken because of @TERMUX_PREFIX@/tmp/.X11-unix/X$n\n";
 	warn "Remove this file if there is no X server $host:$n\n";
 	return 0;
     }
 
-    if (-e "/usr/spool/sockets/X11/$n") {
+    if (-e "@TERMUX_PREFIX@/spool/sockets/X11/$n") {
 	warn("\nWarning: $host:$n is taken because of ".
-             "/usr/spool/sockets/X11/$n\n");
+             "@TERMUX_PREFIX@/spool/sockets/X11/$n\n");
 	warn "Remove this file if there is no X server $host:$n\n";
 	return 0;
     }
@@ -760,15 +760,15 @@
 	warn "Xvnc process ID $pid already killed\n";
 	$opt{'-kill'} =~ s/://;
 
-	if (-e "/tmp/.X11-unix/X$opt{'-kill'}") {
+	if (-e "@TERMUX_PREFIX@/tmp/.X11-unix/X$opt{'-kill'}") {
 	    print "Xvnc did not appear to shut down cleanly.";
-	    print " Removing /tmp/.X11-unix/X$opt{'-kill'}\n";
-	    unlink "/tmp/.X11-unix/X$opt{'-kill'}";
+	    print " Removing @TERMUX_PREFIX@/tmp/.X11-unix/X$opt{'-kill'}\n";
+	    unlink "@TERMUX_PREFIX@/tmp/.X11-unix/X$opt{'-kill'}";
 	}
-	if (-e "/tmp/.X$opt{'-kill'}-lock") {
+	if (-e "@TERMUX_PREFIX@/tmp/.X$opt{'-kill'}-lock") {
 	    print "Xvnc did not appear to shut down cleanly.";
-	    print " Removing /tmp/.X$opt{'-kill'}-lock\n";
-	    unlink "/tmp/.X$opt{'-kill'}-lock";
+	    print " Removing @TERMUX_PREFIX@/tmp/.X$opt{'-kill'}-lock\n";
+	    unlink "@TERMUX_PREFIX@/tmp/.X$opt{'-kill'}-lock";
 	}
     }
 
