Skip to content

Added M2Crypto recipe #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2016
Merged

Added M2Crypto recipe #652

merged 1 commit into from
Mar 3, 2016

Conversation

brussee
Copy link
Contributor

@brussee brussee commented Feb 26, 2016

Tested with this script on Android 6.0.1: https://e1ven.com/2011/04/06/how-to-use-m2crypto-tutorial/

@inclement
Copy link
Member

Thanks. Do you think there is a case for a new recipe class setting these env vars for python recipes that need them (like CythonRecipe but for things other than cython)? If these things are general enough, it would make it easier to support e.g. multiple python versions.

inclement added a commit that referenced this pull request Mar 3, 2016
@inclement inclement merged commit b2ee58a into kivy:master Mar 3, 2016
@brussee brussee deleted the m2crypto-recipe branch March 4, 2016 21:00
@brussee
Copy link
Contributor Author

brussee commented Mar 4, 2016

I agree that there is a lot of similarity between the Apsw, M2Crypto and pyLevelDB recipes setting the python linker and including the headers. Why is this not needed by every python recipe is what I am wondering?
This part seems to be a bug btw, because without it the setup.py uses the default gcc for linking whereas the compilation step does use the right gcc for the architecture:

# Set linker to use the correct gcc
env['LDSHARED'] = env['CC'] 

Also these settings are recurring for all libraries that want to use the regular gnu c stl:

env['CFLAGS'] += ' -I' + self.ctx.ndk_dir + '/platforms/android-' + str(self.ctx.android_api) + '/arch-' + arch.arch.replace('eabi', '') + '/usr/include' + \
                 ' -I' + self.ctx.ndk_dir + '/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version + '/include' + \
                 ' -I' + self.ctx.ndk_dir + '/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version + '/libs/' + arch.arch + '/include'
env['CXXFLAGS'] = env['CFLAGS']
env['CXXFLAGS'] += ' -frtti'
env['CXXFLAGS'] += ' -fexceptions'
env['LDFLAGS'] += ' -L' + self.ctx.ndk_dir + '/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version + '/libs/' + arch.arch + \
                  ' -lgnustl_shared'

Perhaps a special recipe class could be made for that as well?

@inclement
Copy link
Member

This is not necessary in every python recipe because they don't normally
do any compilation. This is by design - PythonRecipe is intended for pure python things. I think the reason I didn't just add the compilation flags to PythonRecipe was so that it would be explicit when compiling recipes were used, especially when different types were chosen.

Actually, there's already a recipe for pythonrecipes with compiled
components. Maybe you can use that one, though I don't remember exactly
what conditions it targets. I'll take a look at this next time I have time.

On 04/03/16 21:07, Paul Brussee wrote:

I agree that there is a lot of similarity between the M2Crypto and
pyLevelDB recipes setting the python linker and including the headers.
Why is this not needed by /every/ python recipe is what I am wondering?
This part seems to be a bug btw, because without it the setup.py uses
the default gcc for linking whereas the compilation step /does/ use the
right gcc for the architecture.

|# Set linker to use the correct gcc env['LDSHARED'] = env['CC'] |

Also these settings are recurring for all libraries that want to use the
regular gnu c stl:

|env['CFLAGS'] += ' -I' + self.ctx.ndk_dir + '/platforms/android-' +
str(self.ctx.android_api) + '/arch-' + arch.arch.replace('eabi', '') +
'/usr/include' + \ ' -I' + self.ctx.ndk_dir +
'/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version +
'/include' + \ ' -I' + self.ctx.ndk_dir +
'/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version +
'/libs/' + arch.arch + '/include' env['CXXFLAGS'] = env['CFLAGS']
env['CXXFLAGS'] += ' -frtti' env['CXXFLAGS'] += ' -fexceptions'
env['LDFLAGS'] += ' -L' + self.ctx.ndk_dir +
'/sources/cxx-stl/gnu-libstdc++/' + self.ctx.toolchain_version +
'/libs/' + arch.arch + \ ' -lgnustl_shared' |

Perhaps a special recipe class could be made for that as well?


Reply to this email directly or view it on GitHub
#652 (comment).

@inclement
Copy link
Member

For the LDSHARED thing, where is that line of code? Right now it should use liblink.sh, or with crystax does use env['CC'] + '-shared', but this seems to work (maybe the gcc arch doesn't matter for the linking?). I don't know much about linking though, and could easily have missed something.

@brussee
Copy link
Contributor Author

brussee commented Mar 4, 2016

It is on line 36 of this recipe.

I tried refactoring it into a CompiledComponentsPythonRecipe but if I use the setup_extra_args it gives them not only tot the build call of setup.py but also to the install setup.py call and that is not what I want because that takes different arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants