from pythonforandroid.recipe import CompiledComponentsPythonRecipe


class PymunkRecipe(CompiledComponentsPythonRecipe):
    name = "pymunk"
    version = "6.0.0"
    url = "https://pypi.python.org/packages/source/p/pymunk/pymunk-{version}.zip"
    depends = ["cffi", "setuptools"]
    call_hostpython_via_targetpython = False

    def get_recipe_env(self, arch):
        env = super().get_recipe_env(arch)
        env["LDFLAGS"] += " -llog"
        return env


recipe = PymunkRecipe()

@@ -434,16 +434,112 @@
 %22 -llog%22
+  # Used by Chipmunk cpMessage%0A        env%5B%22LDFLAGS%22%5D += %22 -lm%22  # For older versions of Android
 %0A       

Fix Pymunk crash on older versions of Android