Conditionally declare packages

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