diff --git a/Superuser/build.xml b/Superuser/build.xml
index d85611b..9355978 100644
--- a/Superuser/build.xml
+++ b/Superuser/build.xml
@@ -68,41 +68,6 @@
     -->
     <import file="custom_rules.xml" optional="true" />
 
-    <target name="-pre-build">
-        <exec executable="${ndk.dir}/${ndk.executable}" failonerror="true">
-          <arg value="-j8" />
-        </exec>
-    </target>
-
-    <target name="clean" depends="android_rules.clean">
-        <exec executable="${ndk.dir}/${ndk.executable}" failonerror="true">
-            <arg value="clean"/>
-        </exec>
-        <delete file="bin/update.zip"/>
-        <delete file="bin/Superuser.apk"/>
-        <delete dir="bin/META-INF" />
-    </target>
-
-    <target name="-post-build">
-        <mkdir dir="bin/recoveryzip/META-INF/com/google/android" />
-        <copy file="assets/update-binary" tofile="bin/recoveryzip/META-INF/com/google/android/update-binary"/>
-        <copy file="assets/install-recovery.sh" tofile="bin/recoveryzip/install-recovery.sh"/>
-        <copy file="bin/Superuser-release.apk" tofile="bin/recoveryzip/Superuser.apk"/>
-
-        <exec executable="zip" failonerror="true" dir="bin/recoveryzip">
-          <arg value="-ry"/>
-          <arg value="../update.zip"/>
-          <arg value="."/>
-        </exec>
-        <exec executable="zip" failonerror="true" dir="libs">
-          <arg value="-ry"/>
-          <arg value="../bin/update.zip"/>
-          <arg value="armeabi"/>
-          <arg value="x86"/>
-          <arg value="mips"/>
-        </exec>
-    </target>
-
     <!-- Import the actual build file.
 
          To customize existing targets, there are two options:
@@ -123,5 +88,30 @@
     -->
     <!-- version-tag: 1 -->
     <import file="${sdk.dir}/tools/ant/build.xml" />
+    <target name="-package-resources" depends="-crunch">
+	  <do-only-if-not-library elseText="Library project: do not package resources..." >
+              <exec executable="${aapt}" failonerror="true">
+  			<arg value="package" />
+  			<arg value="-f" />
+  			<arg value="-M" />
+  			<arg path="AndroidManifest.xml" />
+			<arg value="-A" />
+			<arg path="${asset.absolute.dir}" />
+ 			<arg value="-F" />
+			<arg path="${out.absolute.dir}/${resource.package.file.name}" />
+ 			<arg value="-I" />
+			<arg path="${android.jar}" />
+  			<arg value="-S" />
+			<arg path="${resource.absolute.dir}" />
+			<arg value="-S" />
+			<arg path="${android.library.reference.1}/res" />
+ 			<arg value="--extra-packages" />
+			<arg value="com.koushikdutta.widgets" />
+  			<arg value="--auto-add-overlay" />
+  			<arg value="--rename-manifest-package" />
+  			<arg value="org.fdroid.superuser" />
+		</exec>
+	  </do-only-if-not-library>
+   </target>
 
 </project>