Skip to content

Commit

Permalink
Merge pull request #269 from OpenPrinting/snap-redux
Browse files Browse the repository at this point in the history
Snap redux
  • Loading branch information
michaelrsweet authored Oct 6, 2021
2 parents 7f65f40 + 3d93993 commit da1daa8
Show file tree
Hide file tree
Showing 14 changed files with 392 additions and 1,015 deletions.
4 changes: 1 addition & 3 deletions Makedefs.in
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ DSOFLAGS = @DSOFLAGS@
DNSSDLIBS = @DNSSDLIBS@
IPPFIND_BIN = @IPPFIND_BIN@
IPPFIND_MAN = @IPPFIND_MAN@
APPARMORLIBS = @APPARMORLIBS@
SNAPDGLIBLIBS = @SNAPDGLIBLIBS@
LDFLAGS = @LDFLAGS@
LINKCUPS = @LINKCUPS@
LINKCUPSSTATIC = ../cups/$(LIBCUPSSTATIC) $(LIBS)
Expand All @@ -183,7 +181,7 @@ ONDEMANDLIBS = @ONDEMANDLIBS@
OPTIM = @OPTIM@
OPTIONS = @WARNING_OPTIONS@
PAMLIBS = @PAMLIBS@
SERVERLIBS = @SERVERLIBS@
SERVERLIBS = @SERVERLIBS@ @APPARMORLIBS@ @SNAPDGLIBLIBS@
TLSFLAGS = @TLSFLAGS@
TLSLIBS = @TLSLIBS@
UNITTESTS = @UNITTESTS@
Expand Down
58 changes: 58 additions & 0 deletions config-scripts/cups-container.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
dnl
dnl Support for packaging CUPS in different kinds of containers.
dnl
dnl Copyright © 2021 by OpenPrinting
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl

dnl Specify a container mode
CONTAINER="none"

AC_ARG_WITH([container], AS_HELP_STRING([--with-container=...], [configure to use in container (none, snap)]), [
CONTAINER="$withval"
])

AS_CASE(["$CONTAINER"], [none], [
# No container in use
], [snap], [
# Building as a snap
AC_DEFINE([CUPS_SNAP], [1], [Building as a snap (snapcraft.io)?])
], [*], [
AC_MSG_ERROR([Unsupported container '$CONTAINER' specified.])
])


dnl Supporting libraries for different containers...
APPARMORLIBS=""
SNAPDGLIBLIBS=""
AC_SUBST([APPARMORLIBS])
AC_SUBST([SNAPDGLIBLIBS])

AS_IF(["x$PKGCONFIG" != x], [
AC_MSG_CHECKING([for libapparmor])
AS_IF([$PKGCONFIG --exists libapparmor], [
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS $($PKGCONFIG --cflags libapparmor)"
APPARMORLIBS="$($PKGCONFIG --libs libapparmor)"
AC_DEFINE([HAVE_LIBAPPARMOR], [1], [Have the apparmor library?])
AC_MSG_CHECKING([for libsnapd-glib])
AS_IF([$PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0], [
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)"
SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)"
AC_DEFINE([HAVE_LIBSNAPDGLIB], [1], [Have the snapd-glib library?])
SAVELIBS="$LIBS"
LIBS="$SNAPDGLIBLIBS $LIBS"
AC_CHECK_FUNC([snapd_client_run_snapctl2_sync], [
AC_DEFINE([HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC], [1], [Have the snapd_client_run_snapctl2_sync function?])
])
LIBS="$SAVELIBS"
], [
AC_MSG_RESULT([no])
])
])
])
114 changes: 0 additions & 114 deletions config-scripts/cups-snap.m4

This file was deleted.

43 changes: 29 additions & 14 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -650,20 +650,6 @@
#undef HAVE_SYS_STATVFS_H
#undef HAVE_SYS_VFS_H

/*
* Do we want Snap packaging support and have the needed libraries and
* utilities?
*/

#undef HAVE_APPARMOR
#undef HAVE_SNAPDGLIB
#undef HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC
#undef HAVE_SNAPCTL_IS_CONNECTED
#undef OUR_SNAP_NAME
#undef SNAPCTL
#undef CUPS_CONTROL_SLOT
#undef SUPPORT_SNAPPED_CUPSD
#undef SUPPORT_SNAPPED_CLIENTS

/*
* Location of macOS localization bundle, if any.
Expand Down Expand Up @@ -696,4 +682,33 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */


/*
* Building as a snap (snapcraft.io)?
*/

#undef CUPS_SNAP


/*
* Have the apparmor library?
*/

#undef HAVE_LIBAPPARMOR


/*
* Have the snapd-glib library?
*/

#undef HAVE_LIBSNAPDGLIB


/*
* Have the snapd_client_run_snapctl2_sync function?
*/

#undef HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC


#endif /* !_CUPS_CONFIG_H_ */
Loading

0 comments on commit da1daa8

Please sign in to comment.