Package: libsepolx
Version: 1.10-1
Author: Guillem Jover <guillem@debian.org>
Status: applied
Debbug: 348947
Description:
 Add a .pc file to be able to statically link including the transitive libs.


diff -Naur libsepol-1.10.orig/debian/local.mk libsepol-1.10/debian/local.mk
--- libsepol-1.10.orig/debian/local.mk	2006-01-20 01:27:58.000000000 +0200
+++ libsepol-1.10/debian/local.mk	2006-01-20 01:28:11.000000000 +0200
@@ -69,6 +69,7 @@
 	$(MAKE)		    DESTDIR=$(TMPTOP) -C src install
 	rm -f		    $(LIBDIR)/libsepol.a
 	rm -f		    $(LIBDIR)/libsepol.so
+	rm -f		    $(LIBDIR)/libsepol.pc
 	rm -rf              $(TMPTOP)/usr/lib
 	chmod 0644          $(LIBDIR)/libsepol.so.1
 	$(install_file)	    debian/changelog	     $(DOCDIR)/changelog.Debian
diff -Naur libsepol-1.10.orig/src/libsepol.pc.in libsepol-1.10/src/libsepol.pc.in
--- libsepol-1.10.orig/src/libsepol.pc.in	1970-01-01 02:00:00.000000000 +0200
+++ libsepol-1.10/src/libsepol.pc.in	2006-01-20 01:28:11.000000000 +0200
@@ -0,0 +1,11 @@
+prefix=@prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libsepol
+Description: Security Enhanced Linux policy library
+Version: @VERSION@
+URL: http://www.nsa.gov/selinux/
+Libs: -L${libdir} -lsepol
+Cflags: -I${includedir}
+
diff -Naur libsepol-1.10.orig/src/Makefile libsepol-1.10/src/Makefile
--- libsepol-1.10.orig/src/Makefile	2005-11-02 01:07:14.000000000 +0200
+++ libsepol-1.10/src/Makefile	2006-01-20 01:35:13.000000000 +0200
@@ -1,19 +1,22 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
+PREFIX ?= /usr
+INCDIR ?= $(PREFIX)/include
 LIBDIR ?= $(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/lib
 
+VERSION = $(shell cat ../VERSION)
 LIBVERSION = 1
 
 LIBA=libsepol.a 
 TARGET=libsepol.so
+LIBPC=libsepol.pc
 LIBSO=$(TARGET).$(LIBVERSION)
 OBJS= $(patsubst %.c,%.o,$(wildcard *.c))
 LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c))
 CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
 override CFLAGS += -I. -I../include -D_GNU_SOURCE
 
-all: $(LIBA) $(LIBSO)
+all: $(LIBA) $(LIBSO) $(LIBPC)
 
 $(LIBA):  $(OBJS)
 	$(AR) rcs $@ $^
@@ -23,6 +26,9 @@
 	$(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,$(LIBSO),--version-script=libsepol.map,-z,defs
 	ln -sf $@ $(TARGET) 
 
+$(LIBPC): $(LIBPC).in
+	sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCDIR):' < $< > $@
+
 %.o:  %.c 
 	$(CC) $(CFLAGS) -c -o $@ $<
 
@@ -30,15 +36,17 @@
 	$(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $<
 
 install: all
-	test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
-	install -m 644 $(LIBA) $(LIBDIR)
+	test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR)
+	install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR)
+	test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig
+	install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig
 	test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
 	install -m 755 $(LIBSO) $(SHLIBDIR)
-	cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
+	cd $(DESTDIR)$(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
 
 relabel:
 	/sbin/restorecon $(SHLIBDIR)/$(LIBSO)
 
 clean: 
-	-rm -f $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) 
+	-rm -f $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) $(LIBPC)
 
