libselinux/libsepolダイエットパッチ マージ!

やった!ついにマージされた!
http://marc.info/?l=selinux&m=118064545200576&w=2

Thanks, merged.

これで、libselinux, libsepolが分離された。正式なlibselinuxとしてリリースされるのが楽しみ。

以下、提出のときの説明文。
Hi.
As discussed in previous threads,
http://marc.info/?t=117609454600002&r=1&w=2
http://marc.info/?t=117886013000001&r=1&w=2
I would like to submit patch to reduce size of libselinux+libsepol, again.

1. Background
Current libselinux+libsepol size is big for embedded devices.
libselinux.so.1: 115348 byte
libsepol.so.1:302067
Total: 417415 byte
It uses more than 400kbyte.
Needs for embedded device is various, because hardware resource is various.
If device is rich enough, people may want full-featured SELinux.
If device is not rich, people want to reduce binary size by removing
some features.
For example, some may not want modular policy, may not want boolean.

We thought size of libselinux+libsepol can be reduced
by removing libsepol and removing unnecessary functions from libselinux.

2. What this patch does
1) libsepol is separated from libselinux
libsepol is not required by libselinux.
So you do not have to compile libsepol,
if you do not need libsepol functions.

2) Some features are disabled in libselinux
By typing "make EMBEDDED=y" in libselinux dir, what happens is following.
Following values are defined in Makefile.
>ifeq ($(EMBEDDED),y)
> override DISABLE_AVC=y
> override DISABLE_SETRANS=y
> override DISABLE_RPM=y
> override DISABLE_BOOL=y
>endif

* DISABLE_AVC
Disables user space avc support, avc.c avc_internal.c avc_sidtab.c are not compiled.
* DISABLE_SETRANS
Some functions of translations are replaced with stubs in setrans_client.c
* DISABLE_RPM
Disables rpm features, rpm.c are not compiled.
* DISABLE_BOOL
Disable boolean features, booleans.c are not compiled.

3) Fixes to libselinux/utils
* -lsepol is removed
* When make EMBEDDED=y, some utils are not compiled.

3. Size measurement
Compiled libselinux/libsepol in trunk by gcc(x86).

* Before
libselinux.so.1: 115348 byte
libsepol.so.1:302067
Total: 417415 byte

* After
libselinux.so.1: 77103 byte
libsepol.so.1:0 byte(do not have to compile)
Total: 77103 byte

Please consider merging this patch.