Add share library `libapfv6` and `libapfbuf`

Separate the test_buf_allocator.c/h to individual `libapfbuf`.
This will be used for `libapfv6jni` in the follow-up CL.

Bug: 391118179
Test: atest NetworkStackTests
Change-Id: Ifbf9490d5152a22df8bee8d5a789bbf160557d70
diff --git a/Android.bp b/Android.bp
index 6a042a4..ba62ebb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -50,6 +50,15 @@
     sdk_version: "24",
 }
 
+cc_library_static {
+    name: "libapfbuf",
+    defaults: ["apf_defaults"],
+    srcs: [
+        "v7/test_buf_allocator.c",
+    ],
+    sdk_version: "24",
+}
+
 cc_binary_host {
     name: "apf_disassembler",
     defaults: ["apf_defaults"],
diff --git a/v6/Android.bp b/v6/Android.bp
new file mode 100644
index 0000000..405ddef
--- /dev/null
+++ b/v6/Android.bp
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2025 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+    default_applicable_licenses: ["hardware_google_apf_license"],
+}
+
+cc_defaults {
+    name: "apfv6_defaults",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Werror=implicit-fallthrough",
+        "-Werror=missing-prototypes",
+        "-Werror=strict-prototypes",
+        "-Wnullable-to-nonnull-conversion",
+        "-Wsign-compare",
+        "-Wsign-conversion",
+        "-Wthread-safety",
+        "-Wunused-parameter",
+        "-Wuninitialized",
+    ],
+}
+
+cc_library_static {
+    name: "libapf_v6",
+    defaults: ["apfv6_defaults"],
+    static_libs: [
+        "libapfbuf",
+    ],
+    srcs: [
+        "apf_interpreter.c",
+    ],
+    sdk_version: "24",
+}
diff --git a/v7/Android.bp b/v7/Android.bp
index 1277aaf..6ddfcd7 100644
--- a/v7/Android.bp
+++ b/v7/Android.bp
@@ -39,9 +39,11 @@
 cc_library_static {
     name: "libapf_v7",
     defaults: ["apfv7_defaults"],
+    static_libs: [
+        "libapfbuf",
+    ],
     srcs: [
         "apf_interpreter.c",
-        "test_buf_allocator.c",
     ],
     sdk_version: "24",
 }