diff mbox

libselinux: allow link with -lfts

Message ID 20170221185821.26373-1-ncopa@alpinelinux.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Natanael Copa Feb. 21, 2017, 6:58 p.m. UTC
This makes it possible to build libselinux with the external libtfs for
systems which does not implement the non-standard fts. For example musl
libc.

  make FTS_LDFLAGS=-lfts

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 libselinux/src/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

William Roberts Feb. 21, 2017, 8:08 p.m. UTC | #1
On Tue, Feb 21, 2017 at 10:58 AM, Natanael Copa <ncopa@alpinelinux.org> wrote:
> This makes it possible to build libselinux with the external libtfs for
> systems which does not implement the non-standard fts. For example musl
> libc.
>
>   make FTS_LDFLAGS=-lfts

The way this was done before for PCRE was a flag to add USE_PCRE2 to
the make command where it then picks the ld flags to add.
In this case, specifying raw LDFLAGS should, in theory just be done
via LDFLAGS (not sure if it works, the makefiles are not that great at
times).

I think we would want something close to the PCRE example, like make
USE_LIBFTS=y

>
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
>  libselinux/src/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 5640a57..513a9e7 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -92,6 +92,7 @@ LD_SONAME_FLAGS=-install_name,$(LIBSO)
>  endif
>
>  PCRE_LDFLAGS ?= -lpcre
> +FTS_LDFLAGS ?=
>
>  override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
>
> @@ -143,7 +144,7 @@ $(LIBA): $(OBJS)
>         $(RANLIB) $@
>
>  $(LIBSO): $(LOBJS)
> -       $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
> +       $(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) $(FTS_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
>         ln -sf $@ $(TARGET)
>
>  $(LIBPC): $(LIBPC).in ../VERSION
> --
> 2.11.1
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
diff mbox

Patch

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 5640a57..513a9e7 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -92,6 +92,7 @@  LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre
+FTS_LDFLAGS ?=
 
 override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS)
 
@@ -143,7 +144,7 @@  $(LIBA): $(OBJS)
 	$(RANLIB) $@
 
 $(LIBSO): $(LOBJS)
-	$(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
+	$(CC) $(CFLAGS) -shared -o $@ $^ $(PCRE_LDFLAGS) $(FTS_LDFLAGS) -ldl $(LDFLAGS) -L$(LIBDIR) -Wl,$(LD_SONAME_FLAGS)
 	ln -sf $@ $(TARGET) 
 
 $(LIBPC): $(LIBPC).in ../VERSION