[Android Software Development] jeffsf:
Build of twrp2.7 branch for ICS

First off, thanks for updating the build instructions! I'm excited to try out the fstab-based management of partitions.

I've had great success with building the twrp2.5 branch in the CyanogenMod "ics" branch. The lead post here suggests using the latest source branch, which looks to be twrp2.7

In ICS, as pointed out elsewhere, there isn't enough selinux support to build TWRP. Unfortunately, I can't seem to build TWRP from the twrp2.7 branch in that tree.

"HAVE_SELINUX" seems to have been replaced in Android.mk by "TWHAVE_SELINUX" which then sets "HAVE_SELINUX" if true. This makes more sense as the code seems to check if HAVE_SELINUX is defined, and not what its value might be.

Setting "TWHAVE_SELINUX := false" in BoardConfig.mk (with the other TWRP defines) unfortunately doesn't permit things to build.

With TWHAVE_SELINUX := false, the failure seems to be in updater/install.c where it is still looking for selinux headers.

target thumb C: updater <= bootable/recovery/updater/install.c
[...]
bootable/recovery/updater/install.c:30:29: error: selinux/selinux.h: No such file or directory
bootable/recovery/updater/install.c:31:17: error: ftw.h: No such file or directory
bootable/recovery/updater/install.c:32:28: error: sys/capability.h: No such file or directory
bootable/recovery/updater/install.c:33:23: error: sys/xattr.h: No such file or directory
[...]
make: *** [out/target/product/galaxys4gmtd/obj/EXECUTABLES/updater_intermediates/install.o] Error 1

More detail:

target thumb C: updater <= bootable/recovery/updater/install.c
prebuilt/linux-x86/ccache/ccache prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc -I bootable/recovery/updater/.. -I out/target/product/galaxys4gmtd/obj/PACKAGING/updater_extensions_intermediates/ -I bootable/recovery/updater -I out/target/product/galaxys4gmtd/obj/EXECUTABLES/updater_intermediates -I dalvik/libnativehelper/include/nativehelper -isystem system/core/include -isystem hardware/libhardware/include -isystem hardware/libhardware_legacy/include -isystem hardware/ril/include -isystem dalvik/libnativehelper/include -isystem frameworks/base/include -isystem frameworks/base/opengl/include -isystem frameworks/base/native/include -isystem external/skia/include -isystem out/target/product/galaxys4gmtd/obj/include -isystem bionic/libc/arch-arm/include -isystem bionic/libc/include -isystem bionic/libstdc++/include -isystem bionic/libc/kernel/common -isystem bionic/libc/kernel/arch-arm -isystem bionic/libm/include -isystem bionic/libm/include/arm -isystem bionic/libthread_db/include -c -fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections -fdata-sections -funwind-tables -fstack-protector -Wa,--noexecstack -Werror=format-security -fno-short-enums -march=armv7-a -mfloat-abi=softfp -mfpu=neon -include system/core/include/arch/linux-arm/AndroidConfig.h -I system/core/include/arch/linux-arm/ -Wno-psabi -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -DNDEBUG -g -Wstrict-aliasing=2 -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -MD -o out/target/product/galaxys4gmtd/obj/EXECUTABLES/updater_intermediates/install.o bootable/recovery/updater/install.c
bootable/recovery/updater/install.c:30:29: error: selinux/selinux.h: No such file or directory
bootable/recovery/updater/install.c:31:17: error: ftw.h: No such file or directory
bootable/recovery/updater/install.c:32:28: error: sys/capability.h: No such file or directory
bootable/recovery/updater/install.c:33:23: error: sys/xattr.h: No such file or directory
In file included from bootable/recovery/updater/install.c:41:
bootable/recovery/updater/../minzip/DirUtil.h:28:27: error: selinux/label.h: No such file or directory
In file included from bootable/recovery/updater/install.c:41:
bootable/recovery/updater/../minzip/DirUtil.h:45: warning: 'struct selabel_handle' declared inside parameter list
In file included from bootable/recovery/updater/updater.h:21,
from bootable/recovery/updater/install.c:44:
bootable/recovery/updater/../minzip/Zip.h:219: warning: 'struct selabel_handle' declared inside parameter list
In file included from bootable/recovery/updater/../applypatch/applypatch.h:22,
from bootable/recovery/updater/install.c:45:
bootable/recovery/updater/../minelf/Retouch.h:26: warning: 'packed' attribute ignored
bootable/recovery/updater/install.c: In function 'MountFn':
bootable/recovery/updater/install.c:91: warning: implicit declaration of function 'selabel_lookup'
bootable/recovery/updater/install.c:92: warning: implicit declaration of function 'setfscreatecon'
bootable/recovery/updater/install.c:98: warning: implicit declaration of function 'freecon'
bootable/recovery/updater/install.c: In function 'PackageExtractDirFn':
bootable/recovery/updater/install.c:375: warning: passing argument 8 of 'mzExtractRecursive' from incompatible pointer type
bootable/recovery/updater/../minzip/Zip.h:215: note: expected 'struct selabel_handle *' but argument is of type 'struct selabel_handle *'
bootable/recovery/updater/install.c: In function 'ApplyParsedPerms':
bootable/recovery/updater/install.c:777: warning: implicit declaration of function 'lsetfilecon'
bootable/recovery/updater/install.c:786: warning: implicit declaration of function 'removexattr'
bootable/recovery/updater/install.c:786: error: 'XATTR_NAME_CAPS' undeclared (first use in this function)
bootable/recovery/updater/install.c:786: error: (Each undeclared identifier is reported only once
bootable/recovery/updater/install.c:786: error: for each function it appears in.)
bootable/recovery/updater/install.c:793: error: storage size of 'cap_data' isn't known
bootable/recovery/updater/install.c:795: error: 'VFS_CAP_REVISION' undeclared (first use in this function)
bootable/recovery/updater/install.c:795: error: 'VFS_CAP_FLAGS_EFFECTIVE' undeclared (first use in this function)
bootable/recovery/updater/install.c:800: warning: implicit declaration of function 'setxattr'
bootable/recovery/updater/install.c: At top level:
bootable/recovery/updater/install.c:816: warning: 'struct FTW' declared inside parameter list
bootable/recovery/updater/install.c: In function 'SetMetadataFn':
bootable/recovery/updater/install.c:846: warning: implicit declaration of function 'nftw'
bootable/recovery/updater/install.c:846: error: 'FTW_CHDIR' undeclared (first use in this function)
bootable/recovery/updater/install.c:846: error: 'FTW_DEPTH' undeclared (first use in this function)
bootable/recovery/updater/install.c:846: error: 'FTW_PHYS' undeclared (first use in this function)
bootable/recovery/updater/install.c: In function 'Sha1CheckFn':
bootable/recovery/updater/install.c:1273: warning: implicit declaration of function 'SHA_hash'
make: *** [out/target/product/galaxys4gmtd/obj/EXECUTABLES/updater_intermediates/install.o] Error 1

Should I be continuing to try to get the twrp2.7 branch to compile? If so, any recommendations on how to get selinux "turned off" appropriately?

Thanks!