Package: libselinux
Version: 2.0.85-2
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch karmic
Cross-building libselinux doesn't quite work at the moment. There are
the following problems:
* TLSFLAGS is set based on the build architecture, not the host
architecture.
* CC et al aren't passed when building Python bindings, so the build
process uses a compiler for the build architecture for those rather
than a compiler for the host architecture.
* The Python bindings are always linked against /usr/lib/libsepol.a.
Seeing as libsepol ships a pkg-config file now, and
dpkg-buildpackage sets an appropriate default for PKG_CONFIG_LIBDIR
when cross-building, it would seem simplest to use that.
The following patch fixes all these problems.
* Cross-build fixes:
- Pass ARCH=$(DEB_HOST_ARCH) to src/Makefile so that TLSFLAGS isn't set
on cross-builds on an i386 build machine.
- Pass CC, CFLAGS, and LDFLAGS when building Python bindings.
- Use pkg-config to find libsepol.a.
diff -u libselinux-2.0.85/src/Makefile libselinux-2.0.85/src/Makefile
--- libselinux-2.0.85/src/Makefile
+++ libselinux-2.0.85/src/Makefile
@@ -90,7 +90,7 @@
$(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $<
$(AUDIT2WHYSO): audit2why.lo
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux
${LIBDIR}/libsepol.a -L$(LIBDIR) -Wl,-soname,$@
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux $(shell
pkg-config --variable=libdir libsepol)/libsepol.a -L$(LIBDIR) -Wl,-soname,$@
%.o: %.c policy.h
$(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
diff -u libselinux-2.0.85/debian/local.mk libselinux-2.0.85/debian/local.mk
--- libselinux-2.0.85/debian/local.mk
+++ libselinux-2.0.85/debian/local.mk
@@ -62,7 +62,7 @@
$(checkdir)
$(REASON)
@test -d debian/stamp/build || mkdir -p debian/stamp/build
- $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" all
+ $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
ARCH=$(DEB_HOST_ARCH) all
$(MAKE) -C src libselinux.pc
@echo done > $@
@@ -157,6 +157,7 @@
rm -f src/audit2why.lo src/audit2why.so; \
$(MAKE) -C src DESTDIR=$(TMPTOP) PYLIBVER=python$$version \
PYTHONLIBDIR=$(PYTHONLIBDIRTOP)/python$$version/ \
+ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
pywrap install-pywrap; \
chmod -x $(EXTENSIONS_DIR)/python$$version/site-packages/*; \
mv -f $(EXTENSIONS_DIR)/python$$version/site-packages/*.py \
Thanks,
--
Colin Watson [[email protected]]
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]