All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] semanage-functionality 11/17
@ 2005-09-27 12:49 Karl MacMillan
  2005-09-27 17:00 ` Ivan Gyurdiev
  0 siblings, 1 reply; 4+ messages in thread
From: Karl MacMillan @ 2005-09-27 12:49 UTC (permalink / raw)
  To: selinux; +Cc: 'Joshua Brindle'

[-- Attachment #1: Type: text/plain, Size: 121 bytes --]

Makefile changes to build a shared libsemanage library.

------
Karl MacMillan
Tresys Technology
http://www.tresys.com 


[-- Attachment #2: libsemanage_src_Makefile.diff --]
[-- Type: application/octet-stream, Size: 2240 bytes --]

diff -purN -x .svn libsemanage/src/Makefile libsemanage/src/Makefile
--- libsemanage/src/Makefile	2005-09-26 14:02:40.000000000 -0400
+++ libsemanage/src/Makefile	2005-09-19 09:11:07.000000000 -0400
@@ -4,7 +4,12 @@ LIBDIR ?= $(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 
-DEFAULT_SEMOD_CONF_LOCATION=/usr/share/semod/semod.conf
+DEFAULT_SEMANAGE_CONF_LOCATION=$(PREFIX)/share/semanage/semanage.conf
+
+ifeq ($(DEBUG),1)
+	export CFLAGS = -g3 -O0 -gdwarf-2 -fno-strict-aliasing -Wall -Wshadow
+	export LDFLAGS = -g
+endif
 
 LEX = flex
 LFLAGS = -s
@@ -13,19 +18,26 @@ YFLAGS = -d
 
 LIBVERSION = 1
 
-LIBA=libsemanage.a 
+LIBA=libsemanage.a
+TARGET=libsemanage.so
+LIBSO=$(TARGET).$(LIBVERSION)
 OBJS= $(patsubst %.c,%.o,$(wildcard *.c)) conf-scan.o conf-parse.o
+LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c)) conf-scan.lo conf-parse.lo
 CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
 
-override CFLAGS += -I. -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE \
+override CFLAGS += -Iinclude -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE \
                    -DDEFAULT_SEMOD_CONF_LOCATION='"$(DEFAULT_SEMOD_CONF_LOCATION)"'
 
-all: $(LIBA)
+all: $(LIBA) $(LIBSO)
 
 $(LIBA): $(OBJS)
 	$(AR) rcs $@ $^
 	ranlib $@
 
+$(LIBSO): $(LOBJS)
+	$(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(LIBSO)
+	ln -sf $@ $(TARGET)
+
 conf-scan.c: conf-scan.l conf-parse.h
 	$(LEX) $(LFLAGS) -t $< > $@
 
@@ -37,11 +49,18 @@ conf-parse.h: conf-parse.c
 %.o:  %.c 
 	$(CC) $(CFLAGS) -c -o $@ $<
 
+%.lo:  %.c
+	$(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
+
 install: all
 	test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
 	install -m 644 $(LIBA) $(LIBDIR)
-	install -m 644 -D semod.conf $(DESTDIR)/$(DEFAULT_SEMOD_CONF_LOCATION)
+	test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
+	install -m 755 $(LIBSO) $(SHLIBDIR)
+	install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
+	cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
 
 clean: 
-	rm -f $(OBJS) $(LIBA) conf-scan.c conf-parse.c conf-parse.h
+	rm -f $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c
 
+.PHONY: clean

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] semanage-functionality 11/17
  2005-09-27 12:49 [PATCH] semanage-functionality 11/17 Karl MacMillan
@ 2005-09-27 17:00 ` Ivan Gyurdiev
  2005-09-27 19:18   ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Gyurdiev @ 2005-09-27 17:00 UTC (permalink / raw)
  To: Karl MacMillan; +Cc: selinux, 'Joshua Brindle'

Karl MacMillan wrote:

>Makefile changes to build a shared libsemanage library.
>  
>
I am not clear on how exporting symbols is done, but it would be better 
if the things I'm currently working on are _not_ exported, because they 
are in flux. What changes (if any) should I make to disable this 
functionality?

--
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] semanage-functionality 11/17
  2005-09-27 17:00 ` Ivan Gyurdiev
@ 2005-09-27 19:18   ` Stephen Smalley
  2005-09-28 15:18     ` Karl MacMillan
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2005-09-27 19:18 UTC (permalink / raw)
  To: Ivan Gyurdiev; +Cc: Karl MacMillan, selinux, 'Joshua Brindle'

On Tue, 2005-09-27 at 13:00 -0400, Ivan Gyurdiev wrote:
> Karl MacMillan wrote:
> 
> >Makefile changes to build a shared libsemanage library.
> >  
> >
> I am not clear on how exporting symbols is done, but it would be better 
> if the things I'm currently working on are _not_ exported, because they 
> are in flux. What changes (if any) should I make to disable this 
> functionality?

You can mark your symbols "hidden", as libselinux does for non-static
symbols that it doesn't want exported (e.g. see libselinux/src/trans.c).
Or we can change libsemanage to use an explicit map like libsepol.

A good paper to read is
http://people.redhat.com/drepper/dsohowto.pdf
In particular, section 2.2.

We should likely be using symbol versioning as well, as discussed in
section 3.

-- 
Stephen Smalley
National Security Agency


--
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] semanage-functionality 11/17
  2005-09-27 19:18   ` Stephen Smalley
@ 2005-09-28 15:18     ` Karl MacMillan
  0 siblings, 0 replies; 4+ messages in thread
From: Karl MacMillan @ 2005-09-28 15:18 UTC (permalink / raw)
  To: 'Stephen Smalley', 'Ivan Gyurdiev'
  Cc: selinux, 'Joshua Brindle'

> -----Original Message-----
> From: Stephen Smalley [mailto:sds@tycho.nsa.gov]
> Sent: Tuesday, September 27, 2005 3:19 PM
> To: Ivan Gyurdiev
> Cc: Karl MacMillan; selinux@tycho.nsa.gov; 'Joshua Brindle'
> Subject: Re: [PATCH] semanage-functionality 11/17
> 
> On Tue, 2005-09-27 at 13:00 -0400, Ivan Gyurdiev wrote:
> > Karl MacMillan wrote:
> >
> > >Makefile changes to build a shared libsemanage library.
> > >
> > >
> > I am not clear on how exporting symbols is done, but it would be better
> > if the things I'm currently working on are _not_ exported, because they
> > are in flux. What changes (if any) should I make to disable this
> > functionality?
> 
> You can mark your symbols "hidden", as libselinux does for non-static
> symbols that it doesn't want exported (e.g. see libselinux/src/trans.c).
> Or we can change libsemanage to use an explicit map like libsepol.
> 
> A good paper to read is
> http://people.redhat.com/drepper/dsohowto.pdf
> In particular, section 2.2.
> 
> We should likely be using symbol versioning as well, as discussed in
> section 3.
> 

We will move an explicit map, remove the hidden markings, and look into
symbol versioning.

Karl

> --
> Stephen Smalley
> National Security Agency



--
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-28 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-27 12:49 [PATCH] semanage-functionality 11/17 Karl MacMillan
2005-09-27 17:00 ` Ivan Gyurdiev
2005-09-27 19:18   ` Stephen Smalley
2005-09-28 15:18     ` Karl MacMillan

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.