diff --git a/cook.sh b/cook.sh
index 6736008f1b853ea05696eb6e9956c860bf883339..68520818abf2fc0c0380bcaf5c71ce049b482cc6 100755
--- a/cook.sh
+++ b/cook.sh
@@ -48,19 +48,41 @@ function op {
             op $1 unfetch
             ;;
         fetch)
-            if [ ! -d build ]
+            if [ -z "$GIT" ]
             then
-                git clone --recursive "$GIT" build
+                if [ ! -f "$(basename "$SRC")" ]
+                then
+                    wget "$SRC"
+                fi
+
+                rm -rf build
+                tar xvf "$(basename "$SRC")"
+                mv "$DIR" build
+	    else
+                if [ ! -d build ]
+                then
+                    git clone --recursive "$GIT" build
+                fi
+
+                pushd build > /dev/null
+                git pull
+                git submodule sync
+                git submodule update --init --recursive
+                popd > /dev/null
+            fi
+
+            if [ -f "patch" ]
+            then
+	        patch -p1 -d build < patch
             fi
 
-            pushd build > /dev/null
-            git pull
-            git submodule sync
-            git submodule update --init --recursive
-            popd > /dev/null
             ;;
         unfetch)
             rm -rfv build
+            if [ ! -z "$SRC" ]
+            then
+                rm -f "$(basename "$SRC")"
+            fi
             ;;
         version)
             pushd build > /dev/null