All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: "Christian Göttsche" <cgzones@googlemail.com>, selinux@vger.kernel.org
Cc: Masatake YAMATO <yamato@redhat.com>
Subject: Re: [PATCH] Makefile: expand ~ in DESTDIR
Date: Fri, 02 Jun 2023 16:04:12 +0200	[thread overview]
Message-ID: <87edmuj6zn.fsf@redhat.com> (raw)
In-Reply-To: <CAJ2a_Dd5tCrgoNQvhD+BZ7M7HSmGp026i2GooT6-ytq7WqYSZA@mail.gmail.com>

Christian Göttsche <cgzones@googlemail.com> writes:

> On Fri, 2 Jun 2023 at 14:05, Petr Lautrbach <plautrba@redhat.com> wrote:
>>
>> Masatake YAMATO <yamato@redhat.com> writes:
>>
>> > Though instructed as
>> >
>> >     DESTDIR=~/obj ./scripts/env_use_destdir make test
>
> Is that a valid use case of the script `env_use_destdir`?
> I thought the script is just for executing binaries depending on the
> shared libraries in DESTDIR (e.g. `DESTDIR=~/obj
> ./scripts/env_use_destdir seinfo`), not for make invocations.

`make` is just another binary to run in pre-set environment. Especially
for `make test` it is important to use PATH and LD_LIBRARY_PATH pointing
to the new built binaries.

I personally use `source ./scripts/env_use_destdir` also for manual
testing.

Petr



>> >
>> > in README.md, compiling policy_define.c was failed with following errors:
>> >
>> >     make[1]: Entering directory '/home/yamato/var/selinux/checkpolicy'
>> >     cc -O2 -Werror -Wall -Wextra -Wfloat-equal -Wformat=2 -Winit-self \
>> >        -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes \
>> >        -Wnull-dereference -Wpointer-arith -Wshadow -Wstrict-prototypes \
>> >        -Wundef -Wunused -Wwrite-strings -fno-common -I~/obj/usr/include \
>> >        -o policy_define.o -c policy_define.c
>> >     policy_define.c: In function ‘define_te_avtab_xperms_helper’:
>> >     policy_define.c:2083:61: error: ‘RULE_NOTSELF’ undeclared (first use in this function); did you mean ‘RULE_SELF’?
>> >      2083 |                         avrule->flags |= (add ? RULE_SELF : RULE_NOTSELF);
>> >         |                                                             ^~~~~~~~~~~~
>> >         |                                                             RULE_SELF
>> >
>> > because cc cannot find the directory ~/obj/usr/include passed via -I option.
>> >
>> > cc doesn't expand "~".
>> >
>> > Signed-off-by: Masatake YAMATO <yamato@redhat.com>
>>
>> It doesn't work when DESTDIR does not exist -  If no existing file name
>> matches a pattern, then that pattern is omitted from the output of the
>> wildcard function, see
>> https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html
>>
>>
>> Petr
>>
>> > ---
>> >  Makefile | 6 +++---
>> >  1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/Makefile b/Makefile
>> > index 2ffba8e9..053c6d3d 100644
>> > --- a/Makefile
>> > +++ b/Makefile
>> > @@ -26,11 +26,11 @@ else
>> >  endif
>> >
>> >  ifneq ($(DESTDIR),)
>> > -     LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
>> > +     LIBDIR ?= $(wildcard $(DESTDIR))$(PREFIX)/lib
>> >       LIBSEPOLA ?= $(LIBDIR)/libsepol.a
>> >
>> > -     CFLAGS += -I$(DESTDIR)$(PREFIX)/include
>> > -     LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR)
>> > +     CFLAGS += -I$(wildcard $(DESTDIR))$(PREFIX)/include
>> > +     LDFLAGS += -L$(wildcard $(DESTDIR))$(PREFIX)/lib -L$(LIBDIR)
>> >       export CFLAGS
>> >       export LDFLAGS
>> >       export LIBSEPOLA
>> > --
>> > 2.40.1
>>


  reply	other threads:[~2023-06-02 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  1:15 [PATCH] Makefile: expand ~ in DESTDIR Masatake YAMATO
2023-06-02 12:04 ` Petr Lautrbach
2023-06-02 12:54   ` Christian Göttsche
2023-06-02 14:04     ` Petr Lautrbach [this message]
2023-06-08  1:21 ` Masatake YAMATO

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=87edmuj6zn.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    --cc=yamato@redhat.com \
    /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.