From: Guido Trentalancia <guido@trentalancia.com>
To: Eric Paris <eparis@parisplace.org>
Cc: SELinux Mail List <selinux@tycho.nsa.gov>
Subject: [RFC] Userspace top-level Makefile (was Re: [PATCH] Fix LIBDIR usage for load_policy)
Date: Fri, 09 Sep 2011 23:19:46 +0200 [thread overview]
Message-ID: <1315603187.2482.22.camel@vortex> (raw)
In-Reply-To: <1315591143.2170.36.camel@vortex>
So either a top-level README file is introduced (to explictly recommend
to build the libraries first):
--- selinux-09092011-orig/README 1970-01-01 01:00:00.000000000 +0100
+++ selinux-09092011/README 2011-09-09 22:48:42.907857132 +0200
@@ -0,0 +1,21 @@
+INSTALLATION:
+
+First build and install the libraries (libsepol, libselinux and libsemanage) by typing
+"make" and then "make install" in each directory.
+
+Finally build and install the userspace tools (sepolgen, checkpolicy and policycoreutils) by
+typing "make" and then "make install" in each directory.
+
+---
+
+The environment variables CFLAGS and LDFLAGS can be passed to "make" to use custom compiler
+and/or linker flags (for example: CFLAGS="-fPIC -DSHARED" LDFLAGS="-ldl").
+
+The environment variables LIBDIR and SHLIBDIR can be passed to "make" in order to configure
+different directories for the libraries (e.g. LIBDIR=/usr/lib64 and SHLIBDIR=/usr/lib64
+on 64-bit systems).
+
+The environment variable PREFIX can be passed to "make" in order to configure an install
+prefix other than "/usr".
+
+Please see the Makefile(s) for other environment variables that can be used.
And/or a warning could be printed out by the top-level Makefile:
--- selinux-09092011-orig/Makefile 2011-09-09 20:12:55.977662144 +0200
+++ selinux-09092011/Makefile 2011-09-09 22:57:12.481152804 +0200
@@ -1,4 +1,6 @@
-SUBDIRS=libsepol libselinux libsemanage sepolgen checkpolicy policycoreutils # policy
+SUBDIRS_BIN=sepolgen checkpolicy policycoreutils
+SUBDIRS_LIB=libsepol libselinux libsemanage
+SUBDIRS=$(SUBDIRS_LIB) $(SUBDIRS_BIN)
PYSUBDIRS=libselinux libsemanage
DISTCLEANSUBIDRS=libselinux libsemanage
@@ -11,6 +13,10 @@ all install relabel clean test indent:
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
+ @echo
+ @echo -n "Do not forget to install the libraries ($(SUBDIRS_LIB))"
+ @echo " before trying to build the userspace tools ($(SUBDIRS_BIN))."
+ @echo
install-pywrap swigify:
@for subdir in $(PYSUBDIRS); do \
Or the top-level Makefile could install the libraries automatically
(really awful as it is and NOT recommended, however on my system it
works fine with CFLAGS="-fPIC -DSHARED" and LDFLAGS="-ldl"):
--- selinux-09092011-orig/Makefile 2011-09-09 20:12:55.977662144 +0200
+++ selinux-09092011/Makefile 2011-09-09 23:12:12.135859761 +0200
@@ -1,4 +1,5 @@
-SUBDIRS=libsepol libselinux libsemanage sepolgen checkpolicy policycoreutils # policy
+SUBDIRS=libsepol libselinux libsemanage
+SUBDIRS_BIN=sepolgen checkpolicy policycoreutils # policy
PYSUBDIRS=libselinux libsemanage
DISTCLEANSUBIDRS=libselinux libsemanage
@@ -7,9 +8,20 @@ ifeq ($(DEBUG),1)
export LDFLAGS = -g
endif
-all install relabel clean test indent:
+all relabel test indent:
@for subdir in $(SUBDIRS); do \
- (cd $$subdir && $(MAKE) $@) || exit 1; \
+ (cd $$subdir && $(MAKE) $@ && $(MAKE) install) || exit 1; \
+ done
+ @for subdir_bin in $(SUBDIRS_BIN); do \
+ (cd $$subdir_bin && $(MAKE) $@) || exit 1; \
+ done
+
+install:
+ @for subdir in $(SUBDIRS); do \
+ (cd $$subdir && $(MAKE) install) || exit 1; \
+ done
+ @for subdir_bin in $(SUBDIRS_BIN); do \
+ (cd $$subdir_bin && $(MAKE) install) || exit 1; \
done
install-pywrap swigify:
@@ -17,6 +29,14 @@ install-pywrap swigify:
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
+clean:
+ @for subdir in $(SUBDIRS); do \
+ (cd $$subdir && $(MAKE) $@) || exit 1; \
+ done
+ @for subdir_bin in $(SUBDIRS_BIN); do \
+ (cd $$subdir_bin && $(MAKE) $@) || exit 1; \
+ done
+
distclean:
@for subdir in $(DISTCLEANSUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
The above methods are intended to make the build process (for the
userspace git version only) a little bit more user-friendly since the
tools might not build if the libraries are not already installed on the
system (because, for example, some header files from the libraries are
getting included from the system-wide include directory rather than from
the local build tree).
A previosly posted patch to honour the environment variable LIBDIR in
load_policy is also suggested (both for git and released versions).
Regards,
Guido
On Fri, 2011-09-09 at 19:59 +0200, Guido Trentalancia wrote:
> On Fri, 2011-09-09 at 19:46 +0200, Guido Trentalancia wrote:
> > On Fri, 2011-09-09 at 13:31 -0400, Eric Paris wrote:
> > > I'm also really annoyed by this at times, but I don't know what the
> > > right answer is.
> >
> > Well, as long as it is a git-only thing, perhaps a README file would do.
> >
> > It could be improved too...
> >
> > For example, load_policy does not honour LIBDIR or SHLIBDIR:
>
> It was in a broken format and now I've also changed the subject. The
> following one should be better:
>
> --- selinux-05092011/policycoreutils/load_policy/Makefile 2011-09-02 04:19:47.317716618 +0200
> +++ selinux-05092011-fix-LIBDIR/policycoreutils/load_policy/Makefile 2011-09-09 19:44:23.710064117 +0200
> @@ -3,11 +3,12 @@ PREFIX ?= ${DESTDIR}/usr
> SBINDIR ?= $(DESTDIR)/sbin
> USRSBINDIR ?= $(PREFIX)/sbin
> MANDIR ?= $(PREFIX)/share/man
> +LIBDIR ?= $(PREFIX)/usr/lib
> LOCALEDIR ?= /usr/share/locale
>
> CFLAGS ?= -Werror -Wall -W
> override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
> -LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
> +LDLIBS += -lsepol -lselinux -L$(LIBDIR)
>
> TARGETS=$(patsubst %.c,%,$(wildcard *.c))
>
>
> The top-level Makefile could be improved too perhaps...
>
> > --- selinux-05092011/policycoreutils/load_policy/Makefile 2011-09-02
> > 04:19:47.317716618 +0200
> > +++ selinux-05092011-fix-LIBDIR/policycoreutils/load_policy/Makefile
> > 2011-09-09 19:44:23.710064117 +0200
> > @@ -3,11 +3,12 @@ PREFIX ?= ${DESTDIR}/usr
> > SBINDIR ?= $(DESTDIR)/sbin
> > USRSBINDIR ?= $(PREFIX)/sbin
> > MANDIR ?= $(PREFIX)/share/man
> > +LIBDIR ?= $(PREFIX)/usr/lib
> > LOCALEDIR ?= /usr/share/locale
> >
> > CFLAGS ?= -Werror -Wall -W
> > override CFLAGS += $(LDFLAGS) -I$(PREFIX)/include -DUSE_NLS
> > -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
> > -LDLIBS += -lsepol -lselinux -L$(PREFIX)/lib
> > +LDLIBS += -lsepol -lselinux -L$(LIBDIR)
> >
> > TARGETS=$(patsubst %.c,%,$(wildcard *.c))
> >
> >
> >
> > > We really treat it like we have 5+ separate projects which just all
> > > happen to live in the same git tree. Thus to build libselinux you
> > > must have already built and installed libsepol. And then to build
> > > libsemanage you need to have done that with both libsepol and
> > > libselinux. Then of course to get the builds and install right (on
> > > Fedora/RHEL) you have to know to use LIBDIR=/usr/lib64 SHLIBDIR=/lib64
> > > for libsepol and libsepol, but SHLIBDIR=/usr/lib64 for libsemanage.
> > > Its a mess, but I don't know what to do that's better....
> > >
> > > -Eric
> > >
> > > On Fri, Sep 9, 2011 at 1:17 PM, Guido Trentalancia
> > > <guido@trentalancia.com> wrote:
> > > > It only happens when building from git (because it uses the top-level
> > > > Makefile which is not being distributed with the released components).
> > > >
> > > > On Fri, 2011-09-09 at 19:01 +0200, Guido Trentalancia wrote:
> > > >> Hello,
> > > >>
> > > >> I am not able to build semodule from the current git unless the
> > > >> following patch is applied.
> > > >>
> > > >> Also, it would still be problematic if an outdated version of handle.h
> > > >> is getting picked up directly from the root include directory (as it
> > > >> happens now) and not from the local build directory... In other words,
> > > >> the Makefile and build system should be modified so that the local
> > > >> header files are picked up during each new build rather than the
> > > >> system-wide ones from previous installations.
> > > >>
> > > >> But at least this is a start:
> > > >>
> > > >> Include <semanage/handle.h> for semodule_set_root() currently used by semodule
> > > >>
> > > >> --- selinux-05092011/policycoreutils/semodule/semodule.c 2011-09-02 04:19:47.357716917 +0200
> > > >> +++ selinux-05092011-fix-semanage_set_root/policycoreutils/semodule/semodule.c 2011-09-09 18:41:24.078319022 +0200
> > > >> @@ -21,6 +21,7 @@
> > > >> #include <sys/types.h>
> > > >>
> > > >> #include <semanage/modules.h>
> > > >> +#include <semanage/handle.h>
> > > >>
> > > >> enum client_modes { NO_MODE, INSTALL_M, UPGRADE_M, BASE_M, ENABLE_M, DISABLE_M, REMOVE_M,
> > > >> LIST_M, RELOAD
> > > >>
> > > >>
> > > >> --
> > > >> This message was distributed to subscribers of the selinux mailing list.
> > > >> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> > > >> the words "unsubscribe selinux" without quotes as the message.
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > This message was distributed to subscribers of the selinux mailing list.
> > > > If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> > > > the words "unsubscribe selinux" without quotes as the message.
> > > >
> > >
> >
> >
> >
> > --
> > This message was distributed to subscribers of the selinux mailing list.
> > If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> > the words "unsubscribe selinux" without quotes as the message.
> >
>
>
>
> --
> This message was distributed to subscribers of the selinux mailing list.
> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> the words "unsubscribe selinux" without quotes as the message.
>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2011-09-09 21:19 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-09 17:01 [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule Guido Trentalancia
2011-09-09 17:11 ` Guido Trentalancia
2011-09-09 17:17 ` Guido Trentalancia
2011-09-09 17:31 ` Eric Paris
2011-09-09 17:46 ` Guido Trentalancia
2011-09-09 17:59 ` [PATCH] Fix LIBDIR usage for load_policy (was Re: [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule) Guido Trentalancia
2011-09-09 21:19 ` Guido Trentalancia [this message]
2011-09-09 21:37 ` [RFC] Userspace top-level Makefile (was Re: [PATCH] Fix LIBDIR usage for load_policy) Joshua Brindle
2011-09-09 21:46 ` Guido Trentalancia
2011-09-09 22:35 ` Guido Trentalancia
2011-09-09 23:07 ` Eric Paris
2011-09-09 23:12 ` Guido Trentalancia
2011-09-09 23:15 ` Eric Paris
2011-09-09 23:25 ` Guido Trentalancia
2011-09-09 23:45 ` Guido Trentalancia
2011-09-09 23:56 ` Guido Trentalancia
2011-09-10 1:04 ` [RFC] Userspace git local build (was Re: [RFC] Userspace top-level Makefile) Guido Trentalancia
2011-09-10 2:39 ` [RFC v2] Userspace git local build (was Re: [RFC] Userspace git local build) Guido Trentalancia
2011-09-11 23:22 ` [RFC] Userspace top-level Makefile (was Re: [PATCH] Fix LIBDIR usage for load_policy) Joshua Brindle
2011-09-12 2:12 ` Guido Trentalancia
2011-09-12 12:41 ` Joshua Brindle
2011-09-12 20:17 ` [RFC] Improve installation of userspace shared libraries (was Re: [RFC] Userspace top-level Makefile) Guido Trentalancia
2011-09-13 21:00 ` Stephen Smalley
2011-09-13 21:12 ` Guido Trentalancia
2011-09-13 21:35 ` Guido Trentalancia
2011-09-12 12:57 ` [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule Stephen Smalley
2011-09-12 20:29 ` [PATCH] Fix includes for userspace tools and libraries (was Re: [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule) Guido Trentalancia
2011-09-12 22:01 ` Eric Paris
2011-09-12 23:05 ` Guido Trentalancia
2011-09-13 0:53 ` Guido Trentalancia
2011-09-13 2:03 ` [PATCH v2] Fix includes for userspace tools and libraries (was Re: [PATCH] Fix includes for userspace tools and libraries) Guido Trentalancia
2011-09-13 2:41 ` [PATCH v3] Fix includes for userspace tools and libraries (was Re: [PATCH v2] " Guido Trentalancia
2011-09-13 12:41 ` [PATCH] Fix includes for userspace tools and libraries (was Re: [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule) Stephen Smalley
2011-09-13 16:31 ` Guido Trentalancia
2011-09-13 17:20 ` Stephen Smalley
2011-09-13 18:33 ` [PATCH] Fix includes for userspace tools and libraries (and possible security issue) Guido Trentalancia
2011-09-13 18:46 ` Guido Trentalancia
2011-09-13 19:17 ` Stephen Smalley
2011-09-13 18:48 ` Stephen Smalley
2011-09-13 19:18 ` Guido Trentalancia
2011-09-13 19:25 ` Stephen Smalley
2011-09-13 19:34 ` Stephen Smalley
2011-09-13 20:04 ` Guido Trentalancia
2011-09-13 20:20 ` Stephen Smalley
2011-09-13 20:49 ` Guido Trentalancia
2011-09-13 20:26 ` Eric Paris
2011-09-13 20:42 ` Stephen Smalley
2011-09-13 21:09 ` Guido Trentalancia
2011-09-13 22:05 ` [PATCH v4] " Guido Trentalancia
2011-09-13 23:33 ` [PATCH] Fix function arguments in libsemanage tests (was Re: [PATCH v4] Fix includes for userspace tools and libraries) Guido Trentalancia
2011-09-14 0:44 ` [PATCH] Change default make target for sepolgen " Guido Trentalancia
2011-09-14 1:10 ` [PATCH] Change default make target for some directories in the libraries (was Re: [PATCH] Change default make target for sepolgen) Guido Trentalancia
2011-09-14 1:20 ` [PATCH] Change default make target for the man directory of policycoreutils/mcstrans " Guido Trentalancia
2011-09-14 19:16 ` [PATCH] Change default make target for sepolgen (was Re: [PATCH v4] Fix includes for userspace tools and libraries) Eric Paris
2011-09-14 19:31 ` [PATCH] Fix function arguments in libsemanage tests " Eric Paris
2011-09-15 4:40 ` [PATCH v5] Fix makefiles for the userspace tools and libraries Guido Trentalancia
2011-09-15 9:40 ` [PATCH] Fix symbolic link creation for the userspace libraries Guido Trentalancia
2011-09-15 11:51 ` [PATCH v5] Fix makefiles for the userspace tools and libraries Guido Trentalancia
2011-09-14 12:56 ` [PATCH v4] Fix includes for userspace tools and libraries (and possible security issue) Stephen Smalley
2011-09-15 2:44 ` [PATCH v5] " Guido Trentalancia
2011-09-15 12:56 ` Stephen Smalley
2011-09-15 16:04 ` Guido Trentalancia
2011-09-15 16:35 ` Stephen Smalley
2011-09-15 17:03 ` Guido Trentalancia
2011-09-15 17:16 ` Stephen Smalley
2011-09-15 17:26 ` Guido Trentalancia
2011-09-15 18:14 ` Stephen Smalley
2011-09-15 19:12 ` [PATCH v5] Fix includes for userspace tools and libraries Guido Trentalancia
2011-09-15 20:00 ` Stephen Smalley
2011-09-15 20:32 ` Guido Trentalancia
2011-09-16 12:39 ` Stephen Smalley
2011-09-16 12:50 ` Guido Trentalancia
2011-09-17 20:48 ` [PATCH v6] " Guido Trentalancia
2011-09-15 19:37 ` [PATCH v5] " Guido Trentalancia
2011-09-15 17:15 ` [PATCH v5] Fix includes for userspace tools and libraries (and possible security issue) Eric Paris
2011-09-13 19:42 ` [PATCH] " Guido Trentalancia
2011-09-13 17:08 ` [PATCH] Fix includes for userspace tools and libraries (was Re: [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule) Stephen Smalley
2011-09-09 17:31 ` [PATCH] Fix include semanage/handle.h for semanage_set_root() as used by semodule Guido Trentalancia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315603187.2482.22.camel@vortex \
--to=guido@trentalancia.com \
--cc=eparis@parisplace.org \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.