[packages/dumb-init] add static version, compiled with musl

glen glen at pld-linux.org
Mon Mar 21 20:31:30 CET 2016


commit c850af17b8a2cab380a055f8f45ec29f391c82cc
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Mar 21 21:31:18 2016 +0200

    add static version, compiled with musl

 dumb-init.spec | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/dumb-init.spec b/dumb-init.spec
index e39b02e..e3a5337 100644
--- a/dumb-init.spec
+++ b/dumb-init.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without	static		# don't build static version
+
 Summary:	A minimal init system for Linux containers
 Name:		dumb-init
 Version:	1.0.1
@@ -7,19 +11,42 @@ Group:		Base
 Source0:	https://github.com/Yelp/dumb-init/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	8eb97a95d886a26dfc939adbce0d028c
 URL:		https://github.com/Yelp/dumb-init
+%if %{with static}
+BuildRequires:	glibc-static
+BuildRequires:	musl
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define	_sbindir	/sbin
+%define		_sbindir	/sbin
 
 %description
 dumb-init is a simple process supervisor and init system designed to
 run as PID 1 inside minimal container environments (such as Docker).
 It is a deployed as a small, statically-linked binary written in C.
 
+%package static
+Summary:	A minimal init system for Linux containers (static)
+Group:		Base
+
+%description static
+dumb-init is a simple process supervisor and init system designed to
+run as PID 1 inside minimal container environments (such as Docker).
+It is a deployed as a small, statically-linked binary written in C.
+
+This package contains statically linked version of dumb-init.
+
 %prep
 %setup -q
 
 %build
+%if %{with static}
+%{__make} \
+	CC="musl-gcc" \
+	CFLAGS="%{rpmcflags} -std=gnu99 -Wall -Werror"
+mv dumb-init dumb-init-static
+%{__make} clean
+%endif
+
 %{__make} \
 	CC="%{__cc}" \
 	CFLAGS="%{rpmcflags} -std=gnu99 -Wall -Werror"
@@ -28,6 +55,9 @@ It is a deployed as a small, statically-linked binary written in C.
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_sbindir}
 install -p dumb-init $RPM_BUILD_ROOT%{_sbindir}
+%if %{with static}
+install -p dumb-init-static $RPM_BUILD_ROOT%{_sbindir}
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -36,3 +66,10 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc README.md LICENSE
 %attr(755,root,root) %{_sbindir}/dumb-init
+
+%if %{with static}
+%files static
+%defattr(644,root,root,755)
+%doc README.md LICENSE
+%attr(755,root,root) %{_sbindir}/dumb-init-static
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dumb-init.git/commitdiff/c850af17b8a2cab380a055f8f45ec29f391c82cc



More information about the pld-cvs-commit mailing list