Hello Craig. On Thu, Jan 07, 2016 at 09:17:41AM +1100, Craig Small wrote: [...] > What other packages will procps-base depend on? > libc6 and libprocps5. libprocps would be newly pulled in. [...]
I was thinking that maybe it might be a good idea to possibly avoid this dependency. That would allow us to keep essential out of any upcoming libprocps transition, keep essential minimal, etc.... The idea is simply to build a static version of pidof and strip out the unused parts of libprocps.a, made possible by building the lib with -ffunction-section -fdata-sections and linking with -Wl,--gc-sections. The attached patch does this. (Then just install pidof.static instead of pidof in the base package and discard pidof.) The end result is 34896 bytes for pidof.static (ie. approx 20k growth to avoid the libprocps5 dependency). (While also growing the libprocps.a for the extra sections, but I don't see how that would affect anything.) Things would be even better if we could somehow also avoid libsystemd0 dependency. It's already a dependency of essential packages (via atleast util-linux) but just for the sake of not having to discuss it... Not sure if it's worth implementing a double build-pass (with/without libsystemd enabled) just for pidof though. Maybe there's a simpler way or maybe we just leave it as is.... (Fwiw, the upstream util-linux build system supports building static versions for basically all utilities which has proven handy in a couple of occations. You might want to have a look there if you're interested in an example of a tidier build system example.) Do you have any thoughts on this? HTH. Regards, Andreas Henriksson
diff --git a/Makefile.am b/Makefile.am index f1bd6b9..2c976e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,6 +72,11 @@ if BUILD_PIDOF bin_PROGRAMS += pidof dist_man_MANS += pidof.1 pidof_SOURCES = pidof.c lib/fileutils.c + +bin_PROGRAMS += pidof.static +pidof_static_SOURCES = pidof.c lib/fileutils.c +pidof_static_LDFLAGS = -all-static -Wl,--gc-sections + else EXTRA_DIST += pidof.1 endif @@ -141,6 +148,7 @@ LIBprocps_REVISION=0 LIBprocps_AGE=0 proc_libprocps_la_LIBADD = $(LIB_KPARTS) +proc_libprocps_la_CFLAGS = -ffunction-sections -fdata-sections if WITH_SYSTEMD proc_libprocps_la_LIBADD += @SYSTEMD_LIBS@