tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: splitting off libcups (was: Re-enabling cups option in gtk3)
On Fri, May 15, 2020 at 01:57:49PM +0200, Edgar Fuß wrote:
> > Splitting libcups into its own package:
> Sounds like a good Idea to me.
>
> > Index: print/libcups/options.mk
> Couldn't this be shared with cups-base?
>
> > Index: print/cups-base/Makefile
> [...]
> > post-install:
> > + # Delete files installed by libcups
> > + ${RM} ${DESTDIR}${PREFIX}/bin/cups-config
> > + ${RM} -rf ${DESTDIR}${PREFIX}/lib
> > + ${RM} -rf ${DESTDIR}${PREFIX}/include/cups
> > + ${RM} -rf ${DESTDIR}${PREFIX}/share/locale
> I guess there's no --with-components setting to avoid building these in the
> first place?
It looked like libcups is very deeply integrated into the build.
The top-level makefile descends into "cups" unconditionally, and many of
the subdirectories depend on it. I could probably skip the install step.
Also while doing this I got caught up with creating the attached diff,
which is a more "systemic" way of removing parts of another package with
additional checks.
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/cups-base/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- Makefile 14 May 2020 19:45:50 -0000 1.33
+++ Makefile 15 May 2020 14:29:18 -0000
@@ -153,6 +153,19 @@
${LN} -sf ${DESTDIR}${PREFIX}/libexec/cups/backend/dnssd ${DESTDIR}${PREFIX}/libexec/cups/backend/mdns
.endif
+REMOVE_CONFLICTS_WITH_PACKAGES+= libcups-[0-9]*
+CONFLICTING_FILES!= pkg_info -qL ${REMOVE_CONFLICTS_WITH_PACKAGES}
+
+post-install: remove-conflicts
+remove-conflicts:
+ @${STEP_MSG} removing files conflicting with ${REMOVE_CONFLICTS_WITH_PACKAGES}
+.for __conflicting_file__ in ${CONFLICTING_FILES}
+# XXX check for GNU readelf + PKG_DEVELOPER
+ ${ECHO} ${DESTDIR}${__conflicting_file__} ${__conflicting_file__} | ${AWK} -f ./match-abi.awk
+# end check for GNU readelf + PKG_DEVELOPER
+ ${RM} -f ${DESTDIR}${__conflicting_file__}
+.endfor
+
.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/png/buildlink3.mk"
Index: match-abi.awk
===================================================================
RCS file: match-abi.awk
diff -N match-abi.awk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ match-abi.awk 15 May 2020 14:29:18 -0000
@@ -0,0 +1,59 @@
+# Match ABIs on two ELF libraries
+# echo "/usr/lib/libc.so.12.214 /usr/lib/libc.so.12.215" | awk -f match-abi.awk
+#
+# Symbols mismatch: exit with non-zero status
+# If no symbols are available: return zero status.
+
+{
+ first_elf = $1
+ second_elf = $2
+ cmd = "readelf --symbols " first_elf
+ second_cmd = "readelf --symbols " second_elf
+ i = 0
+ debug = 0
+ if (system(cmd " > /dev/null 2>&1") != 0) {
+ #print("Failed to get symbols from " first_elf ", ignoring") > "/dev/stderr"
+ exit 0
+ }
+ if (system(second_cmd " > /dev/null 2>&1") != 0) {
+ #print("Failed to get symbols from " second_elf ", ignoring") > "/dev/stderr"
+ exit 0
+ }
+
+ while ((cmd | getline) > 0) {
+ sname = $8
+ visibility = $7
+ if (visibility != "UND") {
+ i++
+ existing_snames[i] = sname
+ }
+ }
+
+ j = 0
+ while ((second_cmd | getline) > 0) {
+ sname = $8
+ visibility = $7
+ if (visibility != "UND") {
+ j++
+ matched = 0
+ for (iter in existing_snames) {
+ if (sname == existing_snames[iter]) {
+ matched++
+ break
+ }
+ }
+ if (matched == 0) {
+ print("Libraries " first_elf " and " second_elf " don't have the same ABI") > "/dev/stderr"
+ print("didn't find a match for symbol " sname) > "/dev/stderr"
+ exit 1
+ }
+ }
+ }
+
+ if (j != i) {
+ print("Libraries " first_elf " and " second_elf " don't have the same ABI") > "/dev/stderr"
+ print("More symbols in " first_elf) > "/dev/stderr"
+ print("i = " i ", j = ", j) > "/dev/stderr"
+ exit 1
+ }
+}
Home |
Main Index |
Thread Index |
Old Index