blob: cfd6b3d26f955c38e24effa4f3e6cb5f0eae3f5f [file] [log] [blame]
# 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")
group("all") {
deps = [ ":libcontainer" ]
if (use.test) {
deps += [ ":libcontainer_test" ]
}
}
pkg_config("target_defaults") {
pkg_deps = [
"libchrome",
"libminijail",
]
defines = [ "USE_device_mapper=${use.device_mapper}" ]
if (use.device_mapper) {
pkg_deps += [ "devmapper" ]
}
}
shared_library("libcontainer") {
configs += [ ":target_defaults" ]
sources = [
"cgroup.cc",
"config.cc",
"container.cc",
"libcontainer.cc",
"libcontainer_util.cc",
]
}
if (use.test) {
pkg_config("test_config") {
pkg_deps = [ "libchrome-test" ]
}
executable("libcontainer_test") {
configs += [
# //common-mk:test should be at the top. crbug.com/887845
# TODO(crbug.com/887845): Remove this note after library order issue is resolved.
"//common-mk:test",
":target_defaults",
":test_config",
]
sources = [
"cgroup.cc",
"cgroup_test.cc",
"config.cc",
"container.cc",
"libcontainer.cc",
"libcontainer_test.cc",
"libcontainer_util.cc",
]
defines = [ "UNIT_TEST" ]
ldflags = [
"-Wl,-wrap=chmod",
"-Wl,-wrap=chown",
"-Wl,-wrap=getuid",
"-Wl,-wrap=kill",
"-Wl,-wrap=mkdir",
"-Wl,-wrap=mkdtemp",
"-Wl,-wrap=mount",
"-Wl,-wrap=rmdir",
"-Wl,-wrap=setns",
"-Wl,-wrap=umount",
"-Wl,-wrap=umount2",
"-Wl,-wrap=unlink",
"-Wl,-wrap=__xmknod",
"-Wl,-wrap=__xstat",
]
deps = [ "//common-mk/testrunner" ]
}
}