Conditionally declare packages

To avoid potential "duplicate resource definitions", wrap packages declarations in a conditional block.