Fixes to the (work in progress) xcircuit installation, and added a
patch file for fixing sky130_fd_pr, created from the patch file in
xschem_sky130 but applied between the build and installation, so
that it does not directly patch the skywater-pdk repository.
diff --git a/common/preproc.py b/common/preproc.py
index 1fca5be..709ea11 100755
--- a/common/preproc.py
+++ b/common/preproc.py
@@ -54,6 +54,7 @@
 #	#endif
 #--------------------------------------------------------------------
 
+import os
 import re
 import sys
 
@@ -500,6 +501,7 @@
     print('Usage: ' + progname + ' input_file [output_file] [-options]')
     print('   Options are:')
     print('      -help         Print this help text.')
+    print('      -quiet        Stop without error if input file is not found.')
     print('      -ccomm        Remove C comments in /* ... */ delimiters.')
     print('      -D<def>       Define word <def> and set its value to 1.')
     print('      -D<def>=<val> Define word <def> and set its value to <val>.')
@@ -532,6 +534,7 @@
     keys = []
     incdirs = []
     ccomm = False
+    quiet = False
     for item in options:
         result = item.split('=')
         if result[0] == '-help':
@@ -539,6 +542,8 @@
             sys.exit(0)
         elif result[0] == '-ccomm':
             ccomm = True
+        elif result[0] == '-quiet':
+            quiet = True
         elif result[0][0:2] == '-I':
             incdirs.append(result[0][2:])
         elif result[0][0:2] == '-D':
@@ -552,16 +557,22 @@
             keys.append(keyword)
             keys = sortkeys(keys)
         else:
-            print('Bad option ' + item + ', options are -help, -ccomm, -D<def> -I<dir>\n')
+            print('Bad option ' + item + ', options are -help, -quiet, -ccomm, -D<def> -I<dir>\n')
             sys.exit(1)
 
+    if not os.path.isfile(inputfile):
+        if not quiet:
+            print("Error:  No input file " + inputfile + " found.")
+        else:
+            sys.exit(0)
+
     if outputfile:
         ofile = open(outputfile, 'w')
     else:
         ofile = sys.stdout
 
     if not ofile:
-        print("Error:  Cannot open file " + output_file + " for writing.")
+        print("Error:  Cannot open file " + outputfile + " for writing.")
         sys.exit(1)
 
     # Sort keys so that if any definition contains another definition, the
diff --git a/common/staging_install.py b/common/staging_install.py
index 3a94d71..22f5e2b 100755
--- a/common/staging_install.py
+++ b/common/staging_install.py
@@ -64,7 +64,7 @@
 
 def filter_recursive(tooldir, stagingdir, localdir):
     # Add any non-ASCII file types here
-    bintypes = ['.gds', '.gds2', '.gdsii', '.png']
+    bintypes = ['.gds', '.gds2', '.gdsii', '.png', '.swp']
 
     if not os.path.exists(tooldir):
         return 0
@@ -74,9 +74,6 @@
     toolfiles = os.listdir(tooldir)
     total = 0
 
-    # Add any non-ASCII 
-    binexts = ['.png']
-
     for file in toolfiles:
         # Do not attempt to do text substitutions on a binary file!
         if os.path.splitext(file)[1] in bintypes:
@@ -609,6 +606,8 @@
                                 os.remove(filepath)
                             elif os.path.splitext(libfile)[1] == '.ext':
                                 os.remove(filepath)
+                            elif os.path.splitext(libfile)[1] == '.swp':
+                                os.remove(filepath)
         else:
             libraries = os.listdir(targetdir + refdir)
             for library in libraries: