diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # cpkg
 
+## 0.1.3.0
+
+  * Add ability to patch libraries
+
 ## 0.1.2.1
 
   * Add `--global` flag
diff --git a/cpkg.cabal b/cpkg.cabal
--- a/cpkg.cabal
+++ b/cpkg.cabal
@@ -1,6 +1,6 @@
 cabal-version: 1.18
 name: cpkg
-version: 0.1.2.1
+version: 0.1.3.0
 license: BSD3
 license-file: LICENSE
 copyright: Copyright: (c) 2018-2019 Vanessa McHale
@@ -16,6 +16,7 @@
     dhall/cpkg-prelude.dhall
     dhall/cpkg-types.dhall
     pkgs/pkg-set.dhall
+    pkgs/patches/*.patch
 extra-doc-files: README.md
                  CHANGELOG.md
 
diff --git a/dhall/cpkg-prelude.dhall b/dhall/cpkg-prelude.dhall
--- a/dhall/cpkg-prelude.dhall
+++ b/dhall/cpkg-prelude.dhall
@@ -159,6 +159,11 @@
   types.Command.Write
 in
 
+let patch =
+  λ(x : Text) →
+    types.Command.Patch { patchContents = x }
+in
+
 let defaultEnv =
   None (List types.EnvVar)
 in
@@ -1171,4 +1176,5 @@
 , isX64               = isX64
 , configWithEnv       = configWithEnv
 , buildEnv            = buildEnv
+, patch               = patch
 }
diff --git a/dhall/cpkg-types.dhall b/dhall/cpkg-types.dhall
--- a/dhall/cpkg-types.dhall
+++ b/dhall/cpkg-types.dhall
@@ -103,6 +103,7 @@
               | Symlink : { tgt : Text, linkName : Text }
               | Write : { file : Text, contents : Text }
               | CopyFile : { src : Text, dest : Text }
+              | Patch : { patchContents : Text }
               >
 in
 
diff --git a/pkgs/patches/xextproto.patch b/pkgs/patches/xextproto.patch
new file mode 100644
--- /dev/null
+++ b/pkgs/patches/xextproto.patch
@@ -0,0 +1,11 @@
+--- config.sub	2019-04-27 17:01:47.137694014 -0500
++++ config.sub	2019-04-27 17:02:05.329622757 -0500
+@@ -249,7 +249,7 @@
+ 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ 	| am33_2.0 \
+-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
++	| arc | aarch64 | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ 	| bfin \
+ 	| c4x | clipper \
+ 	| d10v | d30v | dlx | dsp16xx \
diff --git a/pkgs/patches/xproto.patch b/pkgs/patches/xproto.patch
new file mode 100644
--- /dev/null
+++ b/pkgs/patches/xproto.patch
@@ -0,0 +1,11 @@
+--- config.sub	2019-04-27 16:40:36.266089495 -0500
++++ config.sub	2019-04-27 16:41:44.593275058 -0500
+@@ -240,7 +240,7 @@
+ 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ 	| am33_2.0 \
+-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++	| arc | aarch64 | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ 	| bfin \
+ 	| c4x | clipper \
+ 	| d10v | d30v | dlx | dsp16xx \
diff --git a/pkgs/pkg-set.dhall b/pkgs/pkg-set.dhall
--- a/pkgs/pkg-set.dhall
+++ b/pkgs/pkg-set.dhall
@@ -1035,8 +1035,20 @@
       { pkgUrl = "https://www.x.org/releases/individual/proto/${name}-${prelude.showVersion v}.tar.bz2" }
 in
 
+let mkXProtoWithPatch =
+  λ(name : Text) →
+  λ(patch : Text) →
+  λ(v : List Natural) →
+    mkXProto name v ⫽
+      { configureCommand =
+          λ(cfg : types.BuildVars) →
+            [ prelude.patch patch ]
+              # prelude.defaultConfigure cfg
+      }
+in
+
 let xproto =
-  mkXProto "xproto"
+  mkXProtoWithPatch "xproto" (./patches/xproto.patch as Text)
 in
 
 let renderproto =
@@ -1829,7 +1841,7 @@
 in
 
 let xextproto =
-  mkXProto "xextproto"
+  mkXProtoWithPatch "xextproto" (./patches/xextproto.patch as Text)
 in
 
 let fixesproto =
diff --git a/src/Package/C/Build.hs b/src/Package/C/Build.hs
--- a/src/Package/C/Build.hs
+++ b/src/Package/C/Build.hs
@@ -61,6 +61,9 @@
     putDiagnostic ("Copying file " ++ absSrc ++ " to " ++ absDest ++ "...")
     liftIO $ createDirectoryIfMissing True (takeDirectory absDest)
     liftIO $ copyFileWithMetadata absSrc absDest
+stepToProc dir' _ (Patch contents) = do
+    liftIO $ TIO.writeFile (dir' </> "step.patch") contents
+    waitProcess $ (proc "patch" ["-i", "step.patch"]) { cwd = Just dir' }
 
 processSteps :: (Traversable t)
              => FilePath -- ^ Build directory
diff --git a/src/Package/C/Dhall/Type.hs b/src/Package/C/Dhall/Type.hs
--- a/src/Package/C/Dhall/Type.hs
+++ b/src/Package/C/Dhall/Type.hs
@@ -47,6 +47,7 @@
              | Symlink { tgt :: T.Text, linkName :: T.Text }
              | Write { contents :: T.Text, file :: T.Text }
              | CopyFile { src :: T.Text, dest :: T.Text }
+             | Patch { patchContents :: T.Text }
              deriving (Generic, Interpret)
 
 data CPkg = CPkg { pkgName          :: T.Text
diff --git a/src/Package/C/Type.hs b/src/Package/C/Type.hs
--- a/src/Package/C/Type.hs
+++ b/src/Package/C/Type.hs
@@ -39,6 +39,7 @@
              | Symlink { tgt :: String, linkName :: String }
              | Write { contents :: T.Text, file :: FilePath }
              | CopyFile { src :: FilePath, dest :: FilePath }
+             | Patch { patchContents :: T.Text }
              deriving (Eq, Ord, Generic, Binary, Hashable)
 
 -- TODO: build script should take OS as an argument?
@@ -66,6 +67,7 @@
 commandDhallToCommand (Dhall.Write out fp)        = Write out (T.unpack fp)
 commandDhallToCommand (Dhall.CopyFile src' dest') = CopyFile (T.unpack src') (T.unpack dest')
 commandDhallToCommand (Dhall.Symlink t l)         = Symlink (T.unpack t) (T.unpack l)
+commandDhallToCommand (Dhall.Patch c)             = Patch c
 
 buildVarsToDhallBuildVars :: BuildVars -> Dhall.BuildVars
 buildVarsToDhallBuildVars (BuildVars dir' cd tgt' cross incls prelds shr lds bins os' arch' sta nproc) = Dhall.BuildVars (T.pack dir') (T.pack cd) tgt' cross (T.pack <$> incls) (T.pack <$> prelds) (T.pack <$> shr) (T.pack <$> lds) (T.pack <$> bins) os' arch' sta (fromIntegral nproc)
