sys-process/tini: Apply Flatcar patches

We use a custom build system to remove the cmake dependency and hardcode
relevant configuration.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Flatcar Buildbot 2021-07-23 12:07:12 +00:00 committed by Jeremi Piotrowski
parent 5b4f80d2b2
commit 906e4c99d3
6 changed files with 49 additions and 53 deletions

View File

@ -1,3 +1 @@
DIST tini-0.19.0.tar.gz 32369 BLAKE2B 5d86f6299b92152063974e6ecd347e1a2ba90f0188f2a702ddb6c814fc1c9723062481fe560caa89e9f74883017ee833566adf1eb1f11fe625671eced47f3296 SHA512 1fa85b56e2c6085ea474f251928e7a40510d92aeef60b3c145b0496969c1b5df86835d143cb91ef5b4bf4da63fa8a56947cc39a4276e4b72faa57276d432b292
EBUILD tini-0.19.0-r1.ebuild 1628 BLAKE2B bc6b59ecfd8a47645666d1a5ec5c81c983862bf1de483db88e025fd999821d6756ae871519c26f7492d983b3969681efab2f24e73e9cc60a5ef90ab9302e65c1 SHA512 9c414f7de0bbf666a9880bdec0b402dc036d25e52d4ea9c45bcafed3d0e92911cdd50735d244089cd4d61b3e3c29a50a0fb814dd81fa529322933ec2d6bc4346
MISC metadata.xml 558 BLAKE2B 7fd719d731c968125776805299e964567907ca7cae8a94c717218fdf8caa73d6f333a8bb22c36e0bec273f48504a55f91081e09474abc90440b50bcd760f53aa SHA512 dfbadc5994b3c7b4d8a27fd207c9f1836a21633218dee0252f938448f3c14f3c41d1f35c0604aecbc9f14117b27cd995451800c61dd41875be3becffb53d33f3

View File

@ -0,0 +1,5 @@
This is a fork of gentoo's sys-process/tini package. The sole reason
that this package is in coreos-overlay and not in portage-stable is to
get rid of the build dependency on cmake, which we do not provide. The
build system is replaced with a small autotools setup (see
[files/automake](files/automake)).

View File

@ -0,0 +1 @@
SUBDIRS = src

View File

@ -0,0 +1,12 @@
AC_INIT([tini], [0.1])
AC_PROG_CC
AM_INIT_AUTOMAKE([])
AC_SUBST(tini_VERSION_MAJOR)
AC_SUBST(tini_VERSION_MINOR)
AC_SUBST(tini_VERSION_PATCH)
AC_SUBST(tini_VERSION_GIT)
AC_CONFIG_FILES([Makefile src/Makefile src/tiniConfig.h tpl/VERSION])
AC_OUTPUT

View File

@ -0,0 +1,4 @@
bin_PROGRAMS = tini
tini_SOURCES = tini.c
tini_CFLAGS = -static

View File

@ -1,66 +1,42 @@
# Copyright 1999-2021 Gentoo Authors
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Flatcar: Based on tini-0.18.0.ebuild from commit
# d6c89a5caedbe5cae98142ebb99974b41177aedd in gentoo repo (see
# https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-process/tini/tini-0.18.0.ebuild?id=d6c89a5caedbe5cae98142ebb99974b41177aedd).
EAPI=7
inherit cmake flag-o-matic
# guard against forgetfulness, https://bugs.gentoo.org/795936
GIT_COMMIT_0190="de40ad007797e0dcd8b7126f27bb87401d224240"
GIT_COMMIT="GIT_COMMIT_${PV//./}"
GIT_COMMIT="${!GIT_COMMIT}"
# Flatcar: We provide our autotools-based build system to avoid build
# dependency on cmake. So the settings are hardcoded in the build
# system - we want static binary and a non-minimal build.
inherit autotools
GIT_COMMIT=de40ad007797e0dcd8b7126f27bb87401d224240
DESCRIPTION="A tiny but valid init for containers"
HOMEPAGE="https://github.com/krallin/tini"
SRC_URI="https://github.com/krallin/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm arm64 ppc64 ~x86"
IUSE="+args +static"
# Flatcar: We don't mark arm64 as "testing".
KEYWORDS="amd64 arm64"
# Flatcar: No IUSE on args or on static - it's hardcoded in the build
# system replacement.
src_prepare() {
# Flatcar: We don't use cmake, so all the code handling cmake
# stuff is dropped. Autotools provide the standard configure
# && make && make install build protocol, which Gentoo handles
# out of the box.
for file in configure.ac Makefile.am src/Makefile.am; do
cp "${FILESDIR}/automake/${file}" "${S}/${file}"
done
eapply_user
[[ -z ${GIT_COMMIT} ]] && die "forgetful maintainer! please define GIT_COMMIT_${PV//./} on bump"
cmake_src_prepare
local sed_args=(
# Do not strip binary
-e 's/-Wl,-s")$/")/'
# Remove -Werror and -pedantic-errors in order to allow macro
# redefinition, so that CFLAGS="-U_FORTIFY_SOURCE" does not
# trigger an error due to add_definitions(-D_FORTIFY_SOURCE=2)
# in CMakeLists.txt (bug 626438).
-e "s/ -Werror / /"
-e "s/ -pedantic-errors / /"
)
sed -i "${sed_args[@]}" \
-e "s/git.*status --porcelain.*/true/" \
-e "s/git.*log -n 1.*/true/" \
-e "s/git.\${tini_VERSION_GIT}/git.${GIT_COMMIT}/" \
CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=()
use args || mycmakeargs+=(-DMINIMAL=ON)
cmake_src_configure
}
src_compile() {
append-cflags -DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37
cmake_src_compile
}
src_install() {
cmake_src_install
if use static; then
mv "${ED}"/usr/bin/{${PN}-static,${PN}} || die
else
rm "${ED}"/usr/bin/${PN}-static || die
fi
export tini_VERSION_MAJOR=$(ver_cut 1)
export tini_VERSION_MINOR=$(ver_cut 2)
export tini_VERSION_PATCH=$(ver_cut 3)
export tini_VERSION_GIT=${GIT_COMMIT}
eautoreconf
}