Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
minijail ebuild
diff --git a/Makefile b/Makefile
index 54ee978..a50ee9a 100644
--- a/Makefile
+++ b/Makefile
@@ -46,8 +46,8 @@ ifeq ($(USE_SYSTEM_GTEST),no)
GTEST_CXXFLAGS := -std=gnu++14
GTEST_LIBS := gtest.a
else
-GTEST_CXXFLAGS := $(shell gtest-config --cxxflags)
-GTEST_LIBS := $(shell gtest-config --libs)
+GTEST_CXXFLAGS ?= $(shell gtest-config --cxxflags)
+GTEST_LIBS ?= $(shell gtest-config --libs)
endif
CORE_OBJECT_FILES := libminijail.o syscall_filter.o signal_handler.o \
@@ -73,6 +73,7 @@ clean: CLEAN(minijail0)
CC_LIBRARY(libminijail.so): LDLIBS += -lcap
+CC_LIBRARY(libminijail.so): LDFLAGS += -Wl,-soname,libminijail.so
CC_LIBRARY(libminijail.so): $(CORE_OBJECT_FILES)
clean: CLEAN(libminijail.so)
@@ -91,6 +92,7 @@ TEST(CXX_BINARY(libminijail_unittest)): CC_LIBRARY(libminijailpreload.so)
CC_LIBRARY(libminijailpreload.so): LDLIBS += -lcap -ldl
+CC_LIBRARY(libminijailpreload.so): LDFLAGS += -Wl,-soname,libminijail.so
CC_LIBRARY(libminijailpreload.so): libminijailpreload.o $(CORE_OBJECT_FILES)
clean: CLEAN(libminijailpreload.so)
diff --git a/common.mk b/common.mk
index 77879d8..1cd815b 100644
--- a/common.mk
+++ b/common.mk
@@ -323,7 +323,7 @@ COMMON_CFLAGS := -Wall -Wunused -Wno-unused-parameter -Werror -Wformat=2 \
-fno-strict-aliasing $(SSP_CFLAGS) -O1
CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER)) -std=gnu++14
CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER)) -std=gnu11
-CPPFLAGS += -D_FORTIFY_SOURCE=2
+CPPFLAGS +=
# Enable large file support.
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
# Copyright 2019 Sony Interactive Entertainment Inc.
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="helper binary and library for sandboxing & restricting privs of service"
HOMEPAGE="https://android.googlesource.com/platform/external/minijail"
SRC_URI="https://github.com/google/${PN}/archive/linux-v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="+seccomp test"
RDEPEND="sys-libs/libcap-ng"
DEPEND="${RDEPEND}
test? (
virtual/pkgconfig
dev-cpp/gtest:=
dev-cpp/gmock:=
)"
S="${WORKDIR}/${PN}-linux-v${PV}"
PATCHES=(
"${FILESDIR}/minijail-9-makefile.patch"
)
src_configure() {
export LIBDIR="/usr/$(get_libdir)"
export USE_seccomp="$(usex seccomp)"
export USE_SYSTEM_GTEST=yes
export GTEST_CXXFLAGS="$(pkg-config --cflags gtest_main)"
export GTEST_LIBS="$(pkg-config --libs gtest_main)"
}
src_compile() {
emake all parse_seccomp_policy
}
src_test() {
emake tests
}
src_install() {
dosbin minijail0
dolib.so libminijail{,preload}.so
dobin parse_seccomp_policy
doman minijail0.[15]
local include_dir="/usr/include"
"${S}"/platform2_preinstall.sh "${PV}" "${include_dir}"
insinto "/usr/$(get_libdir)/pkgconfig"
doins libminijail.pc
insinto "${include_dir}"
doins libminijail.h
doins scoped_minijail.h
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment