Fix native packaging bugs and add an integration test for testing the native packaging.