Functionals defi ned on partitions in sets of nite perimeter II: semicontinuity, relaxation, homogenization