All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: selinux@tycho.nsa.gov, nicolas.iooss@m4x.org
Subject: Rework of Makefiles
Date: Fri, 12 Jan 2018 16:11:32 +0100	[thread overview]
Message-ID: <20180112151135.13202-1-marcus.folkesson@gmail.com> (raw)
In-Reply-To: <marcus.folkesson@gmail.com>

I have reworked the Makefiles a bit to make it more compatible with
the standard semantics for DESTDIR and PREFIX.

What made me look at this was a package I was working on in 
Buildroot[1] that was using the pkg-config file generated
from libselinux. The pkg-config file generated has bogus paths 
which results in that my package did not compile.

When looking further in our packages for libselinux/libsepol/libsemanage,
we allready do "tricks" to make it compile.
For example, we set DESTDIR during compilation to compute library and header paths.

DESTDIR should be supported only in the install* and uninstall* targets,
as those are the only targets where it is useful. [2]

PREFIX should be used to set a prefix for the installation.
This could be provided both in compile and install stages.


For example, consider the following line:
#make DESTDIR=/tmp/selinux install

It will generate a libselinux.pc file that looks like this:

prefix=/tmp/selinux/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=/tmp/selinux/usr/include

The DESTDIR should not be part of the prefix. The correct output should be:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=/usr/include

The following example do not compile at all:
#make DESTDIR=/tmp/myroot PREFIX=/selinux install

In this case, everything should be installed under /tmp/myroot/selinux.
The prefix in all generated pkg-files should have the path /selinux/xxxxx ( not /tmp/myroot/selinux/xxxx).

This patchsets tries to solve the following issues:
- The pkg-config files generates odd paths when using DESTDIR without PREFIX
- DESTDIR is needed during compile time to compute library and header paths which it should not.
- Installing with both DESTDIR and PREFIX set gives us odd paths
- Make usage of DESTDIR and PREFIX more standard

However, DESTDIR is still needed in the "root" Makefile to make libsemanage to compile.
But all components (libselinux, libsepol and libsemanage) can be compiled separatly with
standard usage of DESTDIR and PREFIX.

Thanks,

Best regards
Marcus Folkesson

[1] https://buildroot.org/
[2] https://www.gnu.org/prep/standards/html_node/DESTDIR.html

             reply	other threads:[~2018-01-12 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 15:11 Marcus Folkesson [this message]
2018-01-12 15:11 ` [PATCH 1/3] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
2018-01-16 15:42   ` Stephen Smalley
2018-01-12 15:11 ` [PATCH 2/3] libselinux: " Marcus Folkesson
2018-01-12 15:11 ` [PATCH 3/3] libsemanage: " Marcus Folkesson
  -- strict thread matches above, loose matches on Subject: below --
2018-01-24  9:27 Rework of Makefiles Marcus Folkesson

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=20180112151135.13202-1-marcus.folkesson@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=nicolas.iooss@m4x.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.