Skip to content

Commit 5ed46a7

Browse files
committed
Merge pull request #549 from brussee/master
added recipe libsodium
2 parents 645a140 + 2299045 commit 5ed46a7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2+
from os.path import exists, join
3+
import sh
4+
5+
class LibsodiumRecipe(Recipe):
6+
version = '1.0.8'
7+
url = 'https://github.com/jedisct1/libsodium/releases/download/{version}/libsodium-{version}.tar.gz'
8+
depends = ['python2']
9+
10+
def should_build(self, arch):
11+
super(LibsodiumRecipe, self).should_build(arch)
12+
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libsodium.so'))
13+
14+
def build_arch(self, arch):
15+
super(LibsodiumRecipe, self).build_arch(arch)
16+
env = self.get_recipe_env(arch)
17+
with current_directory(self.get_build_dir(arch.arch)):
18+
bash = sh.Command('bash')
19+
shprint(bash, 'configure', '--enable-minimal', '--disable-soname-versions', '--host=arm-linux-androideabi', '--enable-shared', _env=env)
20+
shprint(sh.make, _env=env)
21+
shutil.copyfile('src/libsodium/.libs/libsodium.so', join(self.ctx.get_libs_dir(arch.arch), 'libsodium.so'))
22+
23+
def get_recipe_env(self, arch):
24+
env = super(LibsodiumRecipe, self).get_recipe_env(arch)
25+
env['CFLAGS'] += ' -Os'
26+
return env
27+
28+
recipe = LibsodiumRecipe()

0 commit comments

Comments
 (0)