gptfdisk: Build lib for recovery

Change-Id: Ie4b37f7b628b04fa3d2224e1c99b7b08aef5cabe
diff --git a/Android.bp b/Android.bp
index c1a916a..04296f2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -81,6 +81,7 @@
     name: "libgptf",
     defaults: ["gptfdisk_default_flags"],
     host_supported: true,
+    recovery_available: true,
 
     export_include_dirs: ["."],
     srcs: lib_common_srcs + ["diskio-unix.cc"],
@@ -99,3 +100,20 @@
 
     shared_libs: ["libext2_uuid"],
 }
+
+cc_library {
+    name: "libsgdisk",
+    recovery_available: true,
+
+    defaults: ["gptfdisk_default_flags"],
+
+    srcs: [
+        "sgdisk.cc",
+    ],
+    cflags: [
+        "-Dmain=sgdisk_main",
+    ],
+
+    shared_libs: ["libext2_uuid"],
+    static_libs: ["libgptf"],
+}
diff --git a/sgdisk.cc b/sgdisk.cc
index bdd077b..7c26b60 100644
--- a/sgdisk.cc
+++ b/sgdisk.cc
@@ -88,7 +88,7 @@
     return 0;
 }
 
-int main(int argc, char *argv[]) {
+extern "C" int main(int argc, char *argv[]) {
     for (int i = 0; i < argc; i++) {
         if (!strcmp("--android-dump", argv[i])) {
             return android_dump(argv[i + 1]);