Skip to content

Commit 4c475d3

Browse files
committed
add doc (not finished) about how to create a recipe
1 parent fceb5fb commit 4c475d3

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

README.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,43 @@ Step 2, package your application::
7676
...
7777

7878

79+
Available modules
80+
-----------------
81+
82+
List of available modules: jpeg pil png sdl sqlite3
83+
84+
The up-to-date list is available at:
85+
https://github.com/tito/python-for-android/tree/master/recipes
86+
87+
Only hostpython and python are 2 mandatory recipes, used for building
88+
hostpython / target python libraries.
89+
90+
91+
Create your own recipes
92+
-----------------------
93+
94+
A recipe is a script that contain the "definition" of a module to compile.
95+
The directory layout of a recipe for a <modulename> is something like::
96+
97+
python-for-android/recipes/<modulename>/recipe.sh
98+
python-for-android/recipes/<modulename>/patches/
99+
python-for-android/recipes/<modulename>/patches/fix-path.patch
100+
101+
When building, all the recipe build must go to::
102+
103+
python-for-android/build/<modulename>/<archiveroot>
104+
105+
For example, if you want to create a recipe for sdl, do::
106+
107+
cd python-for-android/recipes
108+
mkdir sdl
109+
cp recipe.sh.tmpl sdl/recipe.sh
110+
sed -i 's#XXX#sdl' sdl/recipe.sh
111+
112+
Then, edit the sdl/recipe.sh to adjust other information (version, url) and
113+
complete build function.
114+
115+
79116
Related project
80117
---------------
81118

recipes/recipe.sh.tmpl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
#------------------------------------------------------------------------------
4+
# Recipe name
5+
# @author Your Name <[email protected]>
6+
#------------------------------------------------------------------------------
7+
8+
# REPLACE ALL THE "xxx" OF THIS FILE WITH THE MODULE NAME
9+
# THEN REMOVE THIS ERROR AND EXIT
10+
error "not configure" && exit -1
11+
12+
# priority of the recipe. python is compiled with priority 10.
13+
# to be compiled before python, use a number prior to 10
14+
# to be compiled after python, use a number after to 50 (recommanded)
15+
PRIORITY_xxx=15
16+
17+
# version of your package
18+
VERSION_xxx=1.3
19+
20+
# dependencies of this recipe
21+
DEPS_xxx=()
22+
23+
# url of the package
24+
URL_xxx=http://www.libxxx.org/xxx-$VERSION_xxx.tar.gz
25+
26+
# md5 of the package
27+
MD5_xxx=7176d5f1a0f2683bf1394e0de18c74bb
28+
29+
# default build path
30+
BUILD_xxx=$BUILD_PATH/xxx/$(get_directory $URL_xxx)
31+
32+
# default recipe path
33+
RECIPE_xxx=$RECIPES_PATH/xxx
34+
35+
# function called for preparing source code if needed
36+
# (you can apply patch etc here.)
37+
function prebuild_xxx() {
38+
true
39+
}
40+
41+
# function called to build the source code
42+
function build_xxx() {
43+
true
44+
}
45+
46+
# function called after all the compile have been done
47+
function postbuild_xxx() {
48+
true
49+
}

0 commit comments

Comments
 (0)