LongRecipe: Recipe for Efficient Long Context Generalization in Large Language Models