diff --git a/package/python-m2crypto/python-m2crypto.mk b/package/python-m2crypto/python-m2crypto.mk index 1f038e39cd..0416957942 100644 --- a/package/python-m2crypto/python-m2crypto.mk +++ b/package/python-m2crypto/python-m2crypto.mk @@ -13,20 +13,16 @@ HOST_PYTHON_M2CRYPTO_DEPENDENCIES = host-openssl host-swig # We need to use python2 because m2crypto is not python3 compliant. HOST_PYTHON_M2CRYPTO_NEEDS_HOST_PYTHON = python2 -HOST_PYTHON_M2CRYPTO_BUILD_DIR = $(@D)/build/lib.linux-$(HOSTARCH)-$(PYTHON_VERSION_MAJOR) - -# * We need to override the build commands to be able to use build_ext, -# which accepts the --openssl option. -# * Use python2 interpreter to avoid trying building some python3 objects. -# * because build_ext is flawed, is forgets to copy the files prior to -# the build, so we do it manually. -define HOST_PYTHON_M2CRYPTO_BUILD_CMDS - mkdir -p $(HOST_PYTHON_M2CRYPTO_BUILD_DIR) - cp -av $(@D)/M2Crypto $(HOST_PYTHON_M2CRYPTO_BUILD_DIR)/M2Crypto - (cd $(@D); \ - $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \ - $(HOST_DIR)/usr/bin/python2 setup.py build_ext \ - --openssl=$(HOST_DIR)/usr) +# The --openssl option that allows to specify a custom path to OpenSSL +# can only be used with the non-default build_ext setup.py command, +# and calling this command directly fails. To work around this, simply +# hardcode the path to OpenSSL in setup.py. +# Bug reported at https://gitlab.com/m2crypto/m2crypto/issues/89 +define HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH + $(SED) "s%self.openssl = '/usr'%self.openssl = '$(HOST_DIR)/usr'%" \ + $(@D)/setup.py endef +HOST_PYTHON_M2CRYPTO_POST_PATCH_HOOKS += HOST_PYTHON_M2CRYPTO_SET_OPENSSL_PATH + $(eval $(host-python-package))