aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-10-19 20:44:29 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-10-19 20:44:29 +0000
commitc873da6b0a40d3ea4ef36d8614fe79a0d7148187 (patch)
tree9707da36d7fe39311587e84491323f05f1919d6c
parentfdff8b5aef9eb05479dc741a3f7b2ddb3b3208d7 (diff)
parente202288746d3517d8abcfae0ed11c000e96cc3b0 (diff)
downloadpuffin-c873da6b0a40d3ea4ef36d8614fe79a0d7148187.tar.gz
Merge "puffin: Migrate to BUILD.gn from puffin.gyp"
-rw-r--r--BUILD.gn146
-rw-r--r--puffin.gyp177
2 files changed, 146 insertions, 177 deletions
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..f6df14b
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,146 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//common-mk/pkg_config.gni")
+import("//common-mk/proto_library.gni")
+
+group("all") {
+ deps = [
+ ":libpuffin-proto",
+ ":libpuffdiff",
+ ":libpuffpatch",
+ ":puffin",
+ ]
+ if (use.test) {
+ deps += [ ":puffin_test" ]
+ }
+ if (use.fuzzer) {
+ deps += [ ":puffin_fuzzer" ]
+ }
+}
+
+pkg_config("target_defaults") {
+ pkg_deps = [
+ "libchrome-${libbase_ver}",
+ "libbrillo-${libbase_ver}",
+ "protobuf-lite",
+ ]
+ cflags = [ "-Wextra" ]
+ cflags_cc = [ "-Wnon-virtual-dtor" ]
+ include_dirs = [ "src/include" ]
+ defines = [
+ "USE_BRILLO",
+ "_FILE_OFFSET_BITS=64",
+ ]
+}
+
+proto_library("libpuffin-proto") {
+ proto_in_dir = "src"
+ proto_out_dir = "include/puffin/src"
+ sources = [
+ "src/puffin.proto",
+ ]
+}
+
+pkg_config("libpuffpatch_config") {
+ pkg_deps = [
+ "libbspatch",
+ ]
+}
+
+static_library("libpuffpatch") {
+ configs += [
+ "//common-mk:nouse_thin_archive",
+ ":target_defaults",
+ ":libpuffpatch_config",
+ ]
+ configs -= [ "//common-mk:use_thin_archive" ]
+ complete_static_lib = true
+ deps = [ ":libpuffin-proto" ]
+ sources = [
+ "src/bit_reader.cc",
+ "src/bit_writer.cc",
+ "src/huffer.cc",
+ "src/huffman_table.cc",
+ "src/puff_reader.cc",
+ "src/puff_writer.cc",
+ "src/puffer.cc",
+ "src/puffin_stream.cc",
+ "src/puffpatch.cc",
+ ]
+}
+
+pkg_config("libpuffdiff_config") {
+ pkg_deps = [
+ "libbsdiff",
+ ]
+}
+static_library("libpuffdiff") {
+ configs += [
+ "//common-mk:nouse_thin_archive",
+ ":target_defaults",
+ ":libpuffdiff_config",
+ ]
+ configs -= [ "//common-mk:use_thin_archive" ]
+ deps = [
+ ":libpuffpatch",
+ ]
+ sources = [
+ "src/file_stream.cc",
+ "src/memory_stream.cc",
+ "src/puffdiff.cc",
+ "src/utils.cc",
+ ]
+}
+
+executable("puffin") {
+ configs += [
+ ":target_defaults",
+ ]
+ deps = [
+ ":libpuffdiff",
+ ]
+ sources = [
+ "src/extent_stream.cc",
+ "src/main.cc",
+ ]
+}
+
+if (use.test) {
+ executable("puffin_test") {
+ configs += [
+ "//common-mk:test",
+ ":target_defaults",
+ ]
+ sources = [
+ "src/bit_io_unittest.cc",
+ "src/extent_stream.cc",
+ "src/patching_unittest.cc",
+ "src/puff_io_unittest.cc",
+ "src/puffin_unittest.cc",
+ "src/stream_unittest.cc",
+ "src/unittest_common.cc",
+ "src/utils_unittest.cc",
+ ]
+ deps = [
+ "//common-mk/testrunner",
+ ":libpuffdiff",
+ ]
+ }
+}
+
+if (use.fuzzer) {
+ executable("puffin_fuzzer") {
+ configs += [
+ "//common-mk/common_fuzzer",
+ ":target_defaults",
+ ]
+ deps = [
+ ":libpuffdiff",
+ ]
+ sources = [
+ "src/fuzzer.cc",
+ ]
+ }
+}
diff --git a/puffin.gyp b/puffin.gyp
deleted file mode 100644
index 6234766..0000000
--- a/puffin.gyp
+++ /dev/null
@@ -1,177 +0,0 @@
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'target_defaults': {
- 'variables': {
- 'deps': [
- 'libbrillo-<(libbase_ver)',
- 'libchrome-<(libbase_ver)',
- ],
- },
- 'cflags': [
- '-Wextra',
- ],
- 'cflags_cc': [
- '-Wnon-virtual-dtor',
- ],
- 'include_dirs': [
- 'src/include',
- ],
- 'defines': [
- 'USE_BRILLO=1',
- '_FILE_OFFSET_BITS=64',
- ],
- },
- 'targets': [
- # libpuffin-proto library
- {
- 'target_name': 'libpuffin-proto',
- 'type': 'static_library',
- 'variables': {
- 'proto_in_dir': 'src',
- 'proto_out_dir': 'include/puffin/src',
- },
- 'cflags!': ['-fPIE'],
- 'cflags': ['-fPIC'],
- 'all_dependent_settings': {
- 'variables': {
- 'deps': [
- 'protobuf-lite',
- ],
- },
- },
- 'sources': [
- '<(proto_in_dir)/puffin.proto',
- ],
- 'includes': ['../../platform2/common-mk/protoc.gypi'],
- },
- # puffpatch static library. The reason to do one static and one shared is to
- # be able to run the unittest.
- {
- 'target_name': 'libpuffpatch-static',
- 'type': 'static_library',
- 'cflags!': ['-fPIE'],
- 'cflags': ['-fPIC'],
- 'sources': [
- 'src/bit_reader.cc',
- 'src/bit_writer.cc',
- 'src/huffer.cc',
- 'src/huffman_table.cc',
- 'src/puff_reader.cc',
- 'src/puff_writer.cc',
- 'src/puffer.cc',
- 'src/puffin_stream.cc',
- 'src/puffpatch.cc',
- ],
- 'dependencies': [
- 'libpuffin-proto',
- ],
- 'all_dependent_settings': {
- 'link_settings': {
- 'libraries': [
- '-lbspatch',
- ],
- },
- },
- },
- # puffdiff static library.
- {
- 'target_name': 'libpuffdiff-static',
- 'type': 'static_library',
- 'cflags!': ['-fPIE'],
- 'cflags': ['-fPIC'],
- 'sources': [
- 'src/file_stream.cc',
- 'src/memory_stream.cc',
- 'src/puffdiff.cc',
- 'src/utils.cc',
- ],
- 'dependencies': [
- 'libpuffpatch-static',
- ],
- 'all_dependent_settings': {
- 'link_settings': {
- 'libraries': [
- '-lbsdiff',
- ],
- },
- },
- },
- # puffpatch shared library.
- {
- 'target_name': 'libpuffpatch',
- 'type': 'shared_library',
- 'dependencies': [
- 'libpuffpatch-static',
- ],
- },
- # puffdiff shared library.
- {
- 'target_name': 'libpuffdiff',
- 'type': 'shared_library',
- 'dependencies': [
- 'libpuffdiff-static',
- ],
- },
- # Puffin executable. We don't use the shared libraries because then we have
- # to export symbols that shouldn't be exported otherwise.
- {
- 'target_name': 'puffin',
- 'type': 'executable',
- 'dependencies': [
- 'libpuffdiff-static',
- ],
- 'sources': [
- 'src/extent_stream.cc',
- 'src/main.cc',
- ],
- },
- ],
- # unit tests.
- 'conditions': [
- ['USE_test == 1', {
- 'targets': [
- # Unit tests.
- {
- 'target_name': 'puffin_unittest',
- 'type': 'executable',
- 'dependencies': [
- 'libpuffdiff-static',
- '../../platform2/common-mk/testrunner.gyp:testrunner',
- ],
- 'includes': ['../../platform2/common-mk/common_test.gypi'],
- 'sources': [
- 'src/bit_io_unittest.cc',
- 'src/extent_stream.cc',
- 'src/patching_unittest.cc',
- 'src/puff_io_unittest.cc',
- 'src/puffin_unittest.cc',
- 'src/stream_unittest.cc',
- 'src/unittest_common.cc',
- 'src/utils_unittest.cc',
- ],
- },
- ],
- }],
- # fuzzer target
- ['USE_fuzzer == 1', {
- 'targets': [
- {
- 'target_name': 'puffin_fuzzer',
- 'type': 'executable',
- 'dependencies': [
- 'libpuffin-proto',
- 'libpuffdiff-static',
- 'libpuffpatch-static',
- ],
- 'includes': ['../../platform2/common-mk/common_fuzzer.gypi'],
- 'sources': [
- 'src/fuzzer.cc',
- ],
- },
- ],
- }],
- ],
-}