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()

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"  # Used by Chipmunk cpMessage
        env["LDFLAGS"] += " -lm"  # For older versions of Android
        return env


recipe = PymunkRecipe()

Fix Pymunk crash on older versions of Android
Fix Pymunk crash on older versions of Android

Seems to be required to link -lm on at least 5.1, but not on 8.0

  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"
+         env["LDFLAGS"] += " -llog"  # Used by Chipmunk cpMessage
+         env["LDFLAGS"] += " -lm"  # For older versions of Android
          return env
  
  
  recipe = PymunkRecipe()
  
Fix Pymunk crash on older versions of Android
## Code Before:
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()

## Instruction:
Fix Pymunk crash on older versions of Android
## Code After:
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"  # Used by Chipmunk cpMessage
        env["LDFLAGS"] += " -lm"  # For older versions of Android
        return env


recipe = PymunkRecipe()
