diff options
author | Richard Purdie <richard@openedhand.com> | 2005-08-31 10:45:47 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2005-08-31 10:45:47 +0000 |
commit | 4b46c1f6e891b1ddd5968536440b888661fade3e (patch) | |
tree | e0ba2c1f56f61b868bf746da5c4feabb25b800b2 /openembedded/classes | |
download | poky-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.gz |
Initial population
git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/classes')
71 files changed, 5026 insertions, 0 deletions
diff --git a/openembedded/classes/autotools.bbclass b/openembedded/classes/autotools.bbclass new file mode 100644 index 0000000000..8a387da5ca --- /dev/null +++ b/openembedded/classes/autotools.bbclass | |||
@@ -0,0 +1,153 @@ | |||
1 | inherit base | ||
2 | |||
3 | def autotools_dep_prepend(d): | ||
4 | import bb; | ||
5 | |||
6 | if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1): | ||
7 | return '' | ||
8 | |||
9 | pn = bb.data.getVar('PN', d, 1) | ||
10 | deps = '' | ||
11 | |||
12 | if pn in ['autoconf-native', 'automake-native']: | ||
13 | return deps | ||
14 | deps += 'autoconf-native automake-native ' | ||
15 | |||
16 | if not pn in ['libtool', 'libtool-native', 'libtool-cross']: | ||
17 | deps += 'libtool-native ' | ||
18 | |||
19 | return deps + 'gnu-config-native ' | ||
20 | |||
21 | EXTRA_OEMAKE = "" | ||
22 | DEPENDS_prepend = "${@autotools_dep_prepend(d)}" | ||
23 | acpaths = "default" | ||
24 | EXTRA_AUTORECONF = "--exclude=autopoint" | ||
25 | |||
26 | def autotools_set_crosscompiling(d): | ||
27 | import bb | ||
28 | if not bb.data.inherits_class('native', d): | ||
29 | return " cross_compiling=yes" | ||
30 | return "" | ||
31 | |||
32 | # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}" | ||
33 | |||
34 | oe_runconf () { | ||
35 | if [ -x ${S}/configure ] ; then | ||
36 | cfgcmd="${S}/configure \ | ||
37 | --build=${BUILD_SYS} \ | ||
38 | --host=${HOST_SYS} \ | ||
39 | --target=${TARGET_SYS} \ | ||
40 | --prefix=${prefix} \ | ||
41 | --exec_prefix=${exec_prefix} \ | ||
42 | --bindir=${bindir} \ | ||
43 | --sbindir=${sbindir} \ | ||
44 | --libexecdir=${libexecdir} \ | ||
45 | --datadir=${datadir} \ | ||
46 | --sysconfdir=${sysconfdir} \ | ||
47 | --sharedstatedir=${sharedstatedir} \ | ||
48 | --localstatedir=${localstatedir} \ | ||
49 | --libdir=${libdir} \ | ||
50 | --includedir=${includedir} \ | ||
51 | --oldincludedir=${oldincludedir} \ | ||
52 | --infodir=${infodir} \ | ||
53 | --mandir=${mandir} \ | ||
54 | ${EXTRA_OECONF} \ | ||
55 | $@" | ||
56 | oenote "Running $cfgcmd..." | ||
57 | $cfgcmd || oefatal "oe_runconf failed" | ||
58 | else | ||
59 | oefatal "no configure script found" | ||
60 | fi | ||
61 | } | ||
62 | |||
63 | autotools_do_configure() { | ||
64 | case ${PN} in | ||
65 | autoconf*) | ||
66 | ;; | ||
67 | automake*) | ||
68 | ;; | ||
69 | *) | ||
70 | # WARNING: gross hack follows: | ||
71 | # An autotools built package generally needs these scripts, however only | ||
72 | # automake or libtoolize actually install the current versions of them. | ||
73 | # This is a problem in builds that do not use libtool or automake, in the case | ||
74 | # where we -need- the latest version of these scripts. e.g. running a build | ||
75 | # for a package whose autotools are old, on an x86_64 machine, which the old | ||
76 | # config.sub does not support. Work around this by installing them manually | ||
77 | # regardless. | ||
78 | ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do | ||
79 | rm -f `dirname $ac`/configure | ||
80 | done ) | ||
81 | if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then | ||
82 | olddir=`pwd` | ||
83 | cd ${S} | ||
84 | if [ x"${acpaths}" = xdefault ]; then | ||
85 | acpaths= | ||
86 | for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \ | ||
87 | grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do | ||
88 | acpaths="$acpaths -I $i" | ||
89 | done | ||
90 | else | ||
91 | acpaths="${acpaths}" | ||
92 | fi | ||
93 | AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"` | ||
94 | automake --version | ||
95 | echo "AUTOV is $AUTOV" | ||
96 | install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal | ||
97 | install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV | ||
98 | acpaths="$acpaths -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal" | ||
99 | # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look | ||
100 | # like it was auto-generated. Work around this by blowing it away | ||
101 | # by hand, unless the package specifically asked not to run aclocal. | ||
102 | if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then | ||
103 | rm -f aclocal.m4 | ||
104 | fi | ||
105 | if [ -e configure.in ]; then | ||
106 | CONFIGURE_AC=configure.in | ||
107 | else | ||
108 | CONFIGURE_AC=configure.ac | ||
109 | fi | ||
110 | if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then | ||
111 | if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then | ||
112 | : do nothing -- we still have an old unmodified configure.ac | ||
113 | else | ||
114 | oenote Executing glib-gettextize --force --copy | ||
115 | echo "no" | glib-gettextize --force --copy | ||
116 | fi | ||
117 | fi | ||
118 | if grep "^AC_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then | ||
119 | oenote Executing intltoolize --copy --force --automake | ||
120 | intltoolize --copy --force --automake | ||
121 | fi | ||
122 | oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths | ||
123 | mkdir -p m4 | ||
124 | autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed." | ||
125 | cd $olddir | ||
126 | fi | ||
127 | ;; | ||
128 | esac | ||
129 | if [ -e ${S}/configure ]; then | ||
130 | oe_runconf | ||
131 | else | ||
132 | oenote "nothing to configure" | ||
133 | fi | ||
134 | } | ||
135 | |||
136 | autotools_do_install() { | ||
137 | oe_runmake 'DESTDIR=${D}' install | ||
138 | } | ||
139 | |||
140 | STAGE_TEMP="${WORKDIR}/temp-staging" | ||
141 | |||
142 | autotools_stage_includes() { | ||
143 | if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ] | ||
144 | then | ||
145 | rm -rf ${STAGE_TEMP} | ||
146 | mkdir -p ${STAGE_TEMP} | ||
147 | make DESTDIR="${STAGE_TEMP}" install | ||
148 | cp -a ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR} | ||
149 | rm -rf ${STAGE_TEMP} | ||
150 | fi | ||
151 | } | ||
152 | |||
153 | EXPORT_FUNCTIONS do_configure do_install | ||
diff --git a/openembedded/classes/base.bbclass b/openembedded/classes/base.bbclass new file mode 100644 index 0000000000..37254b94ba --- /dev/null +++ b/openembedded/classes/base.bbclass | |||
@@ -0,0 +1,801 @@ | |||
1 | PATCHES_DIR="${S}" | ||
2 | |||
3 | def base_dep_prepend(d): | ||
4 | import bb; | ||
5 | # | ||
6 | # Ideally this will check a flag so we will operate properly in | ||
7 | # the case where host == build == target, for now we don't work in | ||
8 | # that case though. | ||
9 | # | ||
10 | deps = "" | ||
11 | |||
12 | # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not | ||
13 | # we need that built is the responsibility of the patch function / class, not | ||
14 | # the application. | ||
15 | patchdeps = bb.data.getVar("PATCH_DEPENDS", d, 1) | ||
16 | if patchdeps and not patchdeps in bb.data.getVar("PROVIDES", d, 1): | ||
17 | deps = patchdeps | ||
18 | |||
19 | if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d): | ||
20 | if (bb.data.getVar('HOST_SYS', d, 1) != | ||
21 | bb.data.getVar('BUILD_SYS', d, 1)): | ||
22 | deps += " virtual/${TARGET_PREFIX}gcc virtual/libc " | ||
23 | return deps | ||
24 | |||
25 | def base_read_file(filename): | ||
26 | import bb | ||
27 | try: | ||
28 | f = file( filename, "r" ) | ||
29 | except IOError, reason: | ||
30 | raise bb.build.FuncFailed("can't read from file '%s' (%s)", (filename,reason)) | ||
31 | else: | ||
32 | return f.read().strip() | ||
33 | return None | ||
34 | |||
35 | def base_conditional(variable, checkvalue, truevalue, falsevalue, d): | ||
36 | import bb | ||
37 | if bb.data.getVar(variable,d,1) == checkvalue: | ||
38 | return truevalue | ||
39 | else: | ||
40 | return falsevalue | ||
41 | |||
42 | DEPENDS_prepend="${@base_dep_prepend(d)} " | ||
43 | |||
44 | def base_set_filespath(path, d): | ||
45 | import os, bb | ||
46 | filespath = [] | ||
47 | for p in path: | ||
48 | overrides = bb.data.getVar("OVERRIDES", d, 1) or "" | ||
49 | overrides = overrides + ":" | ||
50 | for o in overrides.split(":"): | ||
51 | filespath.append(os.path.join(p, o)) | ||
52 | bb.data.setVar("FILESPATH", ":".join(filespath), d) | ||
53 | |||
54 | FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}" | ||
55 | |||
56 | def oe_filter(f, str, d): | ||
57 | from re import match | ||
58 | return " ".join(filter(lambda x: match(f, x, 0), str.split())) | ||
59 | |||
60 | def oe_filter_out(f, str, d): | ||
61 | from re import match | ||
62 | return " ".join(filter(lambda x: not match(f, x, 0), str.split())) | ||
63 | |||
64 | die() { | ||
65 | oefatal "$*" | ||
66 | } | ||
67 | |||
68 | oenote() { | ||
69 | echo "NOTE:" "$*" | ||
70 | } | ||
71 | |||
72 | oewarn() { | ||
73 | echo "WARNING:" "$*" | ||
74 | } | ||
75 | |||
76 | oefatal() { | ||
77 | echo "FATAL:" "$*" | ||
78 | exit 1 | ||
79 | } | ||
80 | |||
81 | oedebug() { | ||
82 | test $# -ge 2 || { | ||
83 | echo "Usage: oedebug level \"message\"" | ||
84 | exit 1 | ||
85 | } | ||
86 | |||
87 | test ${OEDEBUG:-0} -ge $1 && { | ||
88 | shift | ||
89 | echo "DEBUG:" $* | ||
90 | } | ||
91 | } | ||
92 | |||
93 | oe_runmake() { | ||
94 | if [ x"$MAKE" = x ]; then MAKE=make; fi | ||
95 | oenote ${MAKE} ${EXTRA_OEMAKE} "$@" | ||
96 | ${MAKE} ${EXTRA_OEMAKE} "$@" || die "oe_runmake failed" | ||
97 | } | ||
98 | |||
99 | oe_soinstall() { | ||
100 | # Purpose: Install shared library file and | ||
101 | # create the necessary links | ||
102 | # Example: | ||
103 | # | ||
104 | # oe_ | ||
105 | # | ||
106 | #oenote installing shared library $1 to $2 | ||
107 | # | ||
108 | libname=`basename $1` | ||
109 | install -m 755 $1 $2/$libname | ||
110 | sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'` | ||
111 | solink=`echo $libname | sed -e 's/\.so\..*/.so/'` | ||
112 | ln -sf $libname $2/$sonamelink | ||
113 | ln -sf $libname $2/$solink | ||
114 | } | ||
115 | |||
116 | oe_libinstall() { | ||
117 | # Purpose: Install a library, in all its forms | ||
118 | # Example | ||
119 | # | ||
120 | # oe_libinstall libltdl ${STAGING_LIBDIR}/ | ||
121 | # oe_libinstall -C src/libblah libblah ${D}/${libdir}/ | ||
122 | dir="" | ||
123 | libtool="" | ||
124 | silent="" | ||
125 | require_static="" | ||
126 | require_shared="" | ||
127 | while [ "$#" -gt 0 ]; do | ||
128 | case "$1" in | ||
129 | -C) | ||
130 | shift | ||
131 | dir="$1" | ||
132 | ;; | ||
133 | -s) | ||
134 | silent=1 | ||
135 | ;; | ||
136 | -a) | ||
137 | require_static=1 | ||
138 | ;; | ||
139 | -so) | ||
140 | require_shared=1 | ||
141 | ;; | ||
142 | -*) | ||
143 | oefatal "oe_libinstall: unknown option: $1" | ||
144 | ;; | ||
145 | *) | ||
146 | break; | ||
147 | ;; | ||
148 | esac | ||
149 | shift | ||
150 | done | ||
151 | |||
152 | libname="$1" | ||
153 | shift | ||
154 | destpath="$1" | ||
155 | if [ -z "$destpath" ]; then | ||
156 | oefatal "oe_libinstall: no destination path specified" | ||
157 | fi | ||
158 | |||
159 | __runcmd () { | ||
160 | if [ -z "$silent" ]; then | ||
161 | echo >&2 "oe_libinstall: $*" | ||
162 | fi | ||
163 | $* | ||
164 | } | ||
165 | |||
166 | if [ -z "$dir" ]; then | ||
167 | dir=`pwd` | ||
168 | fi | ||
169 | if [ -d "$dir/.libs" ]; then | ||
170 | dir=$dir/.libs | ||
171 | fi | ||
172 | olddir=`pwd` | ||
173 | __runcmd cd $dir | ||
174 | |||
175 | lafile=$libname.la | ||
176 | if [ -f "$lafile" ]; then | ||
177 | # libtool archive | ||
178 | eval `cat $lafile|grep "^library_names="` | ||
179 | libtool=1 | ||
180 | else | ||
181 | library_names="$libname.so* $libname.dll.a" | ||
182 | fi | ||
183 | |||
184 | __runcmd install -d $destpath/ | ||
185 | dota=$libname.a | ||
186 | if [ -f "$dota" -o -n "$require_static" ]; then | ||
187 | __runcmd install -m 0644 $dota $destpath/ | ||
188 | fi | ||
189 | dotlai=$libname.lai | ||
190 | if [ -f "$dotlai" -a -n "$libtool" ]; then | ||
191 | __runcmd install -m 0644 $dotlai $destpath/$libname.la | ||
192 | fi | ||
193 | |||
194 | for name in $library_names; do | ||
195 | files=`eval echo $name` | ||
196 | for f in $files; do | ||
197 | if [ ! -e "$f" ]; then | ||
198 | if [ -n "$libtool" ]; then | ||
199 | oefatal "oe_libinstall: $dir/$f not found." | ||
200 | fi | ||
201 | elif [ -L "$f" ]; then | ||
202 | __runcmd cp -P "$f" $destpath/ | ||
203 | elif [ ! -L "$f" ]; then | ||
204 | libfile="$f" | ||
205 | __runcmd install -m 0755 $libfile $destpath/ | ||
206 | fi | ||
207 | done | ||
208 | done | ||
209 | |||
210 | if [ -z "$libfile" ]; then | ||
211 | if [ -n "$require_shared" ]; then | ||
212 | oefatal "oe_libinstall: unable to locate shared library" | ||
213 | fi | ||
214 | elif [ -z "$libtool" ]; then | ||
215 | # special case hack for non-libtool .so.#.#.# links | ||
216 | baselibfile=`basename "$libfile"` | ||
217 | if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then | ||
218 | sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'` | ||
219 | solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'` | ||
220 | if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then | ||
221 | __runcmd ln -sf $baselibfile $destpath/$sonamelink | ||
222 | fi | ||
223 | __runcmd ln -sf $baselibfile $destpath/$solink | ||
224 | fi | ||
225 | fi | ||
226 | |||
227 | __runcmd cd "$olddir" | ||
228 | } | ||
229 | |||
230 | oe_machinstall() { | ||
231 | # Purpose: Install machine dependent files, if available | ||
232 | # If not available, check if there is a default | ||
233 | # If no default, just touch the destination | ||
234 | # Example: | ||
235 | # $1 $2 $3 $4 | ||
236 | # oe_machinstall -m 0644 fstab ${D}/etc/fstab | ||
237 | # | ||
238 | # TODO: Check argument number? | ||
239 | # | ||
240 | filename=`basename $3` | ||
241 | dirname=`dirname $3` | ||
242 | |||
243 | for o in `echo ${OVERRIDES} | tr ':' ' '`; do | ||
244 | if [ -e $dirname/$o/$filename ]; then | ||
245 | oenote $dirname/$o/$filename present, installing to $4 | ||
246 | install $1 $2 $dirname/$o/$filename $4 | ||
247 | return | ||
248 | fi | ||
249 | done | ||
250 | # oenote overrides specific file NOT present, trying default=$3... | ||
251 | if [ -e $3 ]; then | ||
252 | oenote $3 present, installing to $4 | ||
253 | install $1 $2 $3 $4 | ||
254 | else | ||
255 | oenote $3 NOT present, touching empty $4 | ||
256 | touch $4 | ||
257 | fi | ||
258 | } | ||
259 | |||
260 | addtask showdata | ||
261 | do_showdata[nostamp] = "1" | ||
262 | python do_showdata() { | ||
263 | import sys | ||
264 | # emit variables and shell functions | ||
265 | bb.data.emit_env(sys.__stdout__, d, True) | ||
266 | # emit the metadata which isnt valid shell | ||
267 | for e in d.keys(): | ||
268 | if bb.data.getVarFlag(e, 'python', d): | ||
269 | sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1))) | ||
270 | } | ||
271 | |||
272 | addtask listtasks | ||
273 | do_listtasks[nostamp] = "1" | ||
274 | python do_listtasks() { | ||
275 | import sys | ||
276 | # emit variables and shell functions | ||
277 | #bb.data.emit_env(sys.__stdout__, d) | ||
278 | # emit the metadata which isnt valid shell | ||
279 | for e in d.keys(): | ||
280 | if bb.data.getVarFlag(e, 'task', d): | ||
281 | sys.__stdout__.write("%s\n" % e) | ||
282 | } | ||
283 | |||
284 | addtask clean | ||
285 | do_clean[dirs] = "${TOPDIR}" | ||
286 | do_clean[nostamp] = "1" | ||
287 | do_clean[bbdepcmd] = "" | ||
288 | python base_do_clean() { | ||
289 | """clear the build and temp directories""" | ||
290 | dir = bb.data.expand("${WORKDIR}", d) | ||
291 | if dir == '//': raise bb.build.FuncFailed("wrong DATADIR") | ||
292 | bb.note("removing " + dir) | ||
293 | os.system('rm -rf ' + dir) | ||
294 | |||
295 | dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d) | ||
296 | bb.note("removing " + dir) | ||
297 | os.system('rm -f '+ dir) | ||
298 | } | ||
299 | |||
300 | addtask mrproper | ||
301 | do_mrproper[dirs] = "${TOPDIR}" | ||
302 | do_mrproper[nostamp] = "1" | ||
303 | do_mrproper[bbdepcmd] = "" | ||
304 | python base_do_mrproper() { | ||
305 | """clear downloaded sources, build and temp directories""" | ||
306 | dir = bb.data.expand("${DL_DIR}", d) | ||
307 | if dir == '/': bb.build.FuncFailed("wrong DATADIR") | ||
308 | bb.debug(2, "removing " + dir) | ||
309 | os.system('rm -rf ' + dir) | ||
310 | bb.build.exec_task('do_clean', d) | ||
311 | } | ||
312 | |||
313 | addtask fetch | ||
314 | do_fetch[dirs] = "${DL_DIR}" | ||
315 | do_fetch[nostamp] = "1" | ||
316 | python base_do_fetch() { | ||
317 | import sys | ||
318 | |||
319 | localdata = bb.data.createCopy(d) | ||
320 | bb.data.update_data(localdata) | ||
321 | |||
322 | src_uri = bb.data.getVar('SRC_URI', localdata, 1) | ||
323 | if not src_uri: | ||
324 | return 1 | ||
325 | |||
326 | try: | ||
327 | bb.fetch.init(src_uri.split(),d) | ||
328 | except bb.fetch.NoMethodError: | ||
329 | (type, value, traceback) = sys.exc_info() | ||
330 | raise bb.build.FuncFailed("No method: %s" % value) | ||
331 | |||
332 | try: | ||
333 | bb.fetch.go(localdata) | ||
334 | except bb.fetch.MissingParameterError: | ||
335 | (type, value, traceback) = sys.exc_info() | ||
336 | raise bb.build.FuncFailed("Missing parameters: %s" % value) | ||
337 | except bb.fetch.FetchError: | ||
338 | (type, value, traceback) = sys.exc_info() | ||
339 | raise bb.build.FuncFailed("Fetch failed: %s" % value) | ||
340 | } | ||
341 | |||
342 | def oe_unpack_file(file, data, url = None): | ||
343 | import bb, os | ||
344 | if not url: | ||
345 | url = "file://%s" % file | ||
346 | dots = file.split(".") | ||
347 | if dots[-1] in ['gz', 'bz2', 'Z']: | ||
348 | efile = os.path.join(bb.data.getVar('WORKDIR', data, 1),os.path.basename('.'.join(dots[0:-1]))) | ||
349 | else: | ||
350 | efile = file | ||
351 | cmd = None | ||
352 | if file.endswith('.tar'): | ||
353 | cmd = 'tar x --no-same-owner -f %s' % file | ||
354 | elif file.endswith('.tgz') or file.endswith('.tar.gz'): | ||
355 | cmd = 'tar xz --no-same-owner -f %s' % file | ||
356 | elif file.endswith('.tbz') or file.endswith('.tar.bz2'): | ||
357 | cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file | ||
358 | elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): | ||
359 | cmd = 'gzip -dc %s > %s' % (file, efile) | ||
360 | elif file.endswith('.bz2'): | ||
361 | cmd = 'bzip2 -dc %s > %s' % (file, efile) | ||
362 | elif file.endswith('.zip'): | ||
363 | cmd = 'unzip -q %s' % file | ||
364 | elif os.path.isdir(file): | ||
365 | filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, 1)) | ||
366 | destdir = "." | ||
367 | if file[0:len(filesdir)] == filesdir: | ||
368 | destdir = file[len(filesdir):file.rfind('/')] | ||
369 | destdir = destdir.strip('/') | ||
370 | if len(destdir) < 1: | ||
371 | destdir = "." | ||
372 | elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK): | ||
373 | os.makedirs("%s/%s" % (os.getcwd(), destdir)) | ||
374 | cmd = 'cp -a %s %s/%s/' % (file, os.getcwd(), destdir) | ||
375 | else: | ||
376 | (type, host, path, user, pswd, parm) = bb.decodeurl(url) | ||
377 | if not 'patch' in parm: | ||
378 | # The "destdir" handling was specifically done for FILESPATH | ||
379 | # items. So, only do so for file:// entries. | ||
380 | if type == "file": | ||
381 | destdir = bb.decodeurl(url)[1] or "." | ||
382 | else: | ||
383 | destdir = "." | ||
384 | bb.mkdirhier("%s/%s" % (os.getcwd(), destdir)) | ||
385 | cmd = 'cp %s %s/%s/' % (file, os.getcwd(), destdir) | ||
386 | if not cmd: | ||
387 | return True | ||
388 | cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) | ||
389 | bb.note("Unpacking %s to %s/" % (file, os.getcwd())) | ||
390 | ret = os.system(cmd) | ||
391 | return ret == 0 | ||
392 | |||
393 | addtask unpack after do_fetch | ||
394 | do_unpack[dirs] = "${WORKDIR}" | ||
395 | python base_do_unpack() { | ||
396 | import re, os | ||
397 | |||
398 | localdata = bb.data.createCopy(d) | ||
399 | bb.data.update_data(localdata) | ||
400 | |||
401 | src_uri = bb.data.getVar('SRC_URI', localdata) | ||
402 | if not src_uri: | ||
403 | return | ||
404 | src_uri = bb.data.expand(src_uri, localdata) | ||
405 | for url in src_uri.split(): | ||
406 | try: | ||
407 | local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) | ||
408 | except bb.MalformedUrl, e: | ||
409 | raise FuncFailed('Unable to generate local path for malformed uri: %s' % e) | ||
410 | # dont need any parameters for extraction, strip them off | ||
411 | local = re.sub(';.*$', '', local) | ||
412 | local = os.path.realpath(local) | ||
413 | ret = oe_unpack_file(local, localdata, url) | ||
414 | if not ret: | ||
415 | raise bb.build.FuncFailed() | ||
416 | } | ||
417 | |||
418 | addtask patch after do_unpack | ||
419 | do_patch[dirs] = "${WORKDIR}" | ||
420 | python base_do_patch() { | ||
421 | import re | ||
422 | import bb.fetch | ||
423 | |||
424 | src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() | ||
425 | if not src_uri: | ||
426 | return | ||
427 | |||
428 | patchcleancmd = bb.data.getVar('PATCHCLEANCMD', d, 1) | ||
429 | if patchcleancmd: | ||
430 | bb.data.setVar("do_patchcleancmd", patchcleancmd, d) | ||
431 | bb.data.setVarFlag("do_patchcleancmd", "func", 1, d) | ||
432 | bb.build.exec_func("do_patchcleancmd", d) | ||
433 | |||
434 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
435 | for url in src_uri: | ||
436 | |||
437 | (type, host, path, user, pswd, parm) = bb.decodeurl(url) | ||
438 | if not "patch" in parm: | ||
439 | continue | ||
440 | |||
441 | bb.fetch.init([url], d) | ||
442 | url = bb.encodeurl((type, host, path, user, pswd, [])) | ||
443 | local = os.path.join('/', bb.fetch.localpath(url, d)) | ||
444 | |||
445 | # did it need to be unpacked? | ||
446 | dots = os.path.basename(local).split(".") | ||
447 | if dots[-1] in ['gz', 'bz2', 'Z']: | ||
448 | unpacked = os.path.join(bb.data.getVar('WORKDIR', d),'.'.join(dots[0:-1])) | ||
449 | else: | ||
450 | unpacked = local | ||
451 | unpacked = bb.data.expand(unpacked, d) | ||
452 | |||
453 | if "pnum" in parm: | ||
454 | pnum = parm["pnum"] | ||
455 | else: | ||
456 | pnum = "1" | ||
457 | |||
458 | if "pname" in parm: | ||
459 | pname = parm["pname"] | ||
460 | else: | ||
461 | pname = os.path.basename(unpacked) | ||
462 | |||
463 | bb.note("Applying patch '%s'" % pname) | ||
464 | bb.data.setVar("do_patchcmd", bb.data.getVar("PATCHCMD", d, 1) % (pnum, pname, unpacked), d) | ||
465 | bb.data.setVarFlag("do_patchcmd", "func", 1, d) | ||
466 | bb.data.setVarFlag("do_patchcmd", "dirs", "${WORKDIR} ${S}", d) | ||
467 | bb.build.exec_func("do_patchcmd", d) | ||
468 | } | ||
469 | |||
470 | |||
471 | addhandler base_eventhandler | ||
472 | python base_eventhandler() { | ||
473 | from bb import note, error, data | ||
474 | from bb.event import Handled, NotHandled, getName | ||
475 | import os | ||
476 | |||
477 | messages = {} | ||
478 | messages["Completed"] = "completed" | ||
479 | messages["Succeeded"] = "completed" | ||
480 | messages["Started"] = "started" | ||
481 | messages["Failed"] = "failed" | ||
482 | |||
483 | name = getName(e) | ||
484 | msg = "" | ||
485 | if name.startswith("Pkg"): | ||
486 | msg += "package %s: " % data.getVar("P", e.data, 1) | ||
487 | msg += messages.get(name[3:]) or name[3:] | ||
488 | elif name.startswith("Task"): | ||
489 | msg += "package %s: task %s: " % (data.getVar("PF", e.data, 1), e.task) | ||
490 | msg += messages.get(name[4:]) or name[4:] | ||
491 | elif name.startswith("Build"): | ||
492 | msg += "build %s: " % e.name | ||
493 | msg += messages.get(name[5:]) or name[5:] | ||
494 | elif name == "UnsatisfiedDep": | ||
495 | msg += "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower()) | ||
496 | note(msg) | ||
497 | |||
498 | if name.startswith("BuildStarted"): | ||
499 | statusvars = ['TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', | ||
500 | 'TARGET_FPU'] | ||
501 | statuslines = ["%-13s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars] | ||
502 | statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) | ||
503 | print statusmsg | ||
504 | |||
505 | needed_vars = [ "TARGET_ARCH", "TARGET_OS" ] | ||
506 | pesteruser = [] | ||
507 | for v in needed_vars: | ||
508 | val = bb.data.getVar(v, e.data, 1) | ||
509 | if not val or val == 'INVALID': | ||
510 | pesteruser.append(v) | ||
511 | if pesteruser: | ||
512 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) | ||
513 | |||
514 | if not data in e.__dict__: | ||
515 | return NotHandled | ||
516 | |||
517 | log = data.getVar("EVENTLOG", e.data, 1) | ||
518 | if log: | ||
519 | logfile = file(log, "a") | ||
520 | logfile.write("%s\n" % msg) | ||
521 | logfile.close() | ||
522 | |||
523 | return NotHandled | ||
524 | } | ||
525 | |||
526 | addtask configure after do_unpack do_patch | ||
527 | do_configure[dirs] = "${S} ${B}" | ||
528 | do_configure[bbdepcmd] = "do_populate_staging" | ||
529 | base_do_configure() { | ||
530 | : | ||
531 | } | ||
532 | |||
533 | addtask compile after do_configure | ||
534 | do_compile[dirs] = "${S} ${B}" | ||
535 | do_compile[bbdepcmd] = "do_populate_staging" | ||
536 | base_do_compile() { | ||
537 | if [ -e Makefile -o -e makefile ]; then | ||
538 | oe_runmake || die "make failed" | ||
539 | else | ||
540 | oenote "nothing to compile" | ||
541 | fi | ||
542 | } | ||
543 | |||
544 | |||
545 | addtask stage after do_compile | ||
546 | base_do_stage () { | ||
547 | : | ||
548 | } | ||
549 | |||
550 | do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${TARGET_SYS}/lib \ | ||
551 | ${STAGING_DIR}/${TARGET_SYS}/include \ | ||
552 | ${STAGING_DIR}/${BUILD_SYS}/bin ${STAGING_DIR}/${BUILD_SYS}/lib \ | ||
553 | ${STAGING_DIR}/${BUILD_SYS}/include \ | ||
554 | ${STAGING_DATADIR} \ | ||
555 | ${S} ${B}" | ||
556 | |||
557 | addtask populate_staging after do_compile | ||
558 | |||
559 | #python do_populate_staging () { | ||
560 | # if not bb.data.getVar('manifest', d): | ||
561 | # bb.build.exec_func('do_emit_manifest', d) | ||
562 | # if bb.data.getVar('do_stage', d): | ||
563 | # bb.build.exec_func('do_stage', d) | ||
564 | # else: | ||
565 | # bb.build.exec_func('manifest_do_populate_staging', d) | ||
566 | #} | ||
567 | |||
568 | python do_populate_staging () { | ||
569 | if bb.data.getVar('manifest_do_populate_staging', d): | ||
570 | bb.build.exec_func('manifest_do_populate_staging', d) | ||
571 | else: | ||
572 | bb.build.exec_func('do_stage', d) | ||
573 | } | ||
574 | |||
575 | #addtask install | ||
576 | addtask install after do_compile | ||
577 | do_install[dirs] = "${S} ${B}" | ||
578 | |||
579 | base_do_install() { | ||
580 | : | ||
581 | } | ||
582 | |||
583 | #addtask populate_pkgs after do_compile | ||
584 | #python do_populate_pkgs () { | ||
585 | # if not bb.data.getVar('manifest', d): | ||
586 | # bb.build.exec_func('do_emit_manifest', d) | ||
587 | # bb.build.exec_func('manifest_do_populate_pkgs', d) | ||
588 | # bb.build.exec_func('package_do_shlibs', d) | ||
589 | #} | ||
590 | |||
591 | base_do_package() { | ||
592 | : | ||
593 | } | ||
594 | |||
595 | addtask build after do_populate_staging | ||
596 | do_build = "" | ||
597 | do_build[func] = "1" | ||
598 | |||
599 | # Functions that update metadata based on files outputted | ||
600 | # during the build process. | ||
601 | |||
602 | SHLIBS = "" | ||
603 | RDEPENDS_prepend = " ${SHLIBS}" | ||
604 | |||
605 | python read_manifest () { | ||
606 | import sys | ||
607 | mfn = bb.data.getVar("MANIFEST", d, 1) | ||
608 | if os.access(mfn, os.R_OK): | ||
609 | # we have a manifest, so emit do_stage and do_populate_pkgs, | ||
610 | # and stuff some additional bits of data into the metadata store | ||
611 | mfile = file(mfn, "r") | ||
612 | manifest = bb.manifest.parse(mfile, d) | ||
613 | if not manifest: | ||
614 | return | ||
615 | |||
616 | bb.data.setVar('manifest', manifest, d) | ||
617 | } | ||
618 | |||
619 | python parse_manifest () { | ||
620 | manifest = bb.data.getVar("manifest", d) | ||
621 | if not manifest: | ||
622 | return | ||
623 | for func in ("do_populate_staging", "do_populate_pkgs"): | ||
624 | value = bb.manifest.emit(func, manifest, d) | ||
625 | if value: | ||
626 | bb.data.setVar("manifest_" + func, value, d) | ||
627 | bb.data.delVarFlag("manifest_" + func, "python", d) | ||
628 | bb.data.delVarFlag("manifest_" + func, "fakeroot", d) | ||
629 | bb.data.setVarFlag("manifest_" + func, "func", 1, d) | ||
630 | packages = [] | ||
631 | for l in manifest: | ||
632 | if "pkg" in l and l["pkg"] is not None: | ||
633 | packages.append(l["pkg"]) | ||
634 | bb.data.setVar("PACKAGES", " ".join(packages), d) | ||
635 | } | ||
636 | |||
637 | def explode_deps(s): | ||
638 | r = [] | ||
639 | l = s.split() | ||
640 | flag = False | ||
641 | for i in l: | ||
642 | if i[0] == '(': | ||
643 | flag = True | ||
644 | j = [] | ||
645 | if flag: | ||
646 | j.append(i) | ||
647 | if i.endswith(')'): | ||
648 | flag = False | ||
649 | r[-1] += ' ' + ' '.join(j) | ||
650 | else: | ||
651 | r.append(i) | ||
652 | return r | ||
653 | |||
654 | python read_shlibdeps () { | ||
655 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | ||
656 | for pkg in packages: | ||
657 | rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") | ||
658 | shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d) | ||
659 | if os.access(shlibsfile, os.R_OK): | ||
660 | fd = file(shlibsfile) | ||
661 | lines = fd.readlines() | ||
662 | fd.close() | ||
663 | for l in lines: | ||
664 | rdepends.append(l.rstrip()) | ||
665 | pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d) | ||
666 | if os.access(pcfile, os.R_OK): | ||
667 | fd = file(pcfile) | ||
668 | lines = fd.readlines() | ||
669 | fd.close() | ||
670 | for l in lines: | ||
671 | rdepends.append(l.rstrip()) | ||
672 | bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) | ||
673 | } | ||
674 | |||
675 | python read_subpackage_metadata () { | ||
676 | import re | ||
677 | |||
678 | def decode(str): | ||
679 | import codecs | ||
680 | c = codecs.getdecoder("string_escape") | ||
681 | return c(str)[0] | ||
682 | |||
683 | data_file = bb.data.expand("${WORKDIR}/install/${PN}.package", d) | ||
684 | if os.access(data_file, os.R_OK): | ||
685 | f = file(data_file, 'r') | ||
686 | lines = f.readlines() | ||
687 | f.close() | ||
688 | r = re.compile("([^:]+):\s*(.*)") | ||
689 | for l in lines: | ||
690 | m = r.match(l) | ||
691 | if m: | ||
692 | bb.data.setVar(m.group(1), decode(m.group(2)), d) | ||
693 | } | ||
694 | |||
695 | python __anonymous () { | ||
696 | import exceptions | ||
697 | need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1) | ||
698 | if need_host: | ||
699 | import re | ||
700 | this_host = bb.data.getVar('HOST_SYS', d, 1) | ||
701 | if not re.match(need_host, this_host): | ||
702 | raise bb.parse.SkipPackage("incompatible with host %s" % this_host) | ||
703 | |||
704 | pn = bb.data.getVar('PN', d, 1) | ||
705 | |||
706 | cvsdate = bb.data.getVar('CVSDATE_%s' % pn, d, 1) | ||
707 | if cvsdate != None: | ||
708 | bb.data.setVar('CVSDATE', cvsdate, d) | ||
709 | |||
710 | use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1) | ||
711 | if use_nls != None: | ||
712 | bb.data.setVar('USE_NLS', use_nls, d) | ||
713 | |||
714 | try: | ||
715 | bb.build.exec_func('read_manifest', d) | ||
716 | bb.build.exec_func('parse_manifest', d) | ||
717 | except exceptions.KeyboardInterrupt: | ||
718 | raise | ||
719 | except Exception, e: | ||
720 | bb.error("anonymous function: %s" % e) | ||
721 | pass | ||
722 | } | ||
723 | |||
724 | python () { | ||
725 | import bb, os | ||
726 | mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1) | ||
727 | old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1) | ||
728 | if (old_arch == mach_arch): | ||
729 | # Nothing to do | ||
730 | return | ||
731 | if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'): | ||
732 | return | ||
733 | paths = [] | ||
734 | for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]: | ||
735 | paths.append(bb.data.expand(os.path.join(p, mach_arch), d)) | ||
736 | for s in bb.data.getVar('SRC_URI', d, 1).split(): | ||
737 | local = bb.data.expand(bb.fetch.localpath(s, d), d) | ||
738 | for mp in paths: | ||
739 | if local.startswith(mp): | ||
740 | # bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch)) | ||
741 | bb.data.setVar('PACKAGE_ARCH', mach_arch, d) | ||
742 | return | ||
743 | } | ||
744 | |||
745 | |||
746 | addtask emit_manifest | ||
747 | python do_emit_manifest () { | ||
748 | # FIXME: emit a manifest here | ||
749 | # 1) adjust PATH to hit the wrapper scripts | ||
750 | wrappers = bb.which(bb.data.getVar("BBPATH", d, 1), 'build/install', 0) | ||
751 | path = (bb.data.getVar('PATH', d, 1) or '').split(':') | ||
752 | path.insert(0, os.path.dirname(wrappers)) | ||
753 | bb.data.setVar('PATH', ':'.join(path), d) | ||
754 | # 2) exec_func("do_install", d) | ||
755 | bb.build.exec_func('do_install', d) | ||
756 | # 3) read in data collected by the wrappers | ||
757 | bb.build.exec_func('read_manifest', d) | ||
758 | # 4) mangle the manifest we just generated, get paths back into | ||
759 | # our variable form | ||
760 | # 5) write it back out | ||
761 | # 6) re-parse it to ensure the generated functions are proper | ||
762 | bb.build.exec_func('parse_manifest', d) | ||
763 | } | ||
764 | |||
765 | EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_patch do_populate_pkgs do_stage | ||
766 | |||
767 | MIRRORS[func] = "0" | ||
768 | MIRRORS () { | ||
769 | ${DEBIAN_MIRROR}/main http://snapshot.debian.net/archive/pool | ||
770 | ${DEBIAN_MIRROR} ftp://ftp.de.debian.org/debian/pool | ||
771 | ${DEBIAN_MIRROR} ftp://ftp.au.debian.org/debian/pool | ||
772 | ${DEBIAN_MIRROR} ftp://ftp.cl.debian.org/debian/pool | ||
773 | ${DEBIAN_MIRROR} ftp://ftp.hr.debian.org/debian/pool | ||
774 | ${DEBIAN_MIRROR} ftp://ftp.fi.debian.org/debian/pool | ||
775 | ${DEBIAN_MIRROR} ftp://ftp.hk.debian.org/debian/pool | ||
776 | ${DEBIAN_MIRROR} ftp://ftp.hu.debian.org/debian/pool | ||
777 | ${DEBIAN_MIRROR} ftp://ftp.ie.debian.org/debian/pool | ||
778 | ${DEBIAN_MIRROR} ftp://ftp.it.debian.org/debian/pool | ||
779 | ${DEBIAN_MIRROR} ftp://ftp.jp.debian.org/debian/pool | ||
780 | ${DEBIAN_MIRROR} ftp://ftp.no.debian.org/debian/pool | ||
781 | ${DEBIAN_MIRROR} ftp://ftp.pl.debian.org/debian/pool | ||
782 | ${DEBIAN_MIRROR} ftp://ftp.ro.debian.org/debian/pool | ||
783 | ${DEBIAN_MIRROR} ftp://ftp.si.debian.org/debian/pool | ||
784 | ${DEBIAN_MIRROR} ftp://ftp.es.debian.org/debian/pool | ||
785 | ${DEBIAN_MIRROR} ftp://ftp.se.debian.org/debian/pool | ||
786 | ${DEBIAN_MIRROR} ftp://ftp.tr.debian.org/debian/pool | ||
787 | ${GNU_MIRROR} ftp://mirrors.kernel.org/gnu | ||
788 | ${GNU_MIRROR} ftp://ftp.matrix.com.br/pub/gnu | ||
789 | ${GNU_MIRROR} ftp://ftp.cs.ubc.ca/mirror2/gnu | ||
790 | ${GNU_MIRROR} ftp://sunsite.ust.hk/pub/gnu | ||
791 | ${GNU_MIRROR} ftp://ftp.ayamura.org/pub/gnu | ||
792 | ftp://ftp.kernel.org/pub http://www.kernel.org/pub | ||
793 | ftp://ftp.kernel.org/pub ftp://ftp.us.kernel.org/pub | ||
794 | ftp://ftp.kernel.org/pub ftp://ftp.uk.kernel.org/pub | ||
795 | ftp://ftp.kernel.org/pub ftp://ftp.hk.kernel.org/pub | ||
796 | ftp://ftp.kernel.org/pub ftp://ftp.au.kernel.org/pub | ||
797 | ftp://ftp.kernel.org/pub ftp://ftp.jp.kernel.org/pub | ||
798 | ftp://.*/.*/ http://www.oesources.org/source/current/ | ||
799 | http://.*/.*/ http://www.oesources.org/source/current/ | ||
800 | } | ||
801 | |||
diff --git a/openembedded/classes/base_srpm.bbclass b/openembedded/classes/base_srpm.bbclass new file mode 100644 index 0000000000..aea6335278 --- /dev/null +++ b/openembedded/classes/base_srpm.bbclass | |||
@@ -0,0 +1,20 @@ | |||
1 | inherit base package rpm_core | ||
2 | |||
3 | SPECFILE="${RPMBUILDPATH}/SPECS/${PN}.spec" | ||
4 | |||
5 | base_srpm_do_unpack() { | ||
6 | test -e ${SRPMFILE} || die "Source rpm \"${SRPMFILE}\"does not exist" | ||
7 | if ! test -e ${SPECFILE}; then | ||
8 | ${RPM} -i ${SRPMFILE} | ||
9 | fi | ||
10 | test -e ${SPECFILE} || die "Spec file \"${SPECFILE}\" does not exist" | ||
11 | ${RPMBUILD} -bp ${SPECFILE} | ||
12 | } | ||
13 | |||
14 | base_srpm_do_compile() { | ||
15 | ${RPMBUILD} -bc ${SPECFILE} | ||
16 | } | ||
17 | |||
18 | base_srpm_do_install() { | ||
19 | ${RPMBUILD} -bi ${SPECFILE} | ||
20 | } | ||
diff --git a/openembedded/classes/binconfig.bbclass b/openembedded/classes/binconfig.bbclass new file mode 100644 index 0000000000..a599dec3f2 --- /dev/null +++ b/openembedded/classes/binconfig.bbclass | |||
@@ -0,0 +1,34 @@ | |||
1 | inherit base | ||
2 | |||
3 | # The namespaces can clash here hence the two step replace | ||
4 | def get_binconfig_mangle(d): | ||
5 | import bb.data | ||
6 | s = "-e ''" | ||
7 | if not bb.data.inherits_class('native', d): | ||
8 | s += " -e 's:=${libdir}:=OELIBDIR:;'" | ||
9 | s += " -e 's:=${includedir}:=OEINCDIR:;'" | ||
10 | s += " -e 's:=${datadir}:=OEDATADIR:'" | ||
11 | s += " -e 's:=${prefix}:=OEPREFIX:'" | ||
12 | s += " -e 's:=${exec_prefix}:=OEEXECPREFIX:'" | ||
13 | s += " -e 's:-L${libdir}:-LOELIBDIR:;'" | ||
14 | s += " -e 's:-I${includedir}:-IOEINCDIR:;'" | ||
15 | s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'" | ||
16 | s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'" | ||
17 | s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" | ||
18 | s += " -e 's:OEPREFIX:${STAGING_LIBDIR}/..:'" | ||
19 | s += " -e 's:OEEXECPREFIX:${STAGING_LIBDIR}/..:'" | ||
20 | return s | ||
21 | |||
22 | # Native package configurations go in ${BINDIR}/<name>-config-native to prevent a collision with cross packages | ||
23 | def is_native(d): | ||
24 | import bb.data | ||
25 | return ["","-native"][bb.data.inherits_class('native', d)] | ||
26 | |||
27 | do_stage_append() { | ||
28 | for config in `find ${S} -name '*-config'`; do | ||
29 | configname=`basename $config`${@is_native(d)} | ||
30 | install -d ${STAGING_BINDIR} | ||
31 | cat $config | sed ${@get_binconfig_mangle(d)} > ${STAGING_BINDIR}/$configname | ||
32 | chmod u+x ${STAGING_BINDIR}/$configname | ||
33 | done | ||
34 | } | ||
diff --git a/openembedded/classes/ccache.inc b/openembedded/classes/ccache.inc new file mode 100644 index 0000000000..5e9356104b --- /dev/null +++ b/openembedded/classes/ccache.inc | |||
@@ -0,0 +1,11 @@ | |||
1 | # Make ccache use a TMPDIR specific ccache directory if using the crosscompiler, | ||
2 | # since it isn't likely to be useful with any other toolchain than the one we just | ||
3 | # built, and would otherwise push more useful things out of the default cache. | ||
4 | |||
5 | CCACHE_DIR_TARGET = "${TMPDIR}/ccache" | ||
6 | |||
7 | python () { | ||
8 | if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): | ||
9 | bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d) | ||
10 | bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d) | ||
11 | } | ||
diff --git a/openembedded/classes/ccdv.bbclass b/openembedded/classes/ccdv.bbclass new file mode 100644 index 0000000000..edd151ef8c --- /dev/null +++ b/openembedded/classes/ccdv.bbclass | |||
@@ -0,0 +1,21 @@ | |||
1 | python () { | ||
2 | if bb.data.getVar('PN', d, 1) in ['ccdv-native']: | ||
3 | if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): | ||
4 | bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d) | ||
5 | bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d) | ||
6 | bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d) | ||
7 | bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d) | ||
8 | } | ||
9 | |||
10 | def quiet_libtool(bb,d): | ||
11 | deps = (bb.data.getVar('DEPENDS', d, 1) or "").split() | ||
12 | if 'libtool-cross' in deps: | ||
13 | return "'LIBTOOL=${STAGING_BINDIR}/${HOST_SYS}-libtool --silent'" | ||
14 | elif 'libtool-native' in deps: | ||
15 | return "'LIBTOOL=${B}/${HOST_SYS}-libtool --silent'" | ||
16 | else: | ||
17 | return "" | ||
18 | |||
19 | CCDV = "ccdv" | ||
20 | EXTRA_OEMAKE_append = " ${@quiet_libtool(bb,d)}" | ||
21 | MAKE += "-s" | ||
diff --git a/openembedded/classes/cml1.bbclass b/openembedded/classes/cml1.bbclass new file mode 100644 index 0000000000..79218b4a12 --- /dev/null +++ b/openembedded/classes/cml1.bbclass | |||
@@ -0,0 +1,8 @@ | |||
1 | cml1_do_configure() { | ||
2 | set -e | ||
3 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
4 | oe_runmake oldconfig | ||
5 | } | ||
6 | |||
7 | EXPORT_FUNCTIONS do_configure | ||
8 | addtask configure after do_unpack do_patch before do_compile | ||
diff --git a/openembedded/classes/cpan.bbclass b/openembedded/classes/cpan.bbclass new file mode 100644 index 0000000000..853abfd1b3 --- /dev/null +++ b/openembedded/classes/cpan.bbclass | |||
@@ -0,0 +1,20 @@ | |||
1 | FILES_${PN} += '${libdir}/perl5' | ||
2 | |||
3 | cpan_do_configure () { | ||
4 | perl Makefile.PL | ||
5 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then | ||
6 | . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh | ||
7 | sed -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:; s:\(SITEARCHEXP = \).*:\1${sitearchexp}:; s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5:; s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" < Makefile > Makefile.new | ||
8 | mv Makefile.new Makefile | ||
9 | fi | ||
10 | } | ||
11 | |||
12 | cpan_do_compile () { | ||
13 | oe_runmake PASTHRU_INC="${CFLAGS}" | ||
14 | } | ||
15 | |||
16 | cpan_do_install () { | ||
17 | oe_runmake install_vendor | ||
18 | } | ||
19 | |||
20 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
diff --git a/openembedded/classes/cross.bbclass b/openembedded/classes/cross.bbclass new file mode 100644 index 0000000000..5d670ccadc --- /dev/null +++ b/openembedded/classes/cross.bbclass | |||
@@ -0,0 +1,54 @@ | |||
1 | # Cross packages are built indirectly via dependency, | ||
2 | # no need for them to be a direct target of 'world' | ||
3 | EXCLUDE_FROM_WORLD = "1" | ||
4 | |||
5 | PACKAGES = "" | ||
6 | |||
7 | HOST_ARCH = "${BUILD_ARCH}" | ||
8 | HOST_VENDOR = "${BUILD_VENDOR}" | ||
9 | HOST_OS = "${BUILD_OS}" | ||
10 | HOST_PREFIX = "${BUILD_PREFIX}" | ||
11 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" | ||
12 | |||
13 | CPPFLAGS = "${BUILD_CPPFLAGS}" | ||
14 | CFLAGS = "${BUILD_CFLAGS}" | ||
15 | CXXFLAGS = "${BUILD_CFLAGS}" | ||
16 | LDFLAGS = "${BUILD_LDFLAGS}" | ||
17 | |||
18 | # Overrides for paths | ||
19 | |||
20 | # Path prefixes | ||
21 | base_prefix = "${exec_prefix}" | ||
22 | prefix = "${CROSS_DIR}" | ||
23 | exec_prefix = "${prefix}" | ||
24 | |||
25 | # Base paths | ||
26 | base_bindir = "${base_prefix}/bin" | ||
27 | base_sbindir = "${base_prefix}/bin" | ||
28 | base_libdir = "${base_prefix}/lib" | ||
29 | |||
30 | # Architecture independent paths | ||
31 | datadir = "${prefix}/share" | ||
32 | sysconfdir = "${prefix}/etc" | ||
33 | sharedstatedir = "${prefix}/com" | ||
34 | localstatedir = "${prefix}/var" | ||
35 | infodir = "${datadir}/info" | ||
36 | mandir = "${datadir}/man" | ||
37 | docdir = "${datadir}/doc" | ||
38 | servicedir = "${prefix}/srv" | ||
39 | |||
40 | # Architecture dependent paths | ||
41 | bindir = "${exec_prefix}/bin" | ||
42 | sbindir = "${exec_prefix}/bin" | ||
43 | libexecdir = "${exec_prefix}/libexec" | ||
44 | libdir = "${exec_prefix}/lib" | ||
45 | includedir = "${exec_prefix}/include" | ||
46 | oldincludedir = "${exec_prefix}/include" | ||
47 | |||
48 | do_stage () { | ||
49 | oe_runmake install | ||
50 | } | ||
51 | |||
52 | do_install () { | ||
53 | : | ||
54 | } | ||
diff --git a/openembedded/classes/debian.bbclass b/openembedded/classes/debian.bbclass new file mode 100644 index 0000000000..d66c1fc763 --- /dev/null +++ b/openembedded/classes/debian.bbclass | |||
@@ -0,0 +1,93 @@ | |||
1 | python debian_package_name_hook () { | ||
2 | import glob, copy, stat, errno, re | ||
3 | |||
4 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
5 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
6 | |||
7 | def socrunch(s): | ||
8 | s = s.lower().replace('_', '-') | ||
9 | m = re.match("^(.*)(.)\.so\.(.*)$", s) | ||
10 | if m is None: | ||
11 | return None | ||
12 | if m.group(2) in '0123456789': | ||
13 | bin = '%s%s-%s' % (m.group(1), m.group(2), m.group(3)) | ||
14 | else: | ||
15 | bin = m.group(1) + m.group(2) + m.group(3) | ||
16 | dev = m.group(1) + m.group(2) | ||
17 | return (bin, dev) | ||
18 | |||
19 | def isexec(path): | ||
20 | try: | ||
21 | s = os.stat(path) | ||
22 | except (os.error, AttributeError): | ||
23 | return 0 | ||
24 | return (s[stat.ST_MODE] & stat.S_IEXEC) | ||
25 | |||
26 | def auto_libname(packages, orig_pkg): | ||
27 | bin_re = re.compile(".*/s?bin$") | ||
28 | lib_re = re.compile(".*/lib$") | ||
29 | so_re = re.compile("lib.*\.so") | ||
30 | sonames = [] | ||
31 | has_bins = 0 | ||
32 | has_libs = 0 | ||
33 | pkg_dir = os.path.join(workdir, "install", orig_pkg) | ||
34 | for root, dirs, files in os.walk(pkg_dir): | ||
35 | if bin_re.match(root) and files: | ||
36 | has_bins = 1 | ||
37 | if lib_re.match(root) and files: | ||
38 | has_libs = 1 | ||
39 | for f in files: | ||
40 | if so_re.match(f): | ||
41 | fp = os.path.join(root, f) | ||
42 | cmd = (bb.data.getVar('BUILD_PREFIX', d, 1) or "") + "objdump -p " + fp + " 2>/dev/null" | ||
43 | fd = os.popen(cmd) | ||
44 | lines = fd.readlines() | ||
45 | fd.close() | ||
46 | for l in lines: | ||
47 | m = re.match("\s+SONAME\s+([^\s]*)", l) | ||
48 | if m and not m.group(1) in sonames: | ||
49 | sonames.append(m.group(1)) | ||
50 | |||
51 | bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames)) | ||
52 | soname = None | ||
53 | if len(sonames) == 1: | ||
54 | soname = sonames[0] | ||
55 | elif len(sonames) > 1: | ||
56 | lead = bb.data.getVar('LEAD_SONAME', d, 1) | ||
57 | if lead: | ||
58 | r = re.compile(lead) | ||
59 | filtered = [] | ||
60 | for s in sonames: | ||
61 | if r.match(s): | ||
62 | filtered.append(s) | ||
63 | if len(filtered) == 1: | ||
64 | soname = filtered[0] | ||
65 | elif len(filtered) > 1: | ||
66 | bb.note("Multiple matches (%s) for LEAD_SONAME '%s'" % (", ".join(filtered), lead)) | ||
67 | else: | ||
68 | bb.note("Multiple libraries (%s) found, but LEAD_SONAME '%s' doesn't match any of them" % (", ".join(sonames), lead)) | ||
69 | else: | ||
70 | bb.note("Multiple libraries (%s) found and LEAD_SONAME not defined" % ", ".join(sonames)) | ||
71 | |||
72 | if has_libs and not has_bins and soname: | ||
73 | soname_result = socrunch(soname) | ||
74 | if soname_result: | ||
75 | (pkgname, devname) = soname_result | ||
76 | for pkg in packages.split(): | ||
77 | if (bb.data.getVar('PKG_' + pkg, d)): | ||
78 | continue | ||
79 | if pkg == orig_pkg: | ||
80 | newpkg = pkgname | ||
81 | else: | ||
82 | newpkg = pkg.replace(orig_pkg, devname, 1) | ||
83 | if newpkg != pkg: | ||
84 | bb.data.setVar('PKG_' + pkg, newpkg, d) | ||
85 | |||
86 | for pkg in (bb.data.getVar('AUTO_LIBNAME_PKGS', d, 1) or "").split(): | ||
87 | auto_libname(packages, pkg) | ||
88 | } | ||
89 | |||
90 | EXPORT_FUNCTIONS package_name_hook | ||
91 | |||
92 | DEBIAN_NAMES = 1 | ||
93 | |||
diff --git a/openembedded/classes/distutils-base.bbclass b/openembedded/classes/distutils-base.bbclass new file mode 100644 index 0000000000..68d7112166 --- /dev/null +++ b/openembedded/classes/distutils-base.bbclass | |||
@@ -0,0 +1,14 @@ | |||
1 | EXTRA_OEMAKE = "" | ||
2 | DEPENDS += "${@["python-native python", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" | ||
3 | RDEPENDS += "python-core" | ||
4 | |||
5 | def python_dir(d): | ||
6 | import os, bb | ||
7 | staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) | ||
8 | if os.path.exists( "%s/python2.3" % staging_incdir ): return "python2.3" | ||
9 | if os.path.exists( "%s/python2.4" % staging_incdir ): return "python2.4" | ||
10 | raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" | ||
11 | |||
12 | PYTHON_DIR = "${@python_dir(d)}" | ||
13 | FILES_${PN} = "${bindir} ${libdir} ${libdir}/${PYTHON_DIR}" | ||
14 | |||
diff --git a/openembedded/classes/distutils.bbclass b/openembedded/classes/distutils.bbclass new file mode 100644 index 0000000000..a2b0e2b770 --- /dev/null +++ b/openembedded/classes/distutils.bbclass | |||
@@ -0,0 +1,15 @@ | |||
1 | inherit distutils-base | ||
2 | |||
3 | distutils_do_compile() { | ||
4 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ | ||
5 | ${STAGING_BINDIR}/python setup.py build || \ | ||
6 | oefatal "python setup.py build execution failed." | ||
7 | } | ||
8 | |||
9 | distutils_do_install() { | ||
10 | BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ | ||
11 | ${STAGING_BINDIR}/python setup.py install --prefix=${D}/${prefix} --install-data=${D}/${datadir} || \ | ||
12 | oefatal "python setup.py install execution failed." | ||
13 | } | ||
14 | |||
15 | EXPORT_FUNCTIONS do_compile do_install | ||
diff --git a/openembedded/classes/efl.bbclass b/openembedded/classes/efl.bbclass new file mode 100644 index 0000000000..16c2dba0b8 --- /dev/null +++ b/openembedded/classes/efl.bbclass | |||
@@ -0,0 +1,76 @@ | |||
1 | MAINTAINER = "Justin Patrin <papercrane@reversefold.com>" | ||
2 | HOMEPAGE = "http://www.enlightenment.org" | ||
3 | SECTION = "e/libs" | ||
4 | |||
5 | SRCNAME = "${@bb.data.getVar('PN', d, 1).replace('-native', '')}" | ||
6 | SRC_URI = "http://enlightenment.freedesktop.org/files/${SRCNAME}-${PV}.tar.gz" | ||
7 | S = "${WORKDIR}/${SRCNAME}-${PV}" | ||
8 | |||
9 | inherit autotools pkgconfig binconfig | ||
10 | |||
11 | do_prepsources () { | ||
12 | make clean distclean || true | ||
13 | } | ||
14 | addtask prepsources after do_fetch before do_unpack | ||
15 | |||
16 | INHIBIT_AUTO_STAGE_INCLUDES = "1" | ||
17 | INHIBIT_NATIVE_STAGE_INSTALL = "1" | ||
18 | |||
19 | libdirectory = "src/lib" | ||
20 | libraries = "lib${SRCNAME}" | ||
21 | headers = "${@bb.data.getVar('SRCNAME',d,1).capitalize()}.h" | ||
22 | |||
23 | def binconfig_suffix(d): | ||
24 | import bb | ||
25 | return ["","-native"][bb.data.inherits_class('native', d)] | ||
26 | |||
27 | export CURL_CONFIG = "${STAGING_BINDIR}/curl-config${@binconfig_suffix(d)}" | ||
28 | export EDB_CONFIG = "${STAGING_BINDIR}/edb-config${@binconfig_suffix(d)}" | ||
29 | export EET_CONFIG = "${STAGING_BINDIR}/eet-config${@binconfig_suffix(d)}" | ||
30 | export EVAS_CONFIG = "${STAGING_BINDIR}/evas-config${@binconfig_suffix(d)}" | ||
31 | export ECORE_CONFIG = "${STAGING_BINDIR}/ecore-config${@binconfig_suffix(d)}" | ||
32 | export EMBRYO_CONFIG = "${STAGING_BINDIR}/embryo-config${@binconfig_suffix(d)}" | ||
33 | export ENGRAVE_CONFIG = "${STAGING_BINDIR}/engrave-config${@binconfig_suffix(d)}" | ||
34 | export ENLIGHTENMENT_CONFIG = "${STAGING_BINDIR}/enlightenment-config${@binconfig_suffix(d)}" | ||
35 | export EPSILON_CONFIG = "${STAGING_BINDIR}/epsilon-config${@binconfig_suffix(d)}" | ||
36 | export EPEG_CONFIG = "${STAGING_BINDIR}/epeg-config${@binconfig_suffix(d)}" | ||
37 | export ESMART_CONFIG = "${STAGING_BINDIR}/esmart-config${@binconfig_suffix(d)}" | ||
38 | export FREETYPE_CONFIG = "${STAGING_BINDIR}/freetype-config${@binconfig_suffix(d)}" | ||
39 | export IMLIB2_CONFIG = "${STAGING_BINDIR}/imlib2-config${@binconfig_suffix(d)}" | ||
40 | |||
41 | do_stage_append () { | ||
42 | for i in ${libraries} | ||
43 | do | ||
44 | oe_libinstall -C ${libdirectory} $i ${STAGING_LIBDIR} | ||
45 | done | ||
46 | for i in ${headers} | ||
47 | do | ||
48 | install -m 0644 ${libdirectory}/$i ${STAGING_INCDIR} | ||
49 | done | ||
50 | |||
51 | # Install binaries automatically for native builds | ||
52 | if [ "${@binconfig_suffix(d)}" = "-native" ] | ||
53 | then | ||
54 | |||
55 | # Most EFL binaries start with the package name | ||
56 | for i in src/bin/${SRCNAME}* | ||
57 | do | ||
58 | if [ -x $i -a -f $i ] | ||
59 | then | ||
60 | |||
61 | # Don't install anything with an extension (.so, etc) | ||
62 | if echo $i | grep -v \\. | ||
63 | then | ||
64 | ${HOST_SYS}-libtool --mode=install install -m 0755 $i ${STAGING_BINDIR} | ||
65 | fi | ||
66 | fi | ||
67 | done | ||
68 | fi | ||
69 | } | ||
70 | |||
71 | PACKAGES = "${SRCNAME} ${SRCNAME}-themes ${SRCNAME}-dev ${SRCNAME}-examples" | ||
72 | FILES_${SRCNAME} = "${libdir}/lib*.so*" | ||
73 | FILES_${SRCNAME}-themes = "${datadir}/${SRCNAME}/themes ${datadir}/${SRCNAME}/data ${datadir}/${SRCNAME}/fonts ${datadir}/${SRCNAME}/pointers ${datadir}/${SRCNAME}/images ${datadir}/${SRCNAME}/users ${datadir}/${SRCNAME}/images ${datadir}/${SRCNAME}/styles" | ||
74 | FILES_${SRCNAME}-dev += "${bindir}/${SRCNAME}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${datadir}/${SRCNAME}/include" | ||
75 | FILES_${SRCNAME}-examples = "${bindir} ${datadir}" | ||
76 | |||
diff --git a/openembedded/classes/flow-lossage.bbclass b/openembedded/classes/flow-lossage.bbclass new file mode 100644 index 0000000000..3e841e3cae --- /dev/null +++ b/openembedded/classes/flow-lossage.bbclass | |||
@@ -0,0 +1,5 @@ | |||
1 | # gcc-3.4 blows up in gtktext with -frename-registers on arm-linux | ||
2 | python () { | ||
3 | cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '') | ||
4 | bb.data.setVar('CFLAGS', cflags, d) | ||
5 | } | ||
diff --git a/openembedded/classes/gconf.bbclass b/openembedded/classes/gconf.bbclass new file mode 100644 index 0000000000..b0c5723873 --- /dev/null +++ b/openembedded/classes/gconf.bbclass | |||
@@ -0,0 +1,57 @@ | |||
1 | gconf_postinst() { | ||
2 | if [ "$1" = configure ]; then | ||
3 | if [ "x$D" != "x" ]; then | ||
4 | exit 1 | ||
5 | fi | ||
6 | SCHEMA_LOCATION=/etc/gconf/schemas | ||
7 | for SCHEMA in ${SCHEMA_FILES}; do | ||
8 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then | ||
9 | HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ | ||
10 | gconftool-2 \ | ||
11 | --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null | ||
12 | fi | ||
13 | done | ||
14 | fi | ||
15 | } | ||
16 | |||
17 | gconf_prerm() { | ||
18 | if [ "$1" = remove ] || [ "$1" = upgrade ]; then | ||
19 | SCHEMA_LOCATION=/etc/gconf/schemas | ||
20 | for SCHEMA in ${SCHEMA_FILES}; do | ||
21 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then | ||
22 | HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ | ||
23 | gconftool-2 \ | ||
24 | --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null | ||
25 | fi | ||
26 | done | ||
27 | fi | ||
28 | } | ||
29 | |||
30 | python populate_packages_append () { | ||
31 | import os.path, re | ||
32 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
33 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
34 | |||
35 | for pkg in packages: | ||
36 | schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg) | ||
37 | schemas = [] | ||
38 | schema_re = re.compile(".*\.schemas$") | ||
39 | if os.path.exists(schema_dir): | ||
40 | for f in os.listdir(schema_dir): | ||
41 | if schema_re.match(f): | ||
42 | schemas.append(f) | ||
43 | if schemas != []: | ||
44 | bb.note("adding gconf postinst and prerm scripts to %s" % pkg) | ||
45 | bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d) | ||
46 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
47 | if not postinst: | ||
48 | postinst = '#!/bin/sh\n' | ||
49 | postinst += bb.data.getVar('gconf_postinst', d, 1) | ||
50 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
51 | prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1) | ||
52 | if not prerm: | ||
53 | prerm = '#!/bin/sh\n' | ||
54 | prerm += bb.data.getVar('gconf_prerm', d, 1) | ||
55 | bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) | ||
56 | |||
57 | } | ||
diff --git a/openembedded/classes/gettext.bbclass b/openembedded/classes/gettext.bbclass new file mode 100644 index 0000000000..3785f5acd3 --- /dev/null +++ b/openembedded/classes/gettext.bbclass | |||
@@ -0,0 +1,12 @@ | |||
1 | python () { | ||
2 | # Remove the NLS bits if USE_NLS is no. | ||
3 | if bb.data.getVar('USE_NLS', d, 1) == 'no': | ||
4 | cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d) | ||
5 | cfg += " --disable-nls" | ||
6 | depends = bb.data.getVar('DEPENDS', d, 1) or "" | ||
7 | bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d) | ||
8 | bb.data.setVar('EXTRA_OECONF', cfg, d) | ||
9 | } | ||
10 | |||
11 | DEPENDS =+ "gettext-native" | ||
12 | EXTRA_OECONF += "--enable-nls" | ||
diff --git a/openembedded/classes/gnome.bbclass b/openembedded/classes/gnome.bbclass new file mode 100644 index 0000000000..8643989b73 --- /dev/null +++ b/openembedded/classes/gnome.bbclass | |||
@@ -0,0 +1,20 @@ | |||
1 | def gnome_verdir(v): | ||
2 | import re | ||
3 | m = re.match("([0-9]+)\.([0-9]+)\..*", v) | ||
4 | return "%s.%s" % (m.group(1), m.group(2)) | ||
5 | |||
6 | SECTION ?= "x11/gnome" | ||
7 | SRC_URI = "${GNOME_MIRROR}/${PN}/${@gnome_verdir("${PV}")}/${PN}-${PV}.tar.bz2" | ||
8 | |||
9 | DEPENDS += "gnome-common" | ||
10 | |||
11 | FILES_${PN} += "${datadir}/application-registry ${datadir}/mime-info \ | ||
12 | ${datadir}/gnome-2.0" | ||
13 | |||
14 | inherit autotools pkgconfig gconf | ||
15 | |||
16 | EXTRA_AUTORECONF += "-I ${STAGING_DIR}/${HOST_SYS}/share/aclocal/gnome2-macros" | ||
17 | |||
18 | gnome_stage_includes() { | ||
19 | autotools_stage_includes | ||
20 | } | ||
diff --git a/openembedded/classes/gpe.bbclass b/openembedded/classes/gpe.bbclass new file mode 100644 index 0000000000..8cd9e4fc5d --- /dev/null +++ b/openembedded/classes/gpe.bbclass | |||
@@ -0,0 +1,16 @@ | |||
1 | DEPENDS_prepend = "coreutils-native virtual/libintl intltool-native " | ||
2 | GPE_TARBALL_SUFFIX ?= "gz" | ||
3 | SRC_URI = "${GPE_MIRROR}/${PN}-${PV}.tar.${GPE_TARBALL_SUFFIX}" | ||
4 | FILES_${PN} += "${datadir}/gpe ${datadir}/application-registry" | ||
5 | |||
6 | inherit gettext | ||
7 | |||
8 | gpe_do_compile() { | ||
9 | oe_runmake PREFIX=${prefix} | ||
10 | } | ||
11 | |||
12 | gpe_do_install() { | ||
13 | oe_runmake PREFIX=${prefix} DESTDIR=${D} install | ||
14 | } | ||
15 | |||
16 | EXPORT_FUNCTIONS do_compile do_install | ||
diff --git a/openembedded/classes/icecc.bbclass b/openembedded/classes/icecc.bbclass new file mode 100644 index 0000000000..7dfcfc29a4 --- /dev/null +++ b/openembedded/classes/icecc.bbclass | |||
@@ -0,0 +1,156 @@ | |||
1 | # IceCream distributed compiling support | ||
2 | # | ||
3 | # We need to create a tar.bz2 of our toolchain and set | ||
4 | # ICECC_VERSION, ICECC_CXX and ICEC_CC | ||
5 | # | ||
6 | |||
7 | def create_env(bb,d): | ||
8 | """ | ||
9 | Create a tar.bz of the current toolchain | ||
10 | """ | ||
11 | |||
12 | # Constin native-native compilation no environment needed if | ||
13 | # host prefix is empty (let us duplicate the query for ease) | ||
14 | prefix = bb.data.expand('${HOST_PREFIX}', d) | ||
15 | if len(prefix) == 0: | ||
16 | return "" | ||
17 | |||
18 | import tarfile | ||
19 | import socket | ||
20 | import time | ||
21 | import os | ||
22 | ice_dir = bb.data.expand('${CROSS_DIR}', d) | ||
23 | prefix = bb.data.expand('${HOST_PREFIX}' , d) | ||
24 | distro = bb.data.expand('${DISTRO}', d) | ||
25 | target_sys = bb.data.expand('${TARGET_SYS}', d) | ||
26 | #float = bb.data.getVar('${TARGET_FPU}', d) | ||
27 | float = "anyfloat" | ||
28 | name = socket.gethostname() | ||
29 | |||
30 | try: | ||
31 | os.stat(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2') | ||
32 | os.stat(ice_dir + '/' + target_sys + '/bin/g++') | ||
33 | except: | ||
34 | return "" | ||
35 | |||
36 | VERSION = '3.4.3' | ||
37 | cross_name = prefix + distro + target_sys + float +VERSION+ name | ||
38 | tar_file = ice_dir + '/ice/' + cross_name + '.tar.bz2' | ||
39 | |||
40 | try: | ||
41 | os.stat(tar_file) | ||
42 | return tar_file | ||
43 | except: | ||
44 | try: | ||
45 | os.makedirs(ice_dir+'/ice') | ||
46 | except: | ||
47 | pass | ||
48 | |||
49 | # FIXME find out the version of the compiler | ||
50 | tar = tarfile.open(tar_file, 'w:bz2') | ||
51 | tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', | ||
52 | target_sys + 'cross/lib/ld-linux.so.2') | ||
53 | tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', | ||
54 | target_sys + 'cross/lib/ld-2.3.3.so') | ||
55 | tar.add(ice_dir + '/' + target_sys + '/lib/libc-2.3.3.so', | ||
56 | target_sys + 'cross/lib/libc-2.3.3.so') | ||
57 | tar.add(ice_dir + '/' + target_sys + '/lib/libc.so.6', | ||
58 | target_sys + 'cross/lib/libc.so.6') | ||
59 | tar.add(ice_dir + '/' + target_sys + '/bin/gcc', | ||
60 | target_sys + 'cross/usr/bin/gcc') | ||
61 | tar.add(ice_dir + '/' + target_sys + '/bin/g++', | ||
62 | target_sys + 'cross/usr/bin/g++') | ||
63 | tar.add(ice_dir + '/' + target_sys + '/bin/as', | ||
64 | target_sys + 'cross/usr/bin/as') | ||
65 | tar.add(ice_dir + '/lib/gcc/' + target_sys +'/'+ VERSION + '/specs', | ||
66 | target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/specs') | ||
67 | tar.add(ice_dir + '/libexec/gcc/'+target_sys+'/' + VERSION + '/cc1', | ||
68 | target_sys + 'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1') | ||
69 | tar.add(ice_dir + '/libexec/gcc/arm-linux/' + VERSION + '/cc1plus', | ||
70 | target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1plus') | ||
71 | tar.close() | ||
72 | return tar_file | ||
73 | |||
74 | |||
75 | def create_path(compilers, type, bb, d): | ||
76 | """ | ||
77 | Create Symlinks for the icecc in the staging directory | ||
78 | """ | ||
79 | import os | ||
80 | |||
81 | staging = bb.data.expand('${STAGING_DIR}', d) + "/ice/" + type | ||
82 | icecc = bb.data.getVar('ICECC_PATH', d) | ||
83 | |||
84 | # Create the dir if necessary | ||
85 | try: | ||
86 | os.stat(staging) | ||
87 | except: | ||
88 | os.makedirs(staging) | ||
89 | |||
90 | |||
91 | for compiler in compilers: | ||
92 | gcc_path = staging + "/" + compiler | ||
93 | try: | ||
94 | os.stat(gcc_path) | ||
95 | except: | ||
96 | os.symlink(icecc, gcc_path) | ||
97 | |||
98 | return staging + ":" | ||
99 | |||
100 | |||
101 | def use_icc_version(bb,d): | ||
102 | # Constin native native | ||
103 | prefix = bb.data.expand('${HOST_PREFIX}', d) | ||
104 | if len(prefix) == 0: | ||
105 | return "no" | ||
106 | |||
107 | |||
108 | native = bb.data.expand('${PN}', d) | ||
109 | blacklist = [ "-cross", "-native" ] | ||
110 | |||
111 | for black in blacklist: | ||
112 | if black in native: | ||
113 | return "no" | ||
114 | |||
115 | return "yes" | ||
116 | |||
117 | def icc_path(bb,d,compile): | ||
118 | native = bb.data.expand('${PN}', d) | ||
119 | blacklist = [ "ulibc", "glibc", "ncurses" ] | ||
120 | for black in blacklist: | ||
121 | if black in native: | ||
122 | return "" | ||
123 | |||
124 | if "-native" in native: | ||
125 | compile = False | ||
126 | if "-cross" in native: | ||
127 | compile = False | ||
128 | |||
129 | prefix = bb.data.expand('${HOST_PREFIX}', d) | ||
130 | if compile and len(prefix) != 0: | ||
131 | return create_path( [prefix+"gcc", prefix+"g++"], "cross", bb, d ) | ||
132 | elif not compile or len(prefix) == 0: | ||
133 | return create_path( ["gcc", "g++"], "native", bb, d) | ||
134 | |||
135 | |||
136 | def icc_version(bb,d): | ||
137 | return create_env(bb,d) | ||
138 | |||
139 | |||
140 | # | ||
141 | # set the IceCream environment variables | ||
142 | do_configure_prepend() { | ||
143 | export PATH=${@icc_path(bb,d,False)}$PATH | ||
144 | export ICECC_CC="gcc" | ||
145 | export ICECC_CXX="g++" | ||
146 | } | ||
147 | |||
148 | do_compile_prepend() { | ||
149 | export PATH=${@icc_path(bb,d,True)}$PATH | ||
150 | export ICECC_CC="${HOST_PREFIX}gcc" | ||
151 | export ICECC_CXX="${HOST_PREFIX}g++" | ||
152 | |||
153 | if [ "${@use_icc_version(bb,d)}" = "yes" ]; then | ||
154 | export ICECC_VERSION="${@icc_version(bb,d)}" | ||
155 | fi | ||
156 | } | ||
diff --git a/openembedded/classes/image_ipk.bbclass b/openembedded/classes/image_ipk.bbclass new file mode 100644 index 0000000000..5fdd340673 --- /dev/null +++ b/openembedded/classes/image_ipk.bbclass | |||
@@ -0,0 +1,72 @@ | |||
1 | inherit rootfs_ipk | ||
2 | |||
3 | # Images are generally built explicitly, do not need to be part of world. | ||
4 | EXCLUDE_FROM_WORLD = "1" | ||
5 | |||
6 | USE_DEVFS ?= "0" | ||
7 | |||
8 | DEPENDS += "makedevs-native" | ||
9 | |||
10 | def get_image_deps(d): | ||
11 | import bb | ||
12 | str = "" | ||
13 | for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split(): | ||
14 | deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "" | ||
15 | if deps: | ||
16 | str += " %s" % deps | ||
17 | return str | ||
18 | |||
19 | DEPENDS += "${@get_image_deps(d)}" | ||
20 | |||
21 | IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}" | ||
22 | IMAGE_POSTPROCESS_COMMAND ?= "" | ||
23 | |||
24 | # Must call real_do_rootfs() from inside here, rather than as a separate | ||
25 | # task, so that we have a single fakeroot context for the whole process. | ||
26 | fakeroot do_rootfs () { | ||
27 | set -x | ||
28 | rm -rf ${IMAGE_ROOTFS} | ||
29 | |||
30 | if [ "${USE_DEVFS}" != "1" ]; then | ||
31 | mkdir -p ${IMAGE_ROOTFS}/dev | ||
32 | makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE} | ||
33 | fi | ||
34 | |||
35 | real_do_rootfs | ||
36 | |||
37 | insert_feed_uris | ||
38 | |||
39 | rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/oe | ||
40 | |||
41 | ${IMAGE_PREPROCESS_COMMAND} | ||
42 | |||
43 | export TOPDIR=${TOPDIR} | ||
44 | |||
45 | for type in ${IMAGE_FSTYPES}; do | ||
46 | if test -z "$FAKEROOTKEY"; then | ||
47 | fakeroot -i ${TMPDIR}/fakedb.image bbimage -t $type -e ${FILE} | ||
48 | else | ||
49 | bbimage -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" | ||
50 | fi | ||
51 | done | ||
52 | |||
53 | ${IMAGE_POSTPROCESS_COMMAND} | ||
54 | } | ||
55 | |||
56 | insert_feed_uris () { | ||
57 | |||
58 | echo "Building feeds for [${DISTRO}].." | ||
59 | |||
60 | for line in ${FEED_URIS} | ||
61 | do | ||
62 | # strip leading and trailing spaces/tabs, then split into name and uri | ||
63 | line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`" | ||
64 | feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`" | ||
65 | feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" | ||
66 | |||
67 | echo "Added $feed_name feed with URL $feed_uri" | ||
68 | |||
69 | # insert new feed-sources | ||
70 | echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf | ||
71 | done | ||
72 | } | ||
diff --git a/openembedded/classes/kernel-arch.bbclass b/openembedded/classes/kernel-arch.bbclass new file mode 100644 index 0000000000..92a6c982fb --- /dev/null +++ b/openembedded/classes/kernel-arch.bbclass | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # set the ARCH environment variable for kernel compilation (including | ||
3 | # modules). return value must match one of the architecture directories | ||
4 | # in the kernel source "arch" directory | ||
5 | # | ||
6 | |||
7 | valid_archs = "alpha cris ia64 m68knommu ppc sh \ | ||
8 | sparc64 x86_64 arm h8300 m32r mips \ | ||
9 | ppc64 sh64 um arm26 i386 m68k \ | ||
10 | parisc s390 sparc v850" | ||
11 | |||
12 | def map_kernel_arch(a, d): | ||
13 | import bb, re | ||
14 | |||
15 | valid_archs = bb.data.getVar('valid_archs', d, 1).split() | ||
16 | |||
17 | if re.match('(i.86|athlon)$', a): return 'i386' | ||
18 | elif re.match('arm26$', a): return 'arm26' | ||
19 | elif re.match('armeb$', a): return 'arm' | ||
20 | elif re.match('powerpc$', a): return 'ppc' | ||
21 | elif re.match('mipsel$', a): return 'mips' | ||
22 | elif a in valid_archs: return a | ||
23 | else: | ||
24 | bb.error("cannot map '%s' to a linux kernel architecture" % a) | ||
25 | |||
26 | export ARCH = "${@map_kernel_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}" | ||
diff --git a/openembedded/classes/kernel.bbclass b/openembedded/classes/kernel.bbclass new file mode 100644 index 0000000000..ff9aeeab78 --- /dev/null +++ b/openembedded/classes/kernel.bbclass | |||
@@ -0,0 +1,382 @@ | |||
1 | inherit module_strip | ||
2 | |||
3 | PROVIDES += "virtual/kernel" | ||
4 | DEPENDS += "virtual/${TARGET_PREFIX}depmod-${@get_kernelmajorversion('${PV}')} virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules" | ||
5 | |||
6 | inherit kernel-arch | ||
7 | |||
8 | export OS = "${TARGET_OS}" | ||
9 | export CROSS_COMPILE = "${TARGET_PREFIX}" | ||
10 | KERNEL_IMAGETYPE = "zImage" | ||
11 | |||
12 | KERNEL_PRIORITY = "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[-1]}" | ||
13 | |||
14 | KERNEL_CCSUFFIX ?= "" | ||
15 | KERNEL_LDSUFFIX ?= "" | ||
16 | |||
17 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX}" | ||
18 | KERNEL_LD = "${LD}${KERNEL_LDSUFFIX}" | ||
19 | |||
20 | KERNEL_OUTPUT = "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" | ||
21 | KERNEL_IMAGEDEST = "boot" | ||
22 | |||
23 | # | ||
24 | # configuration | ||
25 | # | ||
26 | export CMDLINE_CONSOLE = "console=${@bb.data.getVar("KERNEL_CONSOLE",d,1) or "ttyS0"}" | ||
27 | |||
28 | # parse kernel ABI version out of <linux/version.h> | ||
29 | def get_kernelversion(p): | ||
30 | import re | ||
31 | try: | ||
32 | f = open(p, 'r') | ||
33 | except IOError: | ||
34 | return None | ||
35 | l = f.readlines() | ||
36 | f.close() | ||
37 | r = re.compile("#define UTS_RELEASE \"(.*)\"") | ||
38 | for s in l: | ||
39 | m = r.match(s) | ||
40 | if m: | ||
41 | return m.group(1) | ||
42 | return None | ||
43 | |||
44 | def get_kernelmajorversion(p): | ||
45 | import re | ||
46 | r = re.compile("([0-9]+\.[0-9]+).*") | ||
47 | m = r.match(p); | ||
48 | if m: | ||
49 | return m.group(1) | ||
50 | return None | ||
51 | |||
52 | KERNEL_VERSION = "${@get_kernelversion('${S}/include/linux/version.h')}" | ||
53 | KERNEL_MAJOR_VERSION = "${@get_kernelmajorversion('${KERNEL_VERSION}')}" | ||
54 | |||
55 | KERNEL_LOCALVERSION ?= "" | ||
56 | |||
57 | # kernels are generally machine specific | ||
58 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
59 | |||
60 | kernel_do_compile() { | ||
61 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
62 | oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}" | ||
63 | oe_runmake dep CC="${KERNEL_CC}" LD="${KERNEL_LD}" | ||
64 | oe_runmake ${KERNEL_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" | ||
65 | if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then | ||
66 | oe_runmake modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" | ||
67 | else | ||
68 | oenote "no modules to compile" | ||
69 | fi | ||
70 | } | ||
71 | |||
72 | kernel_do_stage() { | ||
73 | ASMDIR=`readlink include/asm` | ||
74 | |||
75 | mkdir -p ${STAGING_KERNEL_DIR}/include/$ASMDIR | ||
76 | cp -fR include/$ASMDIR/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ | ||
77 | ln -sf $ASMDIR ${STAGING_KERNEL_DIR}/include/asm | ||
78 | |||
79 | mkdir -p ${STAGING_KERNEL_DIR}/include/asm-generic | ||
80 | cp -fR include/asm-generic/* ${STAGING_KERNEL_DIR}/include/asm-generic/ | ||
81 | |||
82 | mkdir -p ${STAGING_KERNEL_DIR}/include/linux | ||
83 | cp -fR include/linux/* ${STAGING_KERNEL_DIR}/include/linux/ | ||
84 | |||
85 | mkdir -p ${STAGING_KERNEL_DIR}/include/net | ||
86 | cp -fR include/net/* ${STAGING_KERNEL_DIR}/include/net/ | ||
87 | |||
88 | mkdir -p ${STAGING_KERNEL_DIR}/include/pcmcia | ||
89 | cp -fR include/pcmcia/* ${STAGING_KERNEL_DIR}/include/pcmcia/ | ||
90 | |||
91 | if [ -d drivers/sound ]; then | ||
92 | # 2.4 alsa needs some headers from this directory | ||
93 | mkdir -p ${STAGING_KERNEL_DIR}/include/drivers/sound | ||
94 | cp -fR drivers/sound/*.h ${STAGING_KERNEL_DIR}/include/drivers/sound/ | ||
95 | fi | ||
96 | |||
97 | install -m 0644 .config ${STAGING_KERNEL_DIR}/config-${PV}${KERNEL_LOCALVERSION} | ||
98 | ln -sf config-${PV}${KERNEL_LOCALVERSION} ${STAGING_KERNEL_DIR}/.config | ||
99 | ln -sf config-${PV}${KERNEL_LOCALVERSION} ${STAGING_KERNEL_DIR}/kernel-config | ||
100 | echo "${KERNEL_VERSION}" >${STAGING_KERNEL_DIR}/kernel-abiversion | ||
101 | echo "${S}" >${STAGING_KERNEL_DIR}/kernel-source | ||
102 | echo "${KERNEL_CCSUFFIX}" >${STAGING_KERNEL_DIR}/kernel-ccsuffix | ||
103 | echo "${KERNEL_LDSUFFIX}" >${STAGING_KERNEL_DIR}/kernel-ldsuffix | ||
104 | [ -e Rules.make ] && install -m 0644 Rules.make ${STAGING_KERNEL_DIR}/ | ||
105 | [ -e Makefile ] && install -m 0644 Makefile ${STAGING_KERNEL_DIR}/ | ||
106 | |||
107 | # Check if arch/${ARCH}/Makefile exists and install it | ||
108 | if [ -e arch/${ARCH}/Makefile ]; then | ||
109 | install -d ${STAGING_KERNEL_DIR}/arch/${ARCH} | ||
110 | install -m 0644 arch/${ARCH}/Makefile ${STAGING_KERNEL_DIR}/arch/${ARCH} | ||
111 | fi | ||
112 | cp -fR include/config* ${STAGING_KERNEL_DIR}/include/ | ||
113 | install -m 0644 ${KERNEL_OUTPUT} ${STAGING_KERNEL_DIR}/${KERNEL_IMAGETYPE} | ||
114 | install -m 0644 System.map ${STAGING_KERNEL_DIR}/System.map-${PV}${KERNEL_LOCALVERSION} | ||
115 | [ -e Module.symvers ] && install -m 0644 Module.symvers ${STAGING_KERNEL_DIR}/ | ||
116 | |||
117 | cp -fR scripts ${STAGING_KERNEL_DIR}/ | ||
118 | } | ||
119 | |||
120 | kernel_do_install() { | ||
121 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
122 | if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then | ||
123 | oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install | ||
124 | else | ||
125 | oenote "no modules to install" | ||
126 | fi | ||
127 | |||
128 | install -d ${D}/${KERNEL_IMAGEDEST} | ||
129 | install -d ${D}/boot | ||
130 | install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${PV}${KERNEL_LOCALVERSION} | ||
131 | install -m 0644 System.map ${D}/boot/System.map-${PV}${KERNEL_LOCALVERSION} | ||
132 | install -m 0644 .config ${D}/boot/config-${PV}${KERNEL_LOCALVERSION} | ||
133 | install -d ${D}/etc/modutils | ||
134 | |||
135 | # Check if scripts/genksyms exists and if so, build it | ||
136 | if [ -e scripts/genksyms/ ]; then | ||
137 | oe_runmake SUBDIRS="scripts/genksyms" | ||
138 | fi | ||
139 | |||
140 | cp -fR scripts ${STAGING_KERNEL_DIR}/ | ||
141 | } | ||
142 | |||
143 | kernel_do_configure() { | ||
144 | yes '' | oe_runmake oldconfig | ||
145 | } | ||
146 | |||
147 | pkg_postinst_kernel () { | ||
148 | update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${PV}${KERNEL_LOCALVERSION} ${KERNEL_PRIORITY} || true | ||
149 | } | ||
150 | |||
151 | pkg_postrm_kernel () { | ||
152 | update-alternatives --remove ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${PV}${KERNEL_LOCALVERSION} || true | ||
153 | } | ||
154 | |||
155 | inherit cml1 | ||
156 | |||
157 | EXPORT_FUNCTIONS do_compile do_install do_stage do_configure | ||
158 | |||
159 | PACKAGES = "kernel kernel-image kernel-dev" | ||
160 | FILES = "" | ||
161 | FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" | ||
162 | FILES_kernel-dev = "/boot/System.map* /boot/config*" | ||
163 | RDEPENDS_kernel = "kernel-image-${KERNEL_VERSION}" | ||
164 | PKG_kernel-image = "kernel-image-${KERNEL_VERSION}" | ||
165 | ALLOW_EMPTY_kernel = "1" | ||
166 | ALLOW_EMPTY_kernel-image = "1" | ||
167 | |||
168 | pkg_postinst_modules () { | ||
169 | if [ -n "$D" ]; then | ||
170 | ${HOST_PREFIX}depmod -A -b $D -F ${STAGING_KERNEL_DIR}/System.map-${PV}${KERNEL_LOCALVERSION} ${KERNEL_VERSION} | ||
171 | else | ||
172 | depmod -A | ||
173 | update-modules || true | ||
174 | fi | ||
175 | } | ||
176 | |||
177 | pkg_postrm_modules () { | ||
178 | update-modules || true | ||
179 | } | ||
180 | |||
181 | autoload_postinst_fragment() { | ||
182 | if [ x"$D" = "x" ]; then | ||
183 | modprobe %s || true | ||
184 | fi | ||
185 | } | ||
186 | |||
187 | # autoload defaults (alphabetically sorted) | ||
188 | module_autoload_hidp = "hidp" | ||
189 | module_autoload_ipv6 = "ipv6" | ||
190 | module_autoload_ipsec = "ipsec" | ||
191 | module_autoload_ircomm-tty = "ircomm-tty" | ||
192 | module_autoload_rfcomm = "rfcomm" | ||
193 | module_autoload_sa1100-rtc = "sa1100-rtc" | ||
194 | |||
195 | # alias defaults (alphabetically sorted) | ||
196 | module_conf_af_packet = "alias net-pf-17 af_packet" | ||
197 | module_conf_bluez = "alias net-pf-31 bluez" | ||
198 | module_conf_bnep = "alias bt-proto-4 bnep" | ||
199 | module_conf_hci_uart = "alias tty-ldisc-15 hci_uart" | ||
200 | module_conf_l2cap = "alias bt-proto-0 l2cap" | ||
201 | module_conf_sco = "alias bt-proto-2 sco" | ||
202 | module_conf_rfcomm = "alias bt-proto-3 rfcomm" | ||
203 | |||
204 | python populate_packages_prepend () { | ||
205 | def extract_modinfo(file): | ||
206 | import os, re | ||
207 | tmpfile = os.tmpnam() | ||
208 | cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "", file, tmpfile) | ||
209 | os.system(cmd) | ||
210 | f = open(tmpfile) | ||
211 | l = f.read().split("\000") | ||
212 | f.close() | ||
213 | os.unlink(tmpfile) | ||
214 | exp = re.compile("([^=]+)=(.*)") | ||
215 | vals = {} | ||
216 | for i in l: | ||
217 | m = exp.match(i) | ||
218 | if not m: | ||
219 | continue | ||
220 | vals[m.group(1)] = m.group(2) | ||
221 | return vals | ||
222 | |||
223 | def parse_depmod(): | ||
224 | import os, re | ||
225 | |||
226 | dvar = bb.data.getVar('D', d, 1) | ||
227 | if not dvar: | ||
228 | bb.error("D not defined") | ||
229 | return | ||
230 | |||
231 | kernelver = bb.data.getVar('PV', d, 1) + bb.data.getVar('KERNEL_LOCALVERSION', d, 1) | ||
232 | kernelver_stripped = kernelver | ||
233 | m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) | ||
234 | if m: | ||
235 | kernelver_stripped = m.group(1) | ||
236 | path = bb.data.getVar("PATH", d, 1) | ||
237 | host_prefix = bb.data.getVar("HOST_PREFIX", d, 1) or "" | ||
238 | |||
239 | cmd = "PATH=\"%s\" %sdepmod -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, dvar, dvar, kernelver, kernelver_stripped) | ||
240 | f = os.popen(cmd, 'r') | ||
241 | |||
242 | deps = {} | ||
243 | pattern0 = "^(.*\.k?o):..*$" | ||
244 | pattern1 = "^(.*\.k?o):\s*(.*\.k?o)\s*$" | ||
245 | pattern2 = "^(.*\.k?o):\s*(.*\.k?o)\s*\\\$" | ||
246 | pattern3 = "^\t(.*\.k?o)\s*\\\$" | ||
247 | pattern4 = "^\t(.*\.k?o)\s*$" | ||
248 | |||
249 | line = f.readline() | ||
250 | while line: | ||
251 | if not re.match(pattern0, line): | ||
252 | line = f.readline() | ||
253 | continue | ||
254 | m1 = re.match(pattern1, line) | ||
255 | if m1: | ||
256 | deps[m1.group(1)] = m1.group(2).split() | ||
257 | else: | ||
258 | m2 = re.match(pattern2, line) | ||
259 | if m2: | ||
260 | deps[m2.group(1)] = m2.group(2).split() | ||
261 | line = f.readline() | ||
262 | m3 = re.match(pattern3, line) | ||
263 | while m3: | ||
264 | deps[m2.group(1)].extend(m3.group(1).split()) | ||
265 | line = f.readline() | ||
266 | m3 = re.match(pattern3, line) | ||
267 | m4 = re.match(pattern4, line) | ||
268 | deps[m2.group(1)].extend(m4.group(1).split()) | ||
269 | line = f.readline() | ||
270 | f.close() | ||
271 | return deps | ||
272 | |||
273 | def get_dependencies(file, pattern, format): | ||
274 | file = file.replace(bb.data.getVar('D', d, 1) or '', '', 1) | ||
275 | |||
276 | if module_deps.has_key(file): | ||
277 | import os.path, re | ||
278 | dependencies = [] | ||
279 | for i in module_deps[file]: | ||
280 | m = re.match(pattern, os.path.basename(i)) | ||
281 | if not m: | ||
282 | continue | ||
283 | on = legitimize_package_name(m.group(1)) | ||
284 | dependency_pkg = format % on | ||
285 | v = bb.data.getVar("PARALLEL_INSTALL_MODULES", d, 1) or "0" | ||
286 | if v == "1": | ||
287 | kv = bb.data.getVar("KERNEL_MAJOR_VERSION", d, 1) | ||
288 | dependency_pkg = "%s-%s" % (dependency_pkg, kv) | ||
289 | dependencies.append(dependency_pkg) | ||
290 | return dependencies | ||
291 | return [] | ||
292 | |||
293 | def frob_metadata(file, pkg, pattern, format, basename): | ||
294 | import re | ||
295 | vals = extract_modinfo(file) | ||
296 | |||
297 | dvar = bb.data.getVar('D', d, 1) | ||
298 | |||
299 | # If autoloading is requested, output /etc/modutils/<name> and append | ||
300 | # appropriate modprobe commands to the postinst | ||
301 | autoload = bb.data.getVar('module_autoload_%s' % basename, d, 1) | ||
302 | if autoload: | ||
303 | name = '%s/etc/modutils/%s' % (dvar, basename) | ||
304 | f = open(name, 'w') | ||
305 | for m in autoload.split(): | ||
306 | f.write('%s\n' % m) | ||
307 | f.close() | ||
308 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) | ||
309 | if not postinst: | ||
310 | bb.fatal("pkg_postinst_%s not defined" % pkg) | ||
311 | postinst += bb.data.getVar('autoload_postinst_fragment', d, 1) % autoload | ||
312 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
313 | |||
314 | # Write out any modconf fragment | ||
315 | modconf = bb.data.getVar('module_conf_%s' % basename, d, 1) | ||
316 | if modconf: | ||
317 | name = '%s/etc/modutils/%s.conf' % (dvar, basename) | ||
318 | f = open(name, 'w') | ||
319 | f.write("%s\n" % modconf) | ||
320 | f.close() | ||
321 | |||
322 | files = bb.data.getVar('FILES_%s' % pkg, d, 1) | ||
323 | files = "%s /etc/modutils/%s /etc/modutils/%s.conf" % (files, basename, basename) | ||
324 | bb.data.setVar('FILES_%s' % pkg, files, d) | ||
325 | |||
326 | if vals.has_key("description"): | ||
327 | old_desc = bb.data.getVar('DESCRIPTION_' + pkg, d, 1) or "" | ||
328 | bb.data.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"], d) | ||
329 | |||
330 | rdepends_str = bb.data.getVar('RDEPENDS_' + pkg, d, 1) | ||
331 | if rdepends_str: | ||
332 | rdepends = rdepends_str.split() | ||
333 | else: | ||
334 | rdepends = [] | ||
335 | rdepends.extend(get_dependencies(file, pattern, format)) | ||
336 | bb.data.setVar('RDEPENDS_' + pkg, ' '.join(rdepends), d) | ||
337 | |||
338 | module_deps = parse_depmod() | ||
339 | module_regex = '^(.*)\.k?o$' | ||
340 | module_pattern = 'kernel-module-%s' | ||
341 | |||
342 | postinst = bb.data.getVar('pkg_postinst_modules', d, 1) | ||
343 | postrm = bb.data.getVar('pkg_postrm_modules', d, 1) | ||
344 | do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-image-%s' % bb.data.getVar("KERNEL_VERSION", d, 1)) | ||
345 | |||
346 | import re, os | ||
347 | metapkg = "kernel-modules" | ||
348 | bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) | ||
349 | bb.data.setVar('FILES_' + metapkg, "", d) | ||
350 | blacklist = [ 'kernel-dev', 'kernel-image' ] | ||
351 | for l in module_deps.values(): | ||
352 | for i in l: | ||
353 | pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) | ||
354 | blacklist.append(pkg) | ||
355 | metapkg_rdepends = [] | ||
356 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
357 | for pkg in packages[1:]: | ||
358 | if not pkg in blacklist and not pkg in metapkg_rdepends: | ||
359 | metapkg_rdepends.append(pkg) | ||
360 | bb.data.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends), d) | ||
361 | bb.data.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package', d) | ||
362 | packages.append(metapkg) | ||
363 | bb.data.setVar('PACKAGES', ' '.join(packages), d) | ||
364 | |||
365 | v = bb.data.getVar("PARALLEL_INSTALL_MODULES", d, 1) or "0" | ||
366 | if v == "1": | ||
367 | kv = bb.data.getVar("KERNEL_MAJOR_VERSION", d, 1) | ||
368 | packages = bb.data.getVar("PACKAGES", d, 1) | ||
369 | module_re = re.compile("^kernel-module-") | ||
370 | for p in packages.split(): | ||
371 | if not module_re.match(p): | ||
372 | continue | ||
373 | pkg = bb.data.getVar("PKG_%s" % p, d, 1) or p | ||
374 | newpkg = "%s-%s" % (pkg, kv) | ||
375 | bb.data.setVar("PKG_%s" % p, newpkg, d) | ||
376 | rprovides = bb.data.getVar("RPROVIDES_%s" % p, d, 1) | ||
377 | if rprovides: | ||
378 | rprovides = "%s %s" % (rprovides, pkg) | ||
379 | else: | ||
380 | rprovides = pkg | ||
381 | bb.data.setVar("RPROVIDES_%s" % p, rprovides, d) | ||
382 | } | ||
diff --git a/openembedded/classes/lib_package.bbclass b/openembedded/classes/lib_package.bbclass new file mode 100644 index 0000000000..e29d2659b0 --- /dev/null +++ b/openembedded/classes/lib_package.bbclass | |||
@@ -0,0 +1,9 @@ | |||
1 | PACKAGES = "${PN} ${PN}-dev ${PN}-doc ${PN}-bin" | ||
2 | |||
3 | FILES_${PN} = "${libexecdir} ${libdir}/lib*.so.* \ | ||
4 | ${sysconfdir} ${sharedstatedir} ${localstatedir} \ | ||
5 | /lib/*.so* ${datadir}/${PN} ${libdir}/${PN}" | ||
6 | FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la \ | ||
7 | ${libdir}/*.a ${libdir}/pkgconfig /lib/*.a /lib/*.o \ | ||
8 | ${datadir}/aclocal ${bindir}/*-config" | ||
9 | FILES_${PN}-bin = "${bindir} ${sbindir} /bin /sbin" | ||
diff --git a/openembedded/classes/linux_modules.bbclass b/openembedded/classes/linux_modules.bbclass new file mode 100644 index 0000000000..d5c4e74ca1 --- /dev/null +++ b/openembedded/classes/linux_modules.bbclass | |||
@@ -0,0 +1,19 @@ | |||
1 | def get_kernelmajorversion(p): | ||
2 | import re | ||
3 | r = re.compile("([0-9]+\.[0-9]+).*") | ||
4 | m = r.match(p); | ||
5 | if m: | ||
6 | return m.group(1) | ||
7 | return None | ||
8 | |||
9 | def linux_module_packages(s, d): | ||
10 | import bb, os.path | ||
11 | suffix = "" | ||
12 | if (bb.data.getVar("PARALLEL_INSTALL_MODULES", d, 1) == "1"): | ||
13 | file = bb.data.expand('${STAGING_KERNEL_DIR}/kernel-abiversion', d) | ||
14 | if (os.path.exists(file)): | ||
15 | suffix = "-%s" % (get_kernelmajorversion(base_read_file(file))) | ||
16 | return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) | ||
17 | |||
18 | # that's all | ||
19 | |||
diff --git a/openembedded/classes/module-base.bbclass b/openembedded/classes/module-base.bbclass new file mode 100644 index 0000000000..df0941d561 --- /dev/null +++ b/openembedded/classes/module-base.bbclass | |||
@@ -0,0 +1,17 @@ | |||
1 | inherit module_strip | ||
2 | |||
3 | inherit kernel-arch | ||
4 | |||
5 | export OS = "${TARGET_OS}" | ||
6 | export CROSS_COMPILE = "${TARGET_PREFIX}" | ||
7 | |||
8 | export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}" | ||
9 | export KERNEL_SOURCE = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-source')}" | ||
10 | KERNEL_OBJECT_SUFFIX = "${@[".o", ".ko"][base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion') > "2.6.0"]}" | ||
11 | KERNEL_CCSUFFIX = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-ccsuffix')}" | ||
12 | KERNEL_LDSUFFIX = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-ldsuffix')}" | ||
13 | KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX}" | ||
14 | KERNEL_LD = "${LD}${KERNEL_LDSUFFIX}" | ||
15 | |||
16 | # kernel modules are generally machine specific | ||
17 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/openembedded/classes/module.bbclass b/openembedded/classes/module.bbclass new file mode 100644 index 0000000000..8a13f1f858 --- /dev/null +++ b/openembedded/classes/module.bbclass | |||
@@ -0,0 +1,51 @@ | |||
1 | RDEPENDS += "kernel (${KERNEL_VERSION})" | ||
2 | DEPENDS += "virtual/kernel" | ||
3 | |||
4 | inherit module-base | ||
5 | |||
6 | python populate_packages_prepend() { | ||
7 | v = bb.data.getVar("PARALLEL_INSTALL_MODULES", d, 1) or "0" | ||
8 | if v == "1": | ||
9 | kv = bb.data.getVar("KERNEL_VERSION", d, 1) | ||
10 | packages = bb.data.getVar("PACKAGES", d, 1) | ||
11 | for p in packages.split(): | ||
12 | pkg = bb.data.getVar("PKG_%s" % p, d, 1) or p | ||
13 | newpkg = "%s-%s" % (pkg, kv) | ||
14 | bb.data.setVar("PKG_%s" % p, newpkg, d) | ||
15 | rprovides = bb.data.getVar("RPROVIDES_%s" % p, d, 1) | ||
16 | if rprovides: | ||
17 | rprovides = "%s %s" % (rprovides, pkg) | ||
18 | else: | ||
19 | rprovides = pkg | ||
20 | bb.data.setVar("RPROVIDES_%s" % p, rprovides, d) | ||
21 | } | ||
22 | |||
23 | module_do_compile() { | ||
24 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
25 | oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \ | ||
26 | KERNEL_SRC=${STAGING_KERNEL_DIR} \ | ||
27 | KERNEL_VERSION=${KERNEL_VERSION} \ | ||
28 | CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ | ||
29 | ${MAKE_TARGETS} | ||
30 | } | ||
31 | |||
32 | module_do_install() { | ||
33 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
34 | oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" modules_install | ||
35 | } | ||
36 | |||
37 | pkg_postinst_append () { | ||
38 | if [ -n "$D" ]; then | ||
39 | exit 1 | ||
40 | fi | ||
41 | depmod -A | ||
42 | update-modules || true | ||
43 | } | ||
44 | |||
45 | pkg_postrm_append () { | ||
46 | update-modules || true | ||
47 | } | ||
48 | |||
49 | EXPORT_FUNCTIONS do_compile do_install | ||
50 | |||
51 | FILES_${PN} = "/etc /lib/modules" | ||
diff --git a/openembedded/classes/module_strip.bbclass b/openembedded/classes/module_strip.bbclass new file mode 100644 index 0000000000..116e8b902f --- /dev/null +++ b/openembedded/classes/module_strip.bbclass | |||
@@ -0,0 +1,18 @@ | |||
1 | #DEPENDS_append = " module-strip" | ||
2 | |||
3 | do_strip_modules () { | ||
4 | for p in ${PACKAGES}; do | ||
5 | if test -e ${WORKDIR}/install/$p/lib/modules; then | ||
6 | modules="`find ${WORKDIR}/install/$p/lib/modules -name \*${KERNEL_OBJECT_SUFFIX}`" | ||
7 | if [ -n "$modules" ]; then | ||
8 | ${STRIP} -v -g $modules | ||
9 | # NM="${CROSS_DIR}/bin/${HOST_PREFIX}nm" OBJCOPY="${CROSS_DIR}/bin/${HOST_PREFIX}objcopy" strip_module $modules | ||
10 | fi | ||
11 | fi | ||
12 | done | ||
13 | } | ||
14 | |||
15 | python do_package_append () { | ||
16 | if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): | ||
17 | bb.build.exec_func('do_strip_modules', d) | ||
18 | } | ||
diff --git a/openembedded/classes/mozilla.bbclass b/openembedded/classes/mozilla.bbclass new file mode 100644 index 0000000000..629f2531da --- /dev/null +++ b/openembedded/classes/mozilla.bbclass | |||
@@ -0,0 +1,53 @@ | |||
1 | SECTION = "x11/utils" | ||
2 | DEPENDS += "gnu-config-native virtual/libintl xt libxi \ | ||
3 | zip-native gtk+ orbit2 libidl-native" | ||
4 | LICENSE = "MPL NPL" | ||
5 | SRC_URI += "file://mozconfig" | ||
6 | |||
7 | inherit gettext | ||
8 | |||
9 | EXTRA_OECONF = "--target=${TARGET_SYS} --host=${BUILD_SYS} \ | ||
10 | --build=${BUILD_SYS} --prefix=${prefix}" | ||
11 | EXTRA_OEMAKE = "'HOST_LIBIDL_LIBS=${HOST_LIBIDL_LIBS}' \ | ||
12 | 'HOST_LIBIDL_CFLAGS=${HOST_LIBIDL_CFLAGS}'" | ||
13 | SELECTED_OPTIMIZATION = "-Os -fsigned-char -fno-strict-aliasing" | ||
14 | |||
15 | export CROSS_COMPILE = "1" | ||
16 | export MOZCONFIG = "${WORKDIR}/mozconfig" | ||
17 | export MOZ_OBJDIR = "${S}" | ||
18 | |||
19 | export CONFIGURE_ARGS = "${EXTRA_OECONF}" | ||
20 | export HOST_LIBIDL_CFLAGS = "`${HOST_LIBIDL_CONFIG} --cflags`" | ||
21 | export HOST_LIBIDL_LIBS = "`${HOST_LIBIDL_CONFIG} --libs`" | ||
22 | export HOST_LIBIDL_CONFIG = "PKG_CONFIG_PATH=${STAGING_BINDIR}/../share/pkgconfig pkg-config libIDL-2.0" | ||
23 | export HOST_CC = "${BUILD_CC}" | ||
24 | export HOST_CXX = "${BUILD_CXX}" | ||
25 | export HOST_CFLAGS = "${BUILD_CFLAGS}" | ||
26 | export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}" | ||
27 | export HOST_LDFLAGS = "${BUILD_LDFLAGS}" | ||
28 | export HOST_RANLIB = "${BUILD_RANLIB}" | ||
29 | export HOST_AR = "${BUILD_AR}" | ||
30 | |||
31 | mozilla_do_configure() { | ||
32 | ( | ||
33 | set -e | ||
34 | for cg in `find ${S} -name config.guess`; do | ||
35 | install -m 0755 \ | ||
36 | ${STAGING_BINDIR}/../share/gnu-config/config.guess \ | ||
37 | ${STAGING_BINDIR}/../share/gnu-config/config.sub \ | ||
38 | `dirname $cg`/ | ||
39 | done | ||
40 | ) | ||
41 | oe_runmake -f client.mk ${MOZ_OBJDIR}/Makefile \ | ||
42 | ${MOZ_OBJDIR}/config.status | ||
43 | } | ||
44 | |||
45 | mozilla_do_compile() { | ||
46 | oe_runmake -f client.mk build_all | ||
47 | } | ||
48 | |||
49 | mozilla_do_install() { | ||
50 | oe_runmake DESTDIR="${D}" destdir="${D}" install | ||
51 | } | ||
52 | |||
53 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
diff --git a/openembedded/classes/multimachine.inc b/openembedded/classes/multimachine.inc new file mode 100644 index 0000000000..1f73ffd30f --- /dev/null +++ b/openembedded/classes/multimachine.inc | |||
@@ -0,0 +1,3 @@ | |||
1 | STAMP = "${TMPDIR}/stamps/${PACKAGE_ARCH}-${HOST_OS}/${PF}" | ||
2 | WORKDIR = "${TMPDIR}/work/${PACKAGE_ARCH}-${HOST_OS}/${PF}" | ||
3 | STAGING_KERNEL_DIR = "${STAGING_DIR}/${PACKAGE_ARCH}-${HOST_OS}/kernel" | ||
diff --git a/openembedded/classes/native.bbclass b/openembedded/classes/native.bbclass new file mode 100644 index 0000000000..955a8ae646 --- /dev/null +++ b/openembedded/classes/native.bbclass | |||
@@ -0,0 +1,68 @@ | |||
1 | inherit base | ||
2 | |||
3 | # Native packages are built indirectly via dependency, | ||
4 | # no need for them to be a direct target of 'world' | ||
5 | EXCLUDE_FROM_WORLD = "1" | ||
6 | |||
7 | PACKAGES = "" | ||
8 | |||
9 | TARGET_ARCH = "${BUILD_ARCH}" | ||
10 | TARGET_OS = "${BUILD_OS}" | ||
11 | TARGET_VENDOR = "${BUILD_VENDOR}" | ||
12 | TARGET_PREFIX = "${BUILD_PREFIX}" | ||
13 | TARGET_CC_ARCH = "${BUILD_CC_ARCH}" | ||
14 | |||
15 | HOST_ARCH = "${BUILD_ARCH}" | ||
16 | HOST_OS = "${BUILD_OS}" | ||
17 | HOST_VENDOR = "${BUILD_VENDOR}" | ||
18 | HOST_PREFIX = "${BUILD_PREFIX}" | ||
19 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" | ||
20 | |||
21 | CPPFLAGS = "${BUILD_CPPFLAGS}" | ||
22 | CFLAGS = "${BUILD_CFLAGS}" | ||
23 | CXXFLAGS = "${BUILD_CFLAGS}" | ||
24 | LDFLAGS = "${BUILD_LDFLAGS}" | ||
25 | |||
26 | # Path prefixes | ||
27 | base_prefix = "${exec_prefix}" | ||
28 | prefix = "${STAGING_DIR}" | ||
29 | exec_prefix = "${STAGING_DIR}/${BUILD_ARCH}-${BUILD_OS}" | ||
30 | |||
31 | # Base paths | ||
32 | base_bindir = "${base_prefix}/bin" | ||
33 | base_sbindir = "${base_prefix}/bin" | ||
34 | base_libdir = "${base_prefix}/lib" | ||
35 | |||
36 | # Architecture independent paths | ||
37 | sysconfdir = "${prefix}/etc" | ||
38 | sharedstatedir = "${prefix}/com" | ||
39 | localstatedir = "${prefix}/var" | ||
40 | infodir = "${datadir}/info" | ||
41 | mandir = "${datadir}/man" | ||
42 | docdir = "${datadir}/doc" | ||
43 | servicedir = "${prefix}/srv" | ||
44 | |||
45 | # Architecture dependent paths | ||
46 | bindir = "${exec_prefix}/bin" | ||
47 | sbindir = "${exec_prefix}/bin" | ||
48 | libexecdir = "${exec_prefix}/libexec" | ||
49 | libdir = "${exec_prefix}/lib" | ||
50 | includedir = "${exec_prefix}/include" | ||
51 | oldincludedir = "${exec_prefix}/include" | ||
52 | |||
53 | # Datadir is made arch dependent here, primarily | ||
54 | # for autoconf macros, and other things that | ||
55 | # may be manipulated to handle crosscompilation | ||
56 | # issues. | ||
57 | datadir = "${exec_prefix}/share" | ||
58 | |||
59 | do_stage () { | ||
60 | if [ "${INHIBIT_NATIVE_STAGE_INSTALL}" != "1" ] | ||
61 | then | ||
62 | oe_runmake install | ||
63 | fi | ||
64 | } | ||
65 | |||
66 | do_install () { | ||
67 | true | ||
68 | } | ||
diff --git a/openembedded/classes/nslu2-jffs2-image.bbclass b/openembedded/classes/nslu2-jffs2-image.bbclass new file mode 100644 index 0000000000..56ad0f0659 --- /dev/null +++ b/openembedded/classes/nslu2-jffs2-image.bbclass | |||
@@ -0,0 +1,18 @@ | |||
1 | NSLU2_SLUGIMAGE_ARGS ?= "" | ||
2 | |||
3 | nslu2_pack_image () { | ||
4 | install -d ${DEPLOY_DIR_IMAGE}/slug | ||
5 | install -m 0644 ${STAGING_LIBDIR}/nslu2-binaries/RedBoot \ | ||
6 | ${STAGING_LIBDIR}/nslu2-binaries/Trailer \ | ||
7 | ${STAGING_LIBDIR}/nslu2-binaries/SysConf \ | ||
8 | ${DEPLOY_DIR_IMAGE}/slug/ | ||
9 | install -m 0644 ${DEPLOY_DIR_IMAGE}/zImage-${IMAGE_BASENAME} ${DEPLOY_DIR_IMAGE}/slug/vmlinuz | ||
10 | install -m 0644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${DEPLOY_DIR_IMAGE}/slug/flashdisk.jffs2 | ||
11 | cd ${DEPLOY_DIR_IMAGE}/slug | ||
12 | slugimage -p -b RedBoot -s SysConf -r Ramdisk:1,Flashdisk:flashdisk.jffs2 -t Trailer \ | ||
13 | -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flashdisk.img ${NSLU2_SLUGIMAGE_ARGS} | ||
14 | rm -rf ${DEPLOY_DIR_IMAGE}/slug | ||
15 | } | ||
16 | |||
17 | EXTRA_IMAGEDEPENDS += 'slugimage-native nslu2-linksys-firmware' | ||
18 | IMAGE_POSTPROCESS_COMMAND += "nslu2_pack_image; " | ||
diff --git a/openembedded/classes/nslu2-mirrors.bbclass b/openembedded/classes/nslu2-mirrors.bbclass new file mode 100644 index 0000000000..1181edc716 --- /dev/null +++ b/openembedded/classes/nslu2-mirrors.bbclass | |||
@@ -0,0 +1,4 @@ | |||
1 | MIRRORS_append () { | ||
2 | ftp://.*/.*/ http://sources.nslu2-linux.org/sources/ | ||
3 | http://.*/.*/ http://sources.nslu2-linux.org/sources/ | ||
4 | } | ||
diff --git a/openembedded/classes/nslu2-ramdisk-image.bbclass b/openembedded/classes/nslu2-ramdisk-image.bbclass new file mode 100644 index 0000000000..0b545854fd --- /dev/null +++ b/openembedded/classes/nslu2-ramdisk-image.bbclass | |||
@@ -0,0 +1,18 @@ | |||
1 | NSLU2_SLUGIMAGE_ARGS ?= "" | ||
2 | |||
3 | nslu2_pack_image () { | ||
4 | install -d ${DEPLOY_DIR_IMAGE}/slug | ||
5 | install -m 0644 ${STAGING_LIBDIR}/nslu2-binaries/RedBoot \ | ||
6 | ${STAGING_LIBDIR}/nslu2-binaries/Trailer \ | ||
7 | ${STAGING_LIBDIR}/nslu2-binaries/SysConf \ | ||
8 | ${DEPLOY_DIR_IMAGE}/slug/ | ||
9 | install -m 0644 ${DEPLOY_DIR_IMAGE}/zImage-${IMAGE_BASENAME} ${DEPLOY_DIR_IMAGE}/slug/vmlinuz | ||
10 | install -m 0644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/slug/ramdisk.ext2.gz | ||
11 | cd ${DEPLOY_DIR_IMAGE}/slug | ||
12 | slugimage -p -b RedBoot -s SysConf -r Ramdisk:ramdisk.ext2.gz -t Trailer \ | ||
13 | -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ramdisk.img ${NSLU2_SLUGIMAGE_ARGS} | ||
14 | rm -rf ${DEPLOY_DIR_IMAGE}/slug | ||
15 | } | ||
16 | |||
17 | EXTRA_IMAGEDEPENDS += 'slugimage-native nslu2-linksys-firmware' | ||
18 | IMAGE_POSTPROCESS_COMMAND += "nslu2_pack_image; " | ||
diff --git a/openembedded/classes/nylon-mirrors.bbclass b/openembedded/classes/nylon-mirrors.bbclass new file mode 100644 index 0000000000..2986bd8f80 --- /dev/null +++ b/openembedded/classes/nylon-mirrors.bbclass | |||
@@ -0,0 +1,6 @@ | |||
1 | MIRRORS_append () { | ||
2 | ftp://.*/.*/ http://meshcube.org/nylon/stable/sources/ | ||
3 | http://.*/.*/ http://meshcube.org/nylon/stable/sources/ | ||
4 | ftp://.*/.*/ http://meshcube.org/nylon/unstable/sources/ | ||
5 | http://.*/.*/ http://meshcube.org/nylon/unstable/sources/ | ||
6 | } \ No newline at end of file | ||
diff --git a/openembedded/classes/oebuildstamp.bbclass b/openembedded/classes/oebuildstamp.bbclass new file mode 100644 index 0000000000..1de1b95c2e --- /dev/null +++ b/openembedded/classes/oebuildstamp.bbclass | |||
@@ -0,0 +1,16 @@ | |||
1 | # | ||
2 | # Because base.oeclasses set the variable | ||
3 | # | ||
4 | # do_fetch[nostamp] = "1" | ||
5 | # do_build[nostamp] = "1" | ||
6 | # | ||
7 | # for every build we're doing oemake calls all of the phases to check if | ||
8 | # something new is to download. This class unset's this nostamp flag. This | ||
9 | # makes a package "finished", once it's completely build. | ||
10 | # | ||
11 | # This means that the subsequent builds are faster, but when you change the | ||
12 | # behaviour of the package, e.g. by adding INHERIT="package_ipk", you won't | ||
13 | # get the ipk file except you delete the build stamp manually or all of them | ||
14 | # with oebuild clean <oe-file>. | ||
15 | |||
16 | do_build[nostamp] = "" | ||
diff --git a/openembedded/classes/oelint.bbclass b/openembedded/classes/oelint.bbclass new file mode 100644 index 0000000000..baa1c630b4 --- /dev/null +++ b/openembedded/classes/oelint.bbclass | |||
@@ -0,0 +1,174 @@ | |||
1 | addtask lint before do_fetch | ||
2 | do_lint[nostamp] = 1 | ||
3 | python do_lint() { | ||
4 | def testVar(var, explain=None): | ||
5 | try: | ||
6 | s = d[var] | ||
7 | return s["content"] | ||
8 | except KeyError: | ||
9 | bb.error("%s is not set" % var) | ||
10 | if explain: bb.note(explain) | ||
11 | return None | ||
12 | |||
13 | |||
14 | ############################## | ||
15 | # Test that DESCRIPTION exists | ||
16 | # | ||
17 | testVar("DESCRIPTION") | ||
18 | |||
19 | |||
20 | ############################## | ||
21 | # Test that HOMEPAGE exists | ||
22 | # | ||
23 | s = testVar("HOMEPAGE") | ||
24 | if s=="unknown": | ||
25 | bb.error("HOMEPAGE is not set") | ||
26 | elif not s.startswith("http://"): | ||
27 | bb.error("HOMEPAGE doesn't start with http://") | ||
28 | |||
29 | |||
30 | |||
31 | ############################## | ||
32 | # Test for valid LICENSE | ||
33 | # | ||
34 | valid_licenses = { | ||
35 | "GPL-2" : "GPLv2", | ||
36 | "GPL LGPL FDL" : True, | ||
37 | "GPL PSF" : True, | ||
38 | "GPL/QPL" : True, | ||
39 | "GPL" : True, | ||
40 | "GPLv2" : True, | ||
41 | "IBM" : True, | ||
42 | "LGPL GPL" : True, | ||
43 | "LGPL" : True, | ||
44 | "MIT" : True, | ||
45 | "OSL" : True, | ||
46 | "Perl" : True, | ||
47 | "Public Domain" : True, | ||
48 | "QPL" : "GPL/QPL", | ||
49 | } | ||
50 | s = testVar("LICENSE") | ||
51 | if s=="unknown": | ||
52 | bb.error("LICENSE is not set") | ||
53 | elif s.startswith("Vendor"): | ||
54 | pass | ||
55 | else: | ||
56 | try: | ||
57 | newlic = valid_licenses[s] | ||
58 | if newlic == False: | ||
59 | bb.note("LICENSE '%s' is not recommended" % s) | ||
60 | elif newlic != True: | ||
61 | bb.note("LICENSE '%s' is not recommended, better use '%s'" % (s, newsect)) | ||
62 | except: | ||
63 | bb.note("LICENSE '%s' is not recommended" % s) | ||
64 | |||
65 | |||
66 | ############################## | ||
67 | # Test for valid MAINTAINER | ||
68 | # | ||
69 | s = testVar("MAINTAINER") | ||
70 | if s=="OpenEmbedded Team <oe@handhelds.org>": | ||
71 | bb.error("explicit MAINTAINER is missing, using default") | ||
72 | elif s and s.find("@") == -1: | ||
73 | bb.error("You forgot to put an e-mail address into MAINTAINER") | ||
74 | |||
75 | |||
76 | ############################## | ||
77 | # Test for valid SECTION | ||
78 | # | ||
79 | # if Correct section: True section name is valid | ||
80 | # False section name is invalid, no suggestion | ||
81 | # string section name is invalid, better name suggested | ||
82 | # | ||
83 | valid_sections = { | ||
84 | # Current Section Correct section | ||
85 | "apps" : True, | ||
86 | "audio" : True, | ||
87 | "base" : True, | ||
88 | "console/games" : True, | ||
89 | "console/net" : "console/network", | ||
90 | "console/network" : True, | ||
91 | "console/utils" : True, | ||
92 | "devel" : True, | ||
93 | "developing" : "devel", | ||
94 | "devel/python" : True, | ||
95 | "fonts" : True, | ||
96 | "games" : True, | ||
97 | "games/libs" : True, | ||
98 | "gnome/base" : True, | ||
99 | "gnome/libs" : True, | ||
100 | "gpe" : True, | ||
101 | "gpe/libs" : True, | ||
102 | "gui" : False, | ||
103 | "libc" : "libs", | ||
104 | "libs" : True, | ||
105 | "libs/net" : True, | ||
106 | "multimedia" : True, | ||
107 | "net" : "network", | ||
108 | "NET" : "network", | ||
109 | "network" : True, | ||
110 | "opie/applets" : True, | ||
111 | "opie/applications" : True, | ||
112 | "opie/base" : True, | ||
113 | "opie/codecs" : True, | ||
114 | "opie/decorations" : True, | ||
115 | "opie/fontfactories" : True, | ||
116 | "opie/fonts" : True, | ||
117 | "opie/games" : True, | ||
118 | "opie/help" : True, | ||
119 | "opie/inputmethods" : True, | ||
120 | "opie/libs" : True, | ||
121 | "opie/multimedia" : True, | ||
122 | "opie/pim" : True, | ||
123 | "opie/setting" : "opie/settings", | ||
124 | "opie/settings" : True, | ||
125 | "opie/Shell" : False, | ||
126 | "opie/styles" : True, | ||
127 | "opie/today" : True, | ||
128 | "scientific" : True, | ||
129 | "utils" : True, | ||
130 | "x11" : True, | ||
131 | "x11/libs" : True, | ||
132 | "x11/wm" : True, | ||
133 | } | ||
134 | s = testVar("SECTION") | ||
135 | if s: | ||
136 | try: | ||
137 | newsect = valid_sections[s] | ||
138 | if newsect == False: | ||
139 | bb.note("SECTION '%s' is not recommended" % s) | ||
140 | elif newsect != True: | ||
141 | bb.note("SECTION '%s' is not recommended, better use '%s'" % (s, newsect)) | ||
142 | except: | ||
143 | bb.note("SECTION '%s' is not recommended" % s) | ||
144 | |||
145 | if not s.islower(): | ||
146 | bb.error("SECTION should only use lower case") | ||
147 | |||
148 | |||
149 | |||
150 | |||
151 | ############################## | ||
152 | # Test for valid PRIORITY | ||
153 | # | ||
154 | valid_priorities = { | ||
155 | "standard" : True, | ||
156 | "required" : True, | ||
157 | "optional" : True, | ||
158 | "extra" : True, | ||
159 | } | ||
160 | s = testVar("PRIORITY") | ||
161 | if s: | ||
162 | try: | ||
163 | newprio = valid_priorities[s] | ||
164 | if newprio == False: | ||
165 | bb.note("PRIORITY '%s' is not recommended" % s) | ||
166 | elif newprio != True: | ||
167 | bb.note("PRIORITY '%s' is not recommended, better use '%s'" % (s, newprio)) | ||
168 | except: | ||
169 | bb.note("PRIORITY '%s' is not recommended" % s) | ||
170 | |||
171 | if not s.islower(): | ||
172 | bb.error("PRIORITY should only use lower case") | ||
173 | |||
174 | } | ||
diff --git a/openembedded/classes/opie.bbclass b/openembedded/classes/opie.bbclass new file mode 100644 index 0000000000..7326128d98 --- /dev/null +++ b/openembedded/classes/opie.bbclass | |||
@@ -0,0 +1,99 @@ | |||
1 | # | ||
2 | # This oeclass takes care about some of the itchy details of installing parts | ||
3 | # of Opie applications. Depending on quicklaunch or not, plugin or not, the | ||
4 | # TARGET is either a shared object, a shared object with a link to quicklauncher, | ||
5 | # or a usual binary. | ||
6 | # | ||
7 | # You have to provide two things: 1.) A proper SECTION field, and 2.) a proper APPNAME | ||
8 | # Then opie.oeclass will: | ||
9 | # * create the directory for the binary and install the binary file(s) | ||
10 | # * for applications: create the directory for the .desktop and install the .desktop file | ||
11 | # * for quicklauncher applications: create the startup symlink to the quicklauncher | ||
12 | # You can override the automatic detection of APPTYPE, valid values are 'quicklaunch', 'binary', 'plugin' | ||
13 | # You can override the default location of APPDESKTOP (<workdir>/apps/<section>/) | ||
14 | # | ||
15 | |||
16 | inherit palmtop | ||
17 | |||
18 | DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}" | ||
19 | |||
20 | # to be consistent, put all targets into workdir | ||
21 | EXTRA_QMAKEVARS_POST_append = " DESTDIR=${S}" | ||
22 | |||
23 | # Opie standard TAG value | ||
24 | TAG = "${@'v' + bb.data.getVar('PV',d,1).replace('.', '_')}" | ||
25 | |||
26 | # plan for later: | ||
27 | # add common scopes for opie applications, see qmake-native/common.pro | ||
28 | # qmake should care about all the details then. qmake can do that, i know it :) | ||
29 | # | ||
30 | |||
31 | python opie_do_opie_install() { | ||
32 | import os, shutil | ||
33 | section = bb.data.getVar( "SECTION", d ).split( '/' )[1] or "Applications" | ||
34 | section = section.title() | ||
35 | if section in ( "Base", "Libs" ): | ||
36 | bb.note( "Section = Base or Libs. Target won't be installed automatically." ) | ||
37 | return | ||
38 | |||
39 | # SECTION : BINDIR DESKTOPDIR | ||
40 | dirmap = { "Applets" : ( "/plugins/applets", None ), | ||
41 | "Applications" : ( "<BINDIR>", "/apps/Applications" ), | ||
42 | "Multimedia" : ( "<BINDIR>", "/apps/Applications" ), | ||
43 | "Games" : ( "<BINDIR>", "/apps/Games" ), | ||
44 | "Settings" : ( "<BINDIR>", "/apps/Settings" ), | ||
45 | "Pim" : ( "<BINDIR>", "/apps/1Pim" ), | ||
46 | "Examples" : ( "<BINDIR>", "/apps/Examples" ), | ||
47 | "Shell" : ( "/bin", "/apps/Opie-SH" ), | ||
48 | "Codecs" : ( "/plugins/codecs", None ), | ||
49 | "Decorations" : ( "/plugins/decorations", None ), | ||
50 | "Inputmethods" : ( "/plugins/inputmethods", None ), | ||
51 | "Fontfactories" : ( "/plugins/fontfactories", None ), | ||
52 | "Security" : ( "/plugins/security", None ), | ||
53 | "Styles" : ( "/plugins/styles", None ), | ||
54 | "Today" : ( "/plugins/today", None ), | ||
55 | "Datebook" : ( "/plugins/holidays", None ), | ||
56 | "Networksettings" : ( "/plugins/networksettings", None ) } | ||
57 | |||
58 | if section not in dirmap: | ||
59 | raise ValueError, "Unknown section '%s'. Valid sections are: %s" % ( section, dirmap.keys() ) | ||
60 | |||
61 | bindir, desktopdir = dirmap[section] | ||
62 | APPNAME = bb.data.getVar( "APPNAME", d, True ) or bb.data.getVar( "PN", d, True ) | ||
63 | APPTYPE = bb.data.getVar( "APPTYPE", d, True ) | ||
64 | if not APPTYPE: | ||
65 | if bindir == "<BINDIR>": | ||
66 | APPTYPE = "quicklaunch" | ||
67 | else: | ||
68 | APPTYPE = "plugin" | ||
69 | |||
70 | appmap = { "binary":"/bin", "quicklaunch":"/plugins/application" } | ||
71 | if bindir == "<BINDIR>": bindir = appmap[APPTYPE] | ||
72 | |||
73 | bb.note( "Section='%s', bindir='%s', desktopdir='%s', name='%s', type='%s'" % | ||
74 | ( section, bindir, desktopdir, APPNAME, APPTYPE ) ) | ||
75 | |||
76 | S = bb.data.getVar( "S", d, 1 ) | ||
77 | D = "%s/image" % bb.data.getVar( "WORKDIR", d, True ) | ||
78 | WORKDIR = bb.data.getVar( "WORKDIR", d, True ) | ||
79 | palmtopdir = bb.data.getVar( "palmtopdir", d ) | ||
80 | APPDESKTOP = bb.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir ) | ||
81 | |||
82 | if desktopdir is not None: | ||
83 | os.system( "install -d %s%s%s/" % ( D, palmtopdir, desktopdir ) ) | ||
84 | os.system( "install -m 0644 %s/%s.desktop %s%s%s/" % ( APPDESKTOP, APPNAME, D, palmtopdir, desktopdir ) ) | ||
85 | |||
86 | os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) ) | ||
87 | |||
88 | if APPTYPE == "binary": | ||
89 | os.system( "install -m 0755 %s/%s %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
90 | elif APPTYPE == "quicklaunch": | ||
91 | os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
92 | os.system( "install -d %s%s/bin/" % ( D, palmtopdir ) ) | ||
93 | os.system( "ln -sf %s/bin/quicklauncher %s%s/bin/%s" % ( palmtopdir, D, palmtopdir, APPNAME ) ) | ||
94 | elif APPTYPE == "plugin": | ||
95 | os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
96 | } | ||
97 | |||
98 | EXPORT_FUNCTIONS do_opie_install | ||
99 | addtask opie_install after do_compile before do_populate_staging | ||
diff --git a/openembedded/classes/opie_i18n.bbclass b/openembedded/classes/opie_i18n.bbclass new file mode 100644 index 0000000000..cb3d07de75 --- /dev/null +++ b/openembedded/classes/opie_i18n.bbclass | |||
@@ -0,0 +1,163 @@ | |||
1 | # classes/opie_i18n.oeclass Matthias 'CoreDump' Hentges 16-10-2004 | ||
2 | # | ||
3 | # Automatically builds i18n ipks for opie packages. It downloads opie-i18n from opie CVS | ||
4 | # and tries to guess the name of the .ts file based on the package name: | ||
5 | # ${PN}.ts, lib${PN}.ts and opie-${PN}.ts are all valid. The .ts "guessing" can be | ||
6 | # disabled by setting I18N_FILES in the .oe file. | ||
7 | # | ||
8 | # Todo: | ||
9 | # | ||
10 | |||
11 | I18N_STATS = "1" | ||
12 | SRC_URI += "${HANDHELDS_CVS};module=opie/i18n" | ||
13 | DEPENDS += "opie-i18n" | ||
14 | |||
15 | die () { | ||
16 | echo -e "opie_18n: ERROR: $1" | ||
17 | exit 1 | ||
18 | } | ||
19 | |||
20 | python do_build_opie_i18n_data() { | ||
21 | |||
22 | import os, bb, re | ||
23 | workdir = bb.data.getVar("WORKDIR", d, 1) | ||
24 | packages = bb.data.getVar("PACKAGES", d, 1) | ||
25 | files = bb.data.getVar("FILES", d, 1) | ||
26 | section = bb.data.getVar("SECTION", d, 1) | ||
27 | pn = bb.data.getVar("PN", d, 1) | ||
28 | rdepends = bb.data.getVar("RDEPENDS", d, 1) | ||
29 | |||
30 | if os.path.exists(workdir + "/PACKAGES.tmp"): | ||
31 | fd = open(workdir + "/PACKAGES.tmp", 'r') | ||
32 | lines = fd.readlines() | ||
33 | fd.close() | ||
34 | |||
35 | bb.data.setVar('PACKAGES', " ".join(lines).lower() + " " + packages, d) | ||
36 | |||
37 | fd = open(workdir + "/FILES.tmp", 'r') | ||
38 | lines = fd.readlines() | ||
39 | fd.close() | ||
40 | |||
41 | for l in lines: | ||
42 | x = re.split("\#", l) | ||
43 | bb.data.setVar('FILES_%s' % x[0].lower(), " " + x[1].strip('\n'), d) | ||
44 | bb.data.setVar('SECTION_%s' % x[0].lower(), "opie/translations", d) | ||
45 | bb.data.setVar('RDEPENDS_%s' % x[0].lower(), pn, d) | ||
46 | |||
47 | bb.data.setVar('SECTION_%s' % pn, section, d) | ||
48 | bb.data.setVar('RDEPENDS', rdepends, d) | ||
49 | else: | ||
50 | bb.note("No translations found for package " + pn) | ||
51 | } | ||
52 | |||
53 | do_build_opie_i18n () { | ||
54 | |||
55 | cd "${WORKDIR}/i18n" || die "ERROR:\nCouldn't find Opies i18n sources in ${PN}/i18n\nMake sure that <inherit opie_i18n> or <inherit opie> is *below* <SRC_URIS =>!" | ||
56 | |||
57 | if test -z "${I18N_FILES}" | ||
58 | then | ||
59 | package_name="`echo "${PN}"| sed "s/^opie\-//"`" | ||
60 | package_name2="`echo "${PN}"| sed "s/^opie\-//;s/\-//"`" | ||
61 | test "$package_name" != "$package_name2" && I18N_FILES="${package_name}.ts lib${package_name}.ts opie-${package_name}.ts ${package_name2}.ts lib${package_name2}.ts opie-${package_name2}.ts" | ||
62 | test "$package_name" = "$package_name2" && I18N_FILES="${package_name}.ts lib${package_name}.ts opie-${package_name}.ts" | ||
63 | echo -e "I18N Datafiles: ${I18N_FILES} (auto-detected)\nYou can overide the auto-detection by setting I18N_FILES in your .oe file" | ||
64 | else | ||
65 | echo "I18N Datafiles: ${I18N_FILES} (provided by .bb)" | ||
66 | fi | ||
67 | |||
68 | rm -f "${WORKDIR}/FILES.tmp" "${WORKDIR}/PACKAGES.tmp" | ||
69 | |||
70 | echo -e "\nFILES is set to [${FILES}]\n" | ||
71 | |||
72 | for file in ${I18N_FILES} | ||
73 | do | ||
74 | echo "Working on [$file]" | ||
75 | for ts_file in `ls -1 */*.ts | egrep "/$file"` | ||
76 | do | ||
77 | echo -e "\tCompiling [$ts_file]" | ||
78 | cd "${WORKDIR}/i18n/`dirname $ts_file`" || die "[${WORKDIR}/i18n/`dirname $ts_file`] not found" | ||
79 | opie-lrelease "`basename $ts_file`" || die "lrelease failed! Make sure that <inherit opie_i18n> or <inherit opie> is *below* <DEPENDS =>!" | ||
80 | |||
81 | # $lang is the language as in de_DE, $lang_sane replaces "_" with "-" | ||
82 | # to allow packaging as "_" is not allowed in a package name | ||
83 | lang="`echo "$ts_file" | sed -n "s#\(.*\)/\(.*\)#\1#p"`" | ||
84 | lang_sane="`echo "$ts_file" | sed -n "s#\(.*\)/\(.*\)#\1#p"|sed s/\_/\-/`" | ||
85 | echo -e "\tPackaging [`basename $ts_file`] for language [$lang]" | ||
86 | |||
87 | install -d ${D}${palmtopdir}/i18n/$lang | ||
88 | install -m 0644 ${WORKDIR}/i18n/$lang/.directory ${D}${palmtopdir}/i18n/$lang/ | ||
89 | install -m 0644 ${WORKDIR}/i18n/$lang/*.qm "${D}${palmtopdir}/i18n/$lang/" | ||
90 | |||
91 | # As it is not possible to modify OE vars from within a _shell_ function, | ||
92 | # some major hacking was needed. These two files will be read by the python | ||
93 | # function do_build_opie_i18n_data() which sets the variables FILES_* and | ||
94 | # PACKAGES as needed. | ||
95 | echo -n "${PN}-${lang_sane} " >> "${WORKDIR}/PACKAGES.tmp" | ||
96 | echo -e "${PN}-${lang_sane}#${palmtopdir}/i18n/$lang" >> "${WORKDIR}/FILES.tmp" | ||
97 | |||
98 | ts_found_something=1 | ||
99 | done | ||
100 | |||
101 | if test "$ts_found_something" != 1 | ||
102 | then | ||
103 | echo -e "\tNo translations found" | ||
104 | else | ||
105 | ts_found_something="" | ||
106 | ts_found="$ts_found $file" | ||
107 | fi | ||
108 | |||
109 | # Only used for debugging purposes | ||
110 | test "${I18N_STATS}" = 1 && cd "${WORKDIR}/i18n" | ||
111 | |||
112 | echo -e "Completed [$file]\n\n" | ||
113 | done | ||
114 | |||
115 | qt_dirs="apps bin etc lib pics plugins share sounds" | ||
116 | |||
117 | for dir in $qt_dirs | ||
118 | do | ||
119 | dir_="$dir_ ${palmtopdir}/$dir " | ||
120 | done | ||
121 | |||
122 | |||
123 | # If we don't adjust FILES to exclude the i18n directory, we will end up with | ||
124 | # _lots_ of empty i18n/$lang directories in the original .ipk. | ||
125 | if (echo "${FILES}" | egrep "${palmtopdir}/? |${palmtopdir}/?$") &>/dev/null | ||
126 | then | ||
127 | echo "NOTE: FILES was set to ${palmtopdir} which would include the i18n directory" | ||
128 | echo -e "\n\nI'll remove ${palmtopdir} from FILES and replace it with all directories" | ||
129 | echo "below QtPalmtop, except i18n ($qt_dirs). See classes/opie_i18n.oeclass for details" | ||
130 | |||
131 | # Removes /opt/QtPalmtop from FILES but keeps /opt/QtPalmtop/$some_dir | ||
132 | FILES="`echo "$FILES"| sed "s#${palmtopdir}[/]\?\$\|${palmtopdir}[/]\? ##"`" | ||
133 | |||
134 | echo "${PN}#$FILES $dir_" >> "${WORKDIR}/FILES.tmp" | ||
135 | fi | ||
136 | |||
137 | # This is the common case for OPIE apps which are installed by opie.oeclass magic | ||
138 | if test -z "${FILES}" | ||
139 | then | ||
140 | echo "NOTE:" | ||
141 | echo -e "Since FILES is empty, i'll add all directories below ${palmtopdir} to it,\nexcluding i18n: ( $qt_dirs )" | ||
142 | echo "${PN}#$FILES $dir_" >> "${WORKDIR}/FILES.tmp" | ||
143 | fi | ||
144 | |||
145 | if ! test -e "${WORKDIR}/PACKAGES.tmp" -a "${I18N_STATS}" = 1 | ||
146 | then | ||
147 | echo "No translations for package [${PN}]" >> /tmp/oe-i18n-missing.log | ||
148 | else | ||
149 | echo "Using [$ts_found ] for package [${PN}]" >> /tmp/oe-i18n.log | ||
150 | fi | ||
151 | |||
152 | # While this might not be very elegant, it safes a _ton_ of space (~30Mb) for | ||
153 | # each opie package. | ||
154 | for file in $(ls */*.ts | egrep -v "`echo "$ts_found"| sed "s/^\ //;s/\ /\|/"`") | ||
155 | do | ||
156 | rm "$file" | ||
157 | done | ||
158 | |||
159 | return 0 | ||
160 | } | ||
161 | |||
162 | addtask build_opie_i18n before do_compile | ||
163 | addtask build_opie_i18n_data after do_build_opie_i18n before do_compile | ||
diff --git a/openembedded/classes/package.bbclass b/openembedded/classes/package.bbclass new file mode 100644 index 0000000000..90dfec9fa7 --- /dev/null +++ b/openembedded/classes/package.bbclass | |||
@@ -0,0 +1,596 @@ | |||
1 | def legitimize_package_name(s): | ||
2 | return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') | ||
3 | |||
4 | def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False): | ||
5 | import os, os.path, bb | ||
6 | |||
7 | dvar = bb.data.getVar('D', d, 1) | ||
8 | if not dvar: | ||
9 | bb.error("D not defined") | ||
10 | return | ||
11 | |||
12 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
13 | if not packages: | ||
14 | # nothing to do | ||
15 | return | ||
16 | |||
17 | if postinst: | ||
18 | postinst = '#!/bin/sh\n' + postinst + '\n' | ||
19 | if postrm: | ||
20 | postrm = '#!/bin/sh\n' + postrm + '\n' | ||
21 | if not recursive: | ||
22 | objs = os.listdir(dvar + root) | ||
23 | else: | ||
24 | objs = [] | ||
25 | for walkroot, dirs, files in os.walk(dvar + root): | ||
26 | for file in files: | ||
27 | relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1) | ||
28 | if relpath: | ||
29 | objs.append(relpath) | ||
30 | |||
31 | if extra_depends == None: | ||
32 | extra_depends = bb.data.getVar('PKG_' + packages[0], d, 1) or packages[0] | ||
33 | |||
34 | for o in objs: | ||
35 | import re, stat | ||
36 | if match_path: | ||
37 | m = re.match(file_regex, o) | ||
38 | else: | ||
39 | m = re.match(file_regex, os.path.basename(o)) | ||
40 | |||
41 | if not m: | ||
42 | continue | ||
43 | f = os.path.join(dvar + root, o) | ||
44 | mode = os.lstat(f).st_mode | ||
45 | if not (stat.S_ISREG(mode) or (allow_dirs and stat.S_ISDIR(mode))): | ||
46 | continue | ||
47 | on = legitimize_package_name(m.group(1)) | ||
48 | pkg = output_pattern % on | ||
49 | if not pkg in packages: | ||
50 | if prepend: | ||
51 | packages = [pkg] + packages | ||
52 | else: | ||
53 | packages.append(pkg) | ||
54 | the_files = [os.path.join(root, o)] | ||
55 | if aux_files_pattern: | ||
56 | if type(aux_files_pattern) is list: | ||
57 | for fp in aux_files_pattern: | ||
58 | the_files.append(fp % on) | ||
59 | else: | ||
60 | the_files.append(aux_files_pattern % on) | ||
61 | bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) | ||
62 | if extra_depends != '': | ||
63 | the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1) | ||
64 | if the_depends: | ||
65 | the_depends = '%s %s' % (the_depends, extra_depends) | ||
66 | else: | ||
67 | the_depends = extra_depends | ||
68 | bb.data.setVar('RDEPENDS_' + pkg, the_depends, d) | ||
69 | bb.data.setVar('DESCRIPTION_' + pkg, description % on, d) | ||
70 | if postinst: | ||
71 | bb.data.setVar('pkg_postinst_' + pkg, postinst, d) | ||
72 | if postrm: | ||
73 | bb.data.setVar('pkg_postrm_' + pkg, postrm, d) | ||
74 | else: | ||
75 | oldfiles = bb.data.getVar('FILES_' + pkg, d, 1) | ||
76 | if not oldfiles: | ||
77 | bb.fatal("Package '%s' exists but has no files" % pkg) | ||
78 | bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) | ||
79 | if callable(hook): | ||
80 | hook(f, pkg, file_regex, output_pattern, m.group(1)) | ||
81 | |||
82 | bb.data.setVar('PACKAGES', ' '.join(packages), d) | ||
83 | |||
84 | python populate_packages () { | ||
85 | import glob, stat, errno, re | ||
86 | |||
87 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
88 | if not workdir: | ||
89 | bb.error("WORKDIR not defined, unable to package") | ||
90 | return | ||
91 | |||
92 | import os # path manipulations | ||
93 | outdir = bb.data.getVar('DEPLOY_DIR', d, 1) | ||
94 | if not outdir: | ||
95 | bb.error("DEPLOY_DIR not defined, unable to package") | ||
96 | return | ||
97 | bb.mkdirhier(outdir) | ||
98 | |||
99 | dvar = bb.data.getVar('D', d, 1) | ||
100 | if not dvar: | ||
101 | bb.error("D not defined, unable to package") | ||
102 | return | ||
103 | bb.mkdirhier(dvar) | ||
104 | |||
105 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
106 | if not packages: | ||
107 | bb.debug(1, "PACKAGES not defined, nothing to package") | ||
108 | return | ||
109 | |||
110 | pn = bb.data.getVar('PN', d, 1) | ||
111 | if not pn: | ||
112 | bb.error("PN not defined") | ||
113 | return | ||
114 | |||
115 | os.chdir(dvar) | ||
116 | |||
117 | def isexec(path): | ||
118 | try: | ||
119 | s = os.stat(path) | ||
120 | except (os.error, AttributeError): | ||
121 | return 0 | ||
122 | return (s[stat.ST_MODE] & stat.S_IEXEC) | ||
123 | |||
124 | for pkg in packages.split(): | ||
125 | localdata = bb.data.createCopy(d) | ||
126 | root = os.path.join(workdir, "install", pkg) | ||
127 | |||
128 | os.system('rm -rf %s' % root) | ||
129 | |||
130 | bb.data.setVar('ROOT', '', localdata) | ||
131 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | ||
132 | pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) | ||
133 | if not pkgname: | ||
134 | pkgname = pkg | ||
135 | bb.data.setVar('PKG', pkgname, localdata) | ||
136 | |||
137 | overrides = bb.data.getVar('OVERRIDES', localdata, 1) | ||
138 | if not overrides: | ||
139 | raise bb.build.FuncFailed('OVERRIDES not defined') | ||
140 | bb.data.setVar('OVERRIDES', overrides+':'+pkg, localdata) | ||
141 | |||
142 | bb.data.update_data(localdata) | ||
143 | |||
144 | root = bb.data.getVar('ROOT', localdata, 1) | ||
145 | bb.mkdirhier(root) | ||
146 | filesvar = bb.data.getVar('FILES', localdata, 1) or "" | ||
147 | files = filesvar.split() | ||
148 | stripfunc = "" | ||
149 | for file in files: | ||
150 | if os.path.isabs(file): | ||
151 | file = '.' + file | ||
152 | if not os.path.islink(file): | ||
153 | if os.path.isdir(file): | ||
154 | newfiles = [ os.path.join(file,x) for x in os.listdir(file) ] | ||
155 | if newfiles: | ||
156 | files += newfiles | ||
157 | continue | ||
158 | globbed = glob.glob(file) | ||
159 | if globbed: | ||
160 | if [ file ] != globbed: | ||
161 | files += globbed | ||
162 | continue | ||
163 | if (not os.path.islink(file)) and (not os.path.exists(file)): | ||
164 | continue | ||
165 | fpath = os.path.join(root,file) | ||
166 | dpath = os.path.dirname(fpath) | ||
167 | bb.mkdirhier(dpath) | ||
168 | if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1') and not os.path.islink(file) and isexec(file): | ||
169 | stripfunc += "${STRIP} %s || : ;\n" % fpath | ||
170 | ret = bb.movefile(file,fpath) | ||
171 | if ret is None or ret == 0: | ||
172 | raise bb.build.FuncFailed("File population failed") | ||
173 | if not stripfunc == "": | ||
174 | from bb import build | ||
175 | # strip | ||
176 | bb.data.setVar('RUNSTRIP', '%s\nreturn 0' % stripfunc, localdata) | ||
177 | bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) | ||
178 | bb.build.exec_func('RUNSTRIP', localdata) | ||
179 | del localdata | ||
180 | os.chdir(workdir) | ||
181 | |||
182 | unshipped = [] | ||
183 | for root, dirs, files in os.walk(dvar): | ||
184 | for f in files: | ||
185 | path = os.path.join(root[len(dvar):], f) | ||
186 | unshipped.append(path) | ||
187 | |||
188 | if unshipped != []: | ||
189 | bb.note("the following files were installed but not shipped in any package:") | ||
190 | for f in unshipped: | ||
191 | bb.note(" " + f) | ||
192 | |||
193 | bb.build.exec_func("package_name_hook", d) | ||
194 | |||
195 | for pkg in packages.split(): | ||
196 | if bb.data.getVar('PKG_%s' % pkg, d, 1) is None: | ||
197 | bb.data.setVar('PKG_%s' % pkg, pkg, d) | ||
198 | |||
199 | dangling_links = {} | ||
200 | pkg_files = {} | ||
201 | for pkg in packages.split(): | ||
202 | dangling_links[pkg] = [] | ||
203 | pkg_files[pkg] = [] | ||
204 | inst_root = os.path.join(workdir, "install", pkg) | ||
205 | for root, dirs, files in os.walk(inst_root): | ||
206 | for f in files: | ||
207 | path = os.path.join(root, f) | ||
208 | rpath = path[len(inst_root):] | ||
209 | pkg_files[pkg].append(rpath) | ||
210 | try: | ||
211 | s = os.stat(path) | ||
212 | except OSError, (err, strerror): | ||
213 | if err != errno.ENOENT: | ||
214 | raise | ||
215 | target = os.readlink(path) | ||
216 | if target[0] != '/': | ||
217 | target = os.path.join(root[len(inst_root):], target) | ||
218 | dangling_links[pkg].append(os.path.normpath(target)) | ||
219 | |||
220 | for pkg in packages.split(): | ||
221 | rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") | ||
222 | for l in dangling_links[pkg]: | ||
223 | found = False | ||
224 | bb.debug(1, "%s contains dangling link %s" % (pkg, l)) | ||
225 | for p in packages.split(): | ||
226 | for f in pkg_files[p]: | ||
227 | if f == l: | ||
228 | found = True | ||
229 | bb.debug(1, "target found in %s" % p) | ||
230 | if p == pkg: | ||
231 | break | ||
232 | dp = bb.data.getVar('PKG_' + p, d, 1) or p | ||
233 | if not dp in rdepends: | ||
234 | rdepends.append(dp) | ||
235 | break | ||
236 | if found == False: | ||
237 | bb.note("%s contains dangling symlink to %s" % (pkg, l)) | ||
238 | bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) | ||
239 | |||
240 | def write_if_exists(f, pkg, var): | ||
241 | def encode(str): | ||
242 | import codecs | ||
243 | c = codecs.getencoder("string_escape") | ||
244 | return c(str)[0] | ||
245 | |||
246 | val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) | ||
247 | if val: | ||
248 | f.write('%s_%s: %s\n' % (var, pkg, encode(val))) | ||
249 | |||
250 | data_file = os.path.join(workdir, "install", pn + ".package") | ||
251 | f = open(data_file, 'w') | ||
252 | f.write("PACKAGES: %s\n" % packages) | ||
253 | for pkg in packages.split(): | ||
254 | write_if_exists(f, pkg, 'DESCRIPTION') | ||
255 | write_if_exists(f, pkg, 'RDEPENDS') | ||
256 | write_if_exists(f, pkg, 'RPROVIDES') | ||
257 | write_if_exists(f, pkg, 'PKG') | ||
258 | write_if_exists(f, pkg, 'ALLOW_EMPTY') | ||
259 | write_if_exists(f, pkg, 'FILES') | ||
260 | write_if_exists(f, pkg, 'pkg_postinst') | ||
261 | write_if_exists(f, pkg, 'pkg_postrm') | ||
262 | f.close() | ||
263 | bb.build.exec_func("read_subpackage_metadata", d) | ||
264 | } | ||
265 | |||
266 | ldconfig_postinst_fragment() { | ||
267 | if [ x"$D" = "x" ]; then | ||
268 | ldconfig | ||
269 | fi | ||
270 | } | ||
271 | |||
272 | python package_do_shlibs() { | ||
273 | import os, re, os.path | ||
274 | |||
275 | exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0) | ||
276 | if exclude_shlibs: | ||
277 | bb.note("not generating shlibs") | ||
278 | return | ||
279 | |||
280 | lib_re = re.compile("^lib.*\.so") | ||
281 | libdir_re = re.compile(".*/lib$") | ||
282 | |||
283 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
284 | if not packages: | ||
285 | bb.debug(1, "no packages to build; not calculating shlibs") | ||
286 | return | ||
287 | |||
288 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
289 | if not workdir: | ||
290 | bb.error("WORKDIR not defined") | ||
291 | return | ||
292 | |||
293 | staging = bb.data.getVar('STAGING_DIR', d, 1) | ||
294 | if not staging: | ||
295 | bb.error("STAGING_DIR not defined") | ||
296 | return | ||
297 | |||
298 | ver = bb.data.getVar('PV', d, 1) | ||
299 | if not ver: | ||
300 | bb.error("PV not defined") | ||
301 | return | ||
302 | |||
303 | target_sys = bb.data.getVar('TARGET_SYS', d, 1) | ||
304 | if not target_sys: | ||
305 | bb.error("TARGET_SYS not defined") | ||
306 | return | ||
307 | |||
308 | shlibs_dir = os.path.join(staging, target_sys, "shlibs") | ||
309 | old_shlibs_dir = os.path.join(staging, "shlibs") | ||
310 | bb.mkdirhier(shlibs_dir) | ||
311 | |||
312 | needed = {} | ||
313 | for pkg in packages.split(): | ||
314 | needs_ldconfig = False | ||
315 | bb.debug(2, "calculating shlib provides for %s" % pkg) | ||
316 | |||
317 | pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) | ||
318 | if not pkgname: | ||
319 | pkgname = pkg | ||
320 | |||
321 | needed[pkg] = [] | ||
322 | sonames = list() | ||
323 | top = os.path.join(workdir, "install", pkg) | ||
324 | for root, dirs, files in os.walk(top): | ||
325 | for file in files: | ||
326 | soname = None | ||
327 | path = os.path.join(root, file) | ||
328 | if os.access(path, os.X_OK) or lib_re.match(file): | ||
329 | cmd = (bb.data.getVar('BUILD_PREFIX', d, 1) or "") + "objdump -p " + path + " 2>/dev/null" | ||
330 | fd = os.popen(cmd) | ||
331 | lines = fd.readlines() | ||
332 | fd.close() | ||
333 | for l in lines: | ||
334 | m = re.match("\s+NEEDED\s+([^\s]*)", l) | ||
335 | if m: | ||
336 | needed[pkg].append(m.group(1)) | ||
337 | m = re.match("\s+SONAME\s+([^\s]*)", l) | ||
338 | if m and not m.group(1) in sonames: | ||
339 | sonames.append(m.group(1)) | ||
340 | if m and libdir_re.match(root): | ||
341 | needs_ldconfig = True | ||
342 | shlibs_file = os.path.join(shlibs_dir, pkgname + ".list") | ||
343 | if os.path.exists(shlibs_file): | ||
344 | os.remove(shlibs_file) | ||
345 | shver_file = os.path.join(shlibs_dir, pkgname + ".ver") | ||
346 | if os.path.exists(shver_file): | ||
347 | os.remove(shver_file) | ||
348 | if len(sonames): | ||
349 | fd = open(shlibs_file, 'w') | ||
350 | for s in sonames: | ||
351 | fd.write(s + '\n') | ||
352 | fd.close() | ||
353 | fd = open(shver_file, 'w') | ||
354 | fd.write(ver + '\n') | ||
355 | fd.close() | ||
356 | if needs_ldconfig: | ||
357 | bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) | ||
358 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
359 | if not postinst: | ||
360 | postinst = '#!/bin/sh\n' | ||
361 | postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) | ||
362 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
363 | |||
364 | shlib_provider = {} | ||
365 | list_re = re.compile('^(.*)\.list$') | ||
366 | for dir in [old_shlibs_dir, shlibs_dir]: | ||
367 | if not os.path.exists(dir): | ||
368 | continue | ||
369 | for file in os.listdir(dir): | ||
370 | m = list_re.match(file) | ||
371 | if m: | ||
372 | dep_pkg = m.group(1) | ||
373 | fd = open(os.path.join(dir, file)) | ||
374 | lines = fd.readlines() | ||
375 | fd.close() | ||
376 | ver_file = os.path.join(dir, dep_pkg + '.ver') | ||
377 | lib_ver = None | ||
378 | if os.path.exists(ver_file): | ||
379 | fd = open(ver_file) | ||
380 | lib_ver = fd.readline().rstrip() | ||
381 | fd.close() | ||
382 | for l in lines: | ||
383 | shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) | ||
384 | |||
385 | |||
386 | for pkg in packages.split(): | ||
387 | bb.debug(2, "calculating shlib requirements for %s" % pkg) | ||
388 | |||
389 | p_pkg = bb.data.getVar("PKG_%s" % pkg, d, 1) or pkg | ||
390 | |||
391 | deps = list() | ||
392 | for n in needed[pkg]: | ||
393 | if n in shlib_provider.keys(): | ||
394 | (dep_pkg, ver_needed) = shlib_provider[n] | ||
395 | |||
396 | if dep_pkg == p_pkg: | ||
397 | continue | ||
398 | |||
399 | if ver_needed: | ||
400 | dep = "%s (>= %s)" % (dep_pkg, ver_needed) | ||
401 | else: | ||
402 | dep = dep_pkg | ||
403 | if not dep in deps: | ||
404 | deps.append(dep) | ||
405 | else: | ||
406 | bb.note("Couldn't find shared library provider for %s" % n) | ||
407 | |||
408 | |||
409 | deps_file = os.path.join(workdir, "install", pkg + ".shlibdeps") | ||
410 | if os.path.exists(deps_file): | ||
411 | os.remove(deps_file) | ||
412 | if len(deps): | ||
413 | fd = open(deps_file, 'w') | ||
414 | for dep in deps: | ||
415 | fd.write(dep + '\n') | ||
416 | fd.close() | ||
417 | } | ||
418 | |||
419 | python package_do_pkgconfig () { | ||
420 | import re, os | ||
421 | |||
422 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
423 | if not packages: | ||
424 | bb.debug(1, "no packages to build; not calculating pkgconfig dependencies") | ||
425 | return | ||
426 | |||
427 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
428 | if not workdir: | ||
429 | bb.error("WORKDIR not defined") | ||
430 | return | ||
431 | |||
432 | staging = bb.data.getVar('STAGING_DIR', d, 1) | ||
433 | if not staging: | ||
434 | bb.error("STAGING_DIR not defined") | ||
435 | return | ||
436 | |||
437 | target_sys = bb.data.getVar('TARGET_SYS', d, 1) | ||
438 | if not target_sys: | ||
439 | bb.error("TARGET_SYS not defined") | ||
440 | return | ||
441 | |||
442 | shlibs_dir = os.path.join(staging, target_sys, "shlibs") | ||
443 | old_shlibs_dir = os.path.join(staging, "shlibs") | ||
444 | bb.mkdirhier(shlibs_dir) | ||
445 | |||
446 | pc_re = re.compile('(.*)\.pc$') | ||
447 | var_re = re.compile('(.*)=(.*)') | ||
448 | field_re = re.compile('(.*): (.*)') | ||
449 | |||
450 | pkgconfig_provided = {} | ||
451 | pkgconfig_needed = {} | ||
452 | for pkg in packages.split(): | ||
453 | pkgconfig_provided[pkg] = [] | ||
454 | pkgconfig_needed[pkg] = [] | ||
455 | top = os.path.join(workdir, "install", pkg) | ||
456 | for root, dirs, files in os.walk(top): | ||
457 | for file in files: | ||
458 | m = pc_re.match(file) | ||
459 | if m: | ||
460 | pd = bb.data.init() | ||
461 | name = m.group(1) | ||
462 | pkgconfig_provided[pkg].append(name) | ||
463 | path = os.path.join(root, file) | ||
464 | if not os.access(path, os.R_OK): | ||
465 | continue | ||
466 | f = open(path, 'r') | ||
467 | lines = f.readlines() | ||
468 | f.close() | ||
469 | for l in lines: | ||
470 | m = var_re.match(l) | ||
471 | if m: | ||
472 | name = m.group(1) | ||
473 | val = m.group(2) | ||
474 | bb.data.setVar(name, bb.data.expand(val, pd), pd) | ||
475 | continue | ||
476 | m = field_re.match(l) | ||
477 | if m: | ||
478 | hdr = m.group(1) | ||
479 | exp = bb.data.expand(m.group(2), pd) | ||
480 | if hdr == 'Requires': | ||
481 | pkgconfig_needed[pkg] += exp.replace(',', ' ').split() | ||
482 | |||
483 | for pkg in packages.split(): | ||
484 | ppkg = bb.data.getVar("PKG_" + pkg, d, 1) or pkg | ||
485 | pkgs_file = os.path.join(shlibs_dir, ppkg + ".pclist") | ||
486 | if os.path.exists(pkgs_file): | ||
487 | os.remove(pkgs_file) | ||
488 | if pkgconfig_provided[pkg] != []: | ||
489 | f = open(pkgs_file, 'w') | ||
490 | for p in pkgconfig_provided[pkg]: | ||
491 | f.write('%s\n' % p) | ||
492 | f.close() | ||
493 | |||
494 | for dir in [old_shlibs_dir, shlibs_dir]: | ||
495 | if not os.path.exists(dir): | ||
496 | continue | ||
497 | for file in os.listdir(dir): | ||
498 | m = re.match('^(.*)\.pclist$', file) | ||
499 | if m: | ||
500 | pkg = m.group(1) | ||
501 | fd = open(os.path.join(dir, file)) | ||
502 | lines = fd.readlines() | ||
503 | fd.close() | ||
504 | pkgconfig_provided[pkg] = [] | ||
505 | for l in lines: | ||
506 | pkgconfig_provided[pkg].append(l.rstrip()) | ||
507 | |||
508 | for pkg in packages.split(): | ||
509 | deps = [] | ||
510 | for n in pkgconfig_needed[pkg]: | ||
511 | found = False | ||
512 | for k in pkgconfig_provided.keys(): | ||
513 | if n in pkgconfig_provided[k]: | ||
514 | if k != pkg and not (k in deps): | ||
515 | deps.append(k) | ||
516 | found = True | ||
517 | if found == False: | ||
518 | bb.note("couldn't find pkgconfig module '%s' in any package" % n) | ||
519 | deps_file = os.path.join(workdir, "install", pkg + ".pcdeps") | ||
520 | if os.path.exists(deps_file): | ||
521 | os.remove(deps_file) | ||
522 | if len(deps): | ||
523 | fd = open(deps_file, 'w') | ||
524 | for dep in deps: | ||
525 | fd.write(dep + '\n') | ||
526 | fd.close() | ||
527 | } | ||
528 | |||
529 | python package_do_split_locales() { | ||
530 | import os | ||
531 | |||
532 | if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): | ||
533 | bb.debug(1, "package requested not splitting locales") | ||
534 | return | ||
535 | |||
536 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | ||
537 | if not packages: | ||
538 | bb.debug(1, "no packages to build; not splitting locales") | ||
539 | return | ||
540 | |||
541 | datadir = bb.data.getVar('datadir', d, 1) | ||
542 | if not datadir: | ||
543 | bb.note("datadir not defined") | ||
544 | return | ||
545 | |||
546 | dvar = bb.data.getVar('D', d, 1) | ||
547 | if not dvar: | ||
548 | bb.error("D not defined") | ||
549 | return | ||
550 | |||
551 | pn = bb.data.getVar('PN', d, 1) | ||
552 | if not pn: | ||
553 | bb.error("PN not defined") | ||
554 | return | ||
555 | |||
556 | if pn + '-locale' in packages: | ||
557 | packages.remove(pn + '-locale') | ||
558 | |||
559 | localedir = os.path.join(dvar + datadir, 'locale') | ||
560 | |||
561 | if not os.path.isdir(localedir): | ||
562 | bb.debug(1, "No locale files in this package") | ||
563 | return | ||
564 | |||
565 | locales = os.listdir(localedir) | ||
566 | |||
567 | mainpkg = packages[0] | ||
568 | |||
569 | for l in locales: | ||
570 | ln = legitimize_package_name(l) | ||
571 | pkg = pn + '-locale-' + ln | ||
572 | packages.append(pkg) | ||
573 | bb.data.setVar('FILES_' + pkg, os.path.join(datadir, 'locale', l), d) | ||
574 | bb.data.setVar('RDEPENDS_' + pkg, '${PKG_%s} virtual-locale-%s' % (mainpkg, ln), d) | ||
575 | bb.data.setVar('RPROVIDES_' + pkg, '%s-locale %s-translation' % (pn, ln), d) | ||
576 | bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d) | ||
577 | |||
578 | bb.data.setVar('PACKAGES', ' '.join(packages), d) | ||
579 | |||
580 | rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split() | ||
581 | rdep.append('%s-locale*' % pn) | ||
582 | bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d) | ||
583 | } | ||
584 | |||
585 | PACKAGEFUNCS = "do_install package_do_split_locales \ | ||
586 | populate_packages package_do_shlibs \ | ||
587 | package_do_pkgconfig read_shlibdeps" | ||
588 | python package_do_package () { | ||
589 | for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): | ||
590 | bb.build.exec_func(f, d) | ||
591 | } | ||
592 | |||
593 | do_package[dirs] = "${D}" | ||
594 | populate_packages[dirs] = "${D}" | ||
595 | EXPORT_FUNCTIONS do_package do_shlibs do_split_locales | ||
596 | addtask package before do_build after do_populate_staging | ||
diff --git a/openembedded/classes/package_ipk.bbclass b/openembedded/classes/package_ipk.bbclass new file mode 100644 index 0000000000..3c6125d9e3 --- /dev/null +++ b/openembedded/classes/package_ipk.bbclass | |||
@@ -0,0 +1,231 @@ | |||
1 | inherit package | ||
2 | DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" | ||
3 | BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" | ||
4 | BOOTSTRAP_EXTRA_DEPENDS += "ipkg-collateral ipkg ipkg-link" | ||
5 | PACKAGEFUNCS += "do_package_ipk" | ||
6 | |||
7 | python package_ipk_fn () { | ||
8 | from bb import data | ||
9 | bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) | ||
10 | } | ||
11 | |||
12 | python package_ipk_install () { | ||
13 | import os, sys | ||
14 | pkg = bb.data.getVar('PKG', d, 1) | ||
15 | pkgfn = bb.data.getVar('PKGFN', d, 1) | ||
16 | rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) | ||
17 | ipkdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1) | ||
18 | stagingdir = bb.data.getVar('STAGING_DIR', d, 1) | ||
19 | tmpdir = bb.data.getVar('TMPDIR', d, 1) | ||
20 | |||
21 | if None in (pkg,pkgfn,rootfs): | ||
22 | raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)") | ||
23 | try: | ||
24 | bb.mkdirhier(rootfs) | ||
25 | os.chdir(rootfs) | ||
26 | except OSError: | ||
27 | (type, value, traceback) = sys.exc_info() | ||
28 | print value | ||
29 | raise bb.build.FuncFailed | ||
30 | |||
31 | # Generate ipk.conf if it or the stamp doesnt exist | ||
32 | conffile = os.path.join(stagingdir,"ipkg.conf") | ||
33 | if not os.access(conffile, os.R_OK): | ||
34 | ipkg_archs = bb.data.getVar('IPKG_ARCHS',d) | ||
35 | if ipkg_archs is None: | ||
36 | bb.error("IPKG_ARCHS missing") | ||
37 | raise FuncFailed | ||
38 | ipkg_archs = ipkg_archs.split() | ||
39 | arch_priority = 1 | ||
40 | |||
41 | f = open(conffile,"w") | ||
42 | for arch in ipkg_archs: | ||
43 | f.write("arch %s %s\n" % ( arch, arch_priority )) | ||
44 | arch_priority += 1 | ||
45 | f.write("src local file:%s" % ipkdir) | ||
46 | f.close() | ||
47 | |||
48 | |||
49 | if (not os.access(os.path.join(ipkdir,"Packages"), os.R_OK) or | ||
50 | not os.access(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages"),os.R_OK)): | ||
51 | ret = os.system('ipkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir)) | ||
52 | if (ret != 0 ): | ||
53 | raise bb.build.FuncFailed | ||
54 | f=open(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages"),"w") | ||
55 | f.close() | ||
56 | |||
57 | ret = os.system('ipkg-cl -o %s -f %s update' % (rootfs, conffile)) | ||
58 | ret = os.system('ipkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn)) | ||
59 | if (ret != 0 ): | ||
60 | raise bb.build.FuncFailed | ||
61 | } | ||
62 | |||
63 | python do_package_ipk () { | ||
64 | import copy # to back up env data | ||
65 | import sys | ||
66 | import re | ||
67 | |||
68 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
69 | if not workdir: | ||
70 | bb.error("WORKDIR not defined, unable to package") | ||
71 | return | ||
72 | |||
73 | import os # path manipulations | ||
74 | outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1) | ||
75 | if not outdir: | ||
76 | bb.error("DEPLOY_DIR_IPK not defined, unable to package") | ||
77 | return | ||
78 | bb.mkdirhier(outdir) | ||
79 | |||
80 | dvar = bb.data.getVar('D', d, 1) | ||
81 | if not dvar: | ||
82 | bb.error("D not defined, unable to package") | ||
83 | return | ||
84 | bb.mkdirhier(dvar) | ||
85 | |||
86 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
87 | if not packages: | ||
88 | bb.debug(1, "PACKAGES not defined, nothing to package") | ||
89 | return | ||
90 | |||
91 | tmpdir = bb.data.getVar('TMPDIR', d, 1) | ||
92 | # Invalidate the packages file | ||
93 | if os.access(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages"),os.R_OK): | ||
94 | os.unlink(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages")) | ||
95 | |||
96 | if packages == []: | ||
97 | bb.debug(1, "No packages; nothing to do") | ||
98 | return | ||
99 | |||
100 | for pkg in packages.split(): | ||
101 | localdata = bb.data.createCopy(d) | ||
102 | root = "%s/install/%s" % (workdir, pkg) | ||
103 | |||
104 | bb.data.setVar('ROOT', '', localdata) | ||
105 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | ||
106 | pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) | ||
107 | if not pkgname: | ||
108 | pkgname = pkg | ||
109 | bb.data.setVar('PKG', pkgname, localdata) | ||
110 | |||
111 | overrides = bb.data.getVar('OVERRIDES', localdata) | ||
112 | if not overrides: | ||
113 | raise bb.build.FuncFailed('OVERRIDES not defined') | ||
114 | overrides = bb.data.expand(overrides, localdata) | ||
115 | bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) | ||
116 | |||
117 | bb.data.update_data(localdata) | ||
118 | basedir = os.path.join(os.path.dirname(root)) | ||
119 | pkgoutdir = outdir | ||
120 | bb.mkdirhier(pkgoutdir) | ||
121 | os.chdir(root) | ||
122 | from glob import glob | ||
123 | g = glob('*') | ||
124 | try: | ||
125 | del g[g.index('CONTROL')] | ||
126 | del g[g.index('./CONTROL')] | ||
127 | except ValueError: | ||
128 | pass | ||
129 | if not g and not bb.data.getVar('ALLOW_EMPTY', localdata): | ||
130 | from bb import note | ||
131 | note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) | ||
132 | continue | ||
133 | controldir = os.path.join(root, 'CONTROL') | ||
134 | bb.mkdirhier(controldir) | ||
135 | try: | ||
136 | ctrlfile = file(os.path.join(controldir, 'control'), 'w') | ||
137 | except OSError: | ||
138 | raise bb.build.FuncFailed("unable to open control file for writing.") | ||
139 | |||
140 | fields = [] | ||
141 | fields.append(["Version: %s-%s\n", ['PV', 'PR']]) | ||
142 | fields.append(["Description: %s\n", ['DESCRIPTION']]) | ||
143 | fields.append(["Section: %s\n", ['SECTION']]) | ||
144 | fields.append(["Priority: %s\n", ['PRIORITY']]) | ||
145 | fields.append(["Maintainer: %s\n", ['MAINTAINER']]) | ||
146 | fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']]) | ||
147 | fields.append(["OE: %s\n", ['P']]) | ||
148 | |||
149 | def pullData(l, d): | ||
150 | l2 = [] | ||
151 | for i in l: | ||
152 | l2.append(bb.data.getVar(i, d, 1)) | ||
153 | return l2 | ||
154 | |||
155 | ctrlfile.write("Package: %s\n" % pkgname) | ||
156 | # check for required fields | ||
157 | try: | ||
158 | for (c, fs) in fields: | ||
159 | for f in fs: | ||
160 | if bb.data.getVar(f, localdata) is None: | ||
161 | raise KeyError(f) | ||
162 | ctrlfile.write(c % tuple(pullData(fs, localdata))) | ||
163 | except KeyError: | ||
164 | (type, value, traceback) = sys.exc_info() | ||
165 | ctrlfile.close() | ||
166 | raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value) | ||
167 | # more fields | ||
168 | rdepends = explode_deps(bb.data.getVar("RDEPENDS", localdata, 1) or "") | ||
169 | rrecommends = explode_deps(bb.data.getVar("RRECOMMENDS", localdata, 1) or "") | ||
170 | rsuggests = (bb.data.getVar("RSUGGESTS", localdata, 1) or "").split() | ||
171 | rprovides = (bb.data.getVar("RPROVIDES", localdata, 1) or "").split() | ||
172 | rreplaces = (bb.data.getVar("RREPLACES", localdata, 1) or "").split() | ||
173 | rconflicts = (bb.data.getVar("RCONFLICTS", localdata, 1) or "").split() | ||
174 | if rdepends: | ||
175 | ctrlfile.write("Depends: %s\n" % ", ".join(rdepends)) | ||
176 | if rsuggests: | ||
177 | ctrlfile.write("Suggests: %s\n" % ", ".join(rsuggests)) | ||
178 | if rrecommends: | ||
179 | ctrlfile.write("Recommends: %s\n" % ", ".join(rrecommends)) | ||
180 | if rprovides: | ||
181 | ctrlfile.write("Provides: %s\n" % ", ".join(rprovides)) | ||
182 | if rreplaces: | ||
183 | ctrlfile.write("Replaces: %s\n" % ", ".join(rreplaces)) | ||
184 | if rconflicts: | ||
185 | ctrlfile.write("Conflicts: %s\n" % ", ".join(rconflicts)) | ||
186 | src_uri = bb.data.getVar("SRC_URI", localdata, 1) | ||
187 | if src_uri: | ||
188 | src_uri = re.sub("\s+", " ", src_uri) | ||
189 | ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) | ||
190 | ctrlfile.close() | ||
191 | |||
192 | for script in ["preinst", "postinst", "prerm", "postrm"]: | ||
193 | scriptvar = bb.data.getVar('pkg_%s' % script, localdata, 1) | ||
194 | if not scriptvar: | ||
195 | continue | ||
196 | try: | ||
197 | scriptfile = file(os.path.join(controldir, script), 'w') | ||
198 | except OSError: | ||
199 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) | ||
200 | scriptfile.write(scriptvar) | ||
201 | scriptfile.close() | ||
202 | os.chmod(os.path.join(controldir, script), 0755) | ||
203 | |||
204 | conffiles_str = bb.data.getVar("CONFFILES", localdata, 1) | ||
205 | if conffiles_str: | ||
206 | try: | ||
207 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') | ||
208 | except OSError: | ||
209 | raise bb.build.FuncFailed("unable to open conffiles for writing.") | ||
210 | for f in conffiles_str.split(): | ||
211 | conffiles.write('%s\n' % f) | ||
212 | conffiles.close() | ||
213 | |||
214 | os.chdir(basedir) | ||
215 | ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1), | ||
216 | bb.data.getVar("IPKGBUILDCMD",d,1), pkg, pkgoutdir)) | ||
217 | if ret != 0: | ||
218 | raise bb.build.FuncFailed("ipkg-build execution failed") | ||
219 | |||
220 | for script in ["preinst", "postinst", "prerm", "postrm", "control" ]: | ||
221 | scriptfile = os.path.join(controldir, script) | ||
222 | try: | ||
223 | os.remove(scriptfile) | ||
224 | except OSError: | ||
225 | pass | ||
226 | try: | ||
227 | os.rmdir(controldir) | ||
228 | except OSError: | ||
229 | pass | ||
230 | del localdata | ||
231 | } | ||
diff --git a/openembedded/classes/package_rpm.bbclass b/openembedded/classes/package_rpm.bbclass new file mode 100644 index 0000000000..c29ab5f423 --- /dev/null +++ b/openembedded/classes/package_rpm.bbclass | |||
@@ -0,0 +1,133 @@ | |||
1 | inherit package | ||
2 | inherit rpm_core | ||
3 | |||
4 | RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" | ||
5 | PACKAGEFUNCS += "do_package_rpm" | ||
6 | |||
7 | python write_specfile() { | ||
8 | from bb import data, build | ||
9 | import sys | ||
10 | out_vartranslate = { | ||
11 | "PKG": "Name", | ||
12 | "PV": "Version", | ||
13 | "PR": "Release", | ||
14 | "DESCRIPTION": "%description", | ||
15 | "ROOT": "BuildRoot", | ||
16 | "LICENSE": "License", | ||
17 | "SECTION": "Group", | ||
18 | } | ||
19 | |||
20 | root = bb.data.getVar('ROOT', d) | ||
21 | |||
22 | # get %files | ||
23 | filesvar = bb.data.expand(bb.data.getVar('FILES', d), d) or "" | ||
24 | from glob import glob | ||
25 | files = filesvar.split() | ||
26 | todelete = [] | ||
27 | for file in files: | ||
28 | if file[0] == '.': | ||
29 | newfile = file[1:] | ||
30 | files[files.index(file)] = newfile | ||
31 | file = newfile | ||
32 | else: | ||
33 | newfile = file | ||
34 | realfile = os.path.join(root, './'+file) | ||
35 | if not glob(realfile): | ||
36 | todelete.append(files[files.index(newfile)]) | ||
37 | for r in todelete: | ||
38 | try: | ||
39 | del files[files.index(r)] | ||
40 | except ValueError: | ||
41 | pass | ||
42 | if not files: | ||
43 | from bb import note | ||
44 | note("Not creating empty archive for %s-%s-%s" % (bb.data.getVar('PKG',d, 1), bb.data.getVar('PV', d, 1), bb.data.getVar('PR', d, 1))) | ||
45 | return | ||
46 | |||
47 | # output .spec using this metadata store | ||
48 | try: | ||
49 | from __builtin__ import file | ||
50 | if not bb.data.getVar('OUTSPECFILE', d): | ||
51 | raise OSError('eek!') | ||
52 | specfile = file(bb.data.getVar('OUTSPECFILE', d), 'w') | ||
53 | except OSError: | ||
54 | raise bb.build.FuncFailed("unable to open spec file for writing.") | ||
55 | |||
56 | # fd = sys.__stdout__ | ||
57 | fd = specfile | ||
58 | for var in out_vartranslate.keys(): | ||
59 | if out_vartranslate[var][0] == "%": | ||
60 | continue | ||
61 | fd.write("%s\t: %s\n" % (out_vartranslate[var], bb.data.getVar(var, d))) | ||
62 | fd.write("Summary\t: .\n") | ||
63 | |||
64 | for var in out_vartranslate.keys(): | ||
65 | if out_vartranslate[var][0] != "%": | ||
66 | continue | ||
67 | fd.write(out_vartranslate[var] + "\n") | ||
68 | fd.write(bb.data.getVar(var, d) + "\n\n") | ||
69 | |||
70 | fd.write("%files\n") | ||
71 | for file in files: | ||
72 | fd.write("%s\n" % file) | ||
73 | |||
74 | fd.close() | ||
75 | |||
76 | # call out rpm -bb on the .spec, thereby creating an rpm | ||
77 | |||
78 | bb.data.setVar('BUILDSPEC', "${RPMBUILD} -bb ${OUTSPECFILE}\n", d) | ||
79 | bb.data.setVarFlag('BUILDSPEC', 'func', '1', d) | ||
80 | bb.build.exec_func('BUILDSPEC', d) | ||
81 | |||
82 | # move the rpm into the pkgoutdir | ||
83 | rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) | ||
84 | outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) | ||
85 | bb.movefile(rpm, outrpm) | ||
86 | } | ||
87 | |||
88 | python do_package_rpm () { | ||
89 | workdir = bb.data.getVar('WORKDIR', d) | ||
90 | if not workdir: | ||
91 | raise bb.build.FuncFailed("WORKDIR not defined") | ||
92 | workdir = bb.data.expand(workdir, d) | ||
93 | |||
94 | import os # path manipulations | ||
95 | outdir = bb.data.getVar('DEPLOY_DIR_RPM', d) | ||
96 | if not outdir: | ||
97 | raise bb.build.FuncFailed("DEPLOY_DIR_RPM not defined") | ||
98 | outdir = bb.data.expand(outdir, d) | ||
99 | bb.mkdirhier(outdir) | ||
100 | |||
101 | packages = bb.data.getVar('PACKAGES', d) | ||
102 | if not packages: | ||
103 | packages = "${PN}" | ||
104 | bb.data.setVar('FILES', '', d) | ||
105 | ddir = bb.data.expand(bb.data.getVar('D', d), d) | ||
106 | bb.mkdirhier(ddir) | ||
107 | bb.data.setVar(bb.data.expand('FILES_${PN}', d), ''.join([ "./%s" % x for x in os.listdir(ddir)]), d) | ||
108 | packages = bb.data.expand(packages, d) | ||
109 | |||
110 | for pkg in packages.split(): | ||
111 | localdata = bb.data.createCopy(d) | ||
112 | root = "%s/install/%s" % (workdir, pkg) | ||
113 | |||
114 | bb.data.setVar('ROOT', '', localdata) | ||
115 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | ||
116 | bb.data.setVar('PKG', pkg, localdata) | ||
117 | |||
118 | overrides = bb.data.getVar('OVERRIDES', localdata) | ||
119 | if not overrides: | ||
120 | raise bb.build.FuncFailed('OVERRIDES not defined') | ||
121 | overrides = bb.data.expand(overrides, localdata) | ||
122 | bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) | ||
123 | |||
124 | bb.data.update_data(localdata) | ||
125 | # stuff | ||
126 | root = bb.data.getVar('ROOT', localdata) | ||
127 | basedir = os.path.dirname(root) | ||
128 | pkgoutdir = outdir | ||
129 | bb.mkdirhier(pkgoutdir) | ||
130 | bb.data.setVar('OUTSPECFILE', os.path.join(workdir, "%s.spec" % pkg), localdata) | ||
131 | bb.build.exec_func('write_specfile', localdata) | ||
132 | del localdata | ||
133 | } | ||
diff --git a/openembedded/classes/package_tar.bbclass b/openembedded/classes/package_tar.bbclass new file mode 100644 index 0000000000..359e35f113 --- /dev/null +++ b/openembedded/classes/package_tar.bbclass | |||
@@ -0,0 +1,99 @@ | |||
1 | inherit package | ||
2 | |||
3 | PACKAGEFUNCS += "do_package_tar" | ||
4 | |||
5 | python package_tar_fn () { | ||
6 | import os | ||
7 | from bb import data | ||
8 | fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PV', d), bb.data.getVar('PR', d))) | ||
9 | fn = bb.data.expand(fn, d) | ||
10 | bb.data.setVar('PKGFN', fn, d) | ||
11 | } | ||
12 | |||
13 | python package_tar_install () { | ||
14 | import os, sys | ||
15 | pkg = bb.data.getVar('PKG', d, 1) | ||
16 | pkgfn = bb.data.getVar('PKGFN', d, 1) | ||
17 | rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) | ||
18 | |||
19 | if None in (pkg,pkgfn,rootfs): | ||
20 | bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)") | ||
21 | raise bb.build.FuncFailed | ||
22 | try: | ||
23 | bb.mkdirhier(rootfs) | ||
24 | os.chdir(rootfs) | ||
25 | except OSError: | ||
26 | (type, value, traceback) = sys.exc_info() | ||
27 | print value | ||
28 | raise bb.build.FuncFailed | ||
29 | |||
30 | if not os.access(pkgfn, os.R_OK): | ||
31 | bb.debug(1, "%s does not exist, skipping" % pkgfn) | ||
32 | raise bb.build.FuncFailed | ||
33 | |||
34 | ret = os.system('zcat %s | tar -xf -' % pkgfn) | ||
35 | if ret != 0: | ||
36 | raise bb.build.FuncFailed | ||
37 | } | ||
38 | |||
39 | python do_package_tar () { | ||
40 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
41 | if not workdir: | ||
42 | bb.error("WORKDIR not defined, unable to package") | ||
43 | return | ||
44 | |||
45 | import os # path manipulations | ||
46 | outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1) | ||
47 | if not outdir: | ||
48 | bb.error("DEPLOY_DIR_TAR not defined, unable to package") | ||
49 | return | ||
50 | bb.mkdirhier(outdir) | ||
51 | |||
52 | dvar = bb.data.getVar('D', d, 1) | ||
53 | if not dvar: | ||
54 | bb.error("D not defined, unable to package") | ||
55 | return | ||
56 | bb.mkdirhier(dvar) | ||
57 | |||
58 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
59 | if not packages: | ||
60 | bb.debug(1, "PACKAGES not defined, nothing to package") | ||
61 | return | ||
62 | |||
63 | for pkg in packages.split(): | ||
64 | localdata = bb.data.createCopy(d) | ||
65 | root = "%s/install/%s" % (workdir, pkg) | ||
66 | |||
67 | bb.data.setVar('ROOT', '', localdata) | ||
68 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | ||
69 | bb.data.setVar('PKG', pkg, localdata) | ||
70 | |||
71 | overrides = bb.data.getVar('OVERRIDES', localdata) | ||
72 | if not overrides: | ||
73 | raise bb.build.FuncFailed('OVERRIDES not defined') | ||
74 | overrides = bb.data.expand(overrides, localdata) | ||
75 | bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) | ||
76 | |||
77 | bb.data.update_data(localdata) | ||
78 | # stuff | ||
79 | root = bb.data.getVar('ROOT', localdata) | ||
80 | bb.mkdirhier(root) | ||
81 | basedir = os.path.dirname(root) | ||
82 | pkgoutdir = outdir | ||
83 | bb.mkdirhier(pkgoutdir) | ||
84 | bb.build.exec_func('package_tar_fn', localdata) | ||
85 | tarfn = bb.data.getVar('PKGFN', localdata, 1) | ||
86 | # if os.path.exists(tarfn): | ||
87 | # del localdata | ||
88 | # continue | ||
89 | os.chdir(root) | ||
90 | from glob import glob | ||
91 | if not glob('*'): | ||
92 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) | ||
93 | continue | ||
94 | ret = os.system("tar -czvf %s %s" % (tarfn, '.')) | ||
95 | if ret != 0: | ||
96 | bb.error("Creation of tar %s failed." % tarfn) | ||
97 | # end stuff | ||
98 | del localdata | ||
99 | } | ||
diff --git a/openembedded/classes/palmtop.bbclass b/openembedded/classes/palmtop.bbclass new file mode 100644 index 0000000000..523c3d71bb --- /dev/null +++ b/openembedded/classes/palmtop.bbclass | |||
@@ -0,0 +1,10 @@ | |||
1 | # basically a placeholder for something more fancy | ||
2 | # for now, just declare some things | ||
3 | |||
4 | inherit qmake | ||
5 | |||
6 | EXTRA_QMAKEVARS_POST_append = " DEFINES+=QWS LIBS+=-lqpe CONFIG+=qt LIBS-=-lstdc++ LIBS+=-lsupc++" | ||
7 | |||
8 | DEPENDS_prepend = "virtual/libqpe uicmoc-native " | ||
9 | |||
10 | FILES_${PN} = "${palmtopdir}" | ||
diff --git a/openembedded/classes/patcher.bbclass b/openembedded/classes/patcher.bbclass new file mode 100644 index 0000000000..c8a1b0350f --- /dev/null +++ b/openembedded/classes/patcher.bbclass | |||
@@ -0,0 +1,7 @@ | |||
1 | # Now that BitBake/OpenEmbedded uses Quilt by default, you can simply add an | ||
2 | # inherit patcher | ||
3 | # to one of your config files to let BB/OE use patcher again. | ||
4 | |||
5 | PATCHCLEANCMD = "patcher -B" | ||
6 | PATCHCMD = "patcher -R -p '%s' -n '%s' -i '%s'" | ||
7 | PATCH_DEPENDS = "${@["patcher-native", ""][(bb.data.getVar('PN', d, 1) == 'patcher-native')]}" | ||
diff --git a/openembedded/classes/pkg_distribute.bbclass b/openembedded/classes/pkg_distribute.bbclass new file mode 100644 index 0000000000..81978e3e3b --- /dev/null +++ b/openembedded/classes/pkg_distribute.bbclass | |||
@@ -0,0 +1,29 @@ | |||
1 | PKG_DISTRIBUTECOMMAND[func] = "1" | ||
2 | python do_distribute_packages () { | ||
3 | cmd = bb.data.getVar('PKG_DISTRIBUTECOMMAND', d, 1) | ||
4 | if not cmd: | ||
5 | raise bb.build.FuncFailed("Unable to distribute packages, PKG_DISTRIBUTECOMMAND not defined") | ||
6 | bb.build.exec_func('PKG_DISTRIBUTECOMMAND', d) | ||
7 | } | ||
8 | |||
9 | addtask distribute_packages before do_build after do_fetch | ||
10 | |||
11 | PKG_DIST_LOCAL ?= "symlink" | ||
12 | PKG_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/packages" | ||
13 | |||
14 | PKG_DISTRIBUTECOMMAND () { | ||
15 | p=`dirname ${FILE}` | ||
16 | d=`basename $p` | ||
17 | mkdir -p ${PKG_DISTRIBUTEDIR} | ||
18 | case "${PKG_DIST_LOCAL}" in | ||
19 | copy) | ||
20 | # use this weird tar command to copy because we want to | ||
21 | # exclude the BitKeeper directories | ||
22 | test -e ${PKG_DISTRIBUTEDIR}/${d} || mkdir ${PKG_DISTRIBUTEDIR}/${d}; | ||
23 | (cd ${p}; tar -c --exclude SCCS -f - . ) | tar -C ${PKG_DISTRIBUTEDIR}/${d} -xpf - | ||
24 | ;; | ||
25 | symlink) | ||
26 | ln -sf $p ${PKG_DISTRIBUTEDIR}/ | ||
27 | ;; | ||
28 | esac | ||
29 | } | ||
diff --git a/openembedded/classes/pkg_metainfo.bbclass b/openembedded/classes/pkg_metainfo.bbclass new file mode 100644 index 0000000000..ac4f73c77b --- /dev/null +++ b/openembedded/classes/pkg_metainfo.bbclass | |||
@@ -0,0 +1,22 @@ | |||
1 | python do_pkg_write_metainfo () { | ||
2 | deploydir = bb.data.getVar('DEPLOY_DIR', d, 1) | ||
3 | if not deploydir: | ||
4 | bb.error("DEPLOY_DIR not defined, unable to write package info") | ||
5 | return | ||
6 | |||
7 | try: | ||
8 | infofile = file(os.path.join(deploydir, 'package-metainfo'), 'a') | ||
9 | except OSError: | ||
10 | raise bb.build.FuncFailed("unable to open package-info file for writing.") | ||
11 | |||
12 | name = bb.data.getVar('PN', d, 1) | ||
13 | version = bb.data.getVar('PV', d, 1) | ||
14 | desc = bb.data.getVar('DESCRIPTION', d, 1) | ||
15 | page = bb.data.getVar('HOMEPAGE', d, 1) | ||
16 | lic = bb.data.getVar('LICENSE', d, 1) | ||
17 | |||
18 | infofile.write("|| "+ name +" || "+ version + " || "+ desc +" || "+ page +" || "+ lic + " ||\n" ) | ||
19 | infofile.close() | ||
20 | } | ||
21 | |||
22 | addtask pkg_write_metainfo after do_package before do_build \ No newline at end of file | ||
diff --git a/openembedded/classes/pkgconfig.bbclass b/openembedded/classes/pkgconfig.bbclass new file mode 100644 index 0000000000..e89e827fc8 --- /dev/null +++ b/openembedded/classes/pkgconfig.bbclass | |||
@@ -0,0 +1,28 @@ | |||
1 | inherit base | ||
2 | |||
3 | DEPENDS_prepend = "pkgconfig-native " | ||
4 | |||
5 | # The namespaces can clash here hence the two step replace | ||
6 | def get_pkgconfig_mangle(d): | ||
7 | import bb.data | ||
8 | s = "-e ''" | ||
9 | if not bb.data.inherits_class('native', d): | ||
10 | s += " -e 's:=${libdir}:=OELIBDIR:;'" | ||
11 | s += " -e 's:=${includedir}:=OEINCDIR:;'" | ||
12 | s += " -e 's:=${datadir}:=OEDATADIR:'" | ||
13 | s += " -e 's:=${prefix}:=OEPREFIX:'" | ||
14 | s += " -e 's:=${exec_prefix}:=OEEXECPREFIX:'" | ||
15 | s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'" | ||
16 | s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'" | ||
17 | s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" | ||
18 | s += " -e 's:OEPREFIX:${STAGING_LIBDIR}/..:'" | ||
19 | s += " -e 's:OEEXECPREFIX:${STAGING_LIBDIR}/..:'" | ||
20 | return s | ||
21 | |||
22 | do_stage_append () { | ||
23 | for pc in `find ${S} -name '*.pc'`; do | ||
24 | pcname=`basename $pc` | ||
25 | install -d ${PKG_CONFIG_PATH} | ||
26 | cat $pc | sed ${@get_pkgconfig_mangle(d)} > ${PKG_CONFIG_PATH}/$pcname | ||
27 | done | ||
28 | } | ||
diff --git a/openembedded/classes/qmake-base.bbclass b/openembedded/classes/qmake-base.bbclass new file mode 100644 index 0000000000..4a360dae43 --- /dev/null +++ b/openembedded/classes/qmake-base.bbclass | |||
@@ -0,0 +1,42 @@ | |||
1 | DEPENDS_prepend = "qmake-native " | ||
2 | |||
3 | OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++" | ||
4 | QMAKESPEC := "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}" | ||
5 | |||
6 | # We override this completely to eliminate the -e normally passed in | ||
7 | EXTRA_OEMAKE = ' MAKEFLAGS= ' | ||
8 | |||
9 | export OE_QMAKE_CC="${CC}" | ||
10 | export OE_QMAKE_CFLAGS="${CFLAGS}" | ||
11 | export OE_QMAKE_CXX="${CXX}" | ||
12 | export OE_QMAKE_CXXFLAGS="-fno-exceptions -fno-rtti ${CXXFLAGS}" | ||
13 | export OE_QMAKE_LDFLAGS="${LDFLAGS}" | ||
14 | export OE_QMAKE_LINK="${CCLD}" | ||
15 | export OE_QMAKE_AR="${AR}" | ||
16 | export OE_QMAKE_STRIP="${STRIP}" | ||
17 | export OE_QMAKE_UIC="${STAGING_BINDIR}/uic" | ||
18 | export OE_QMAKE_MOC="${STAGING_BINDIR}/moc" | ||
19 | export OE_QMAKE_RPATH="-Wl,-rpath-link," | ||
20 | |||
21 | # default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 | ||
22 | export OE_QMAKE_INCDIR_QT="${QTDIR}/include" | ||
23 | export OE_QMAKE_LIBDIR_QT="${QTDIR}/lib" | ||
24 | export OE_QMAKE_LIBS_QT="qte" | ||
25 | export OE_QMAKE_LIBS_X11="" | ||
26 | |||
27 | oe_qmake_mkspecs () { | ||
28 | mkdir -p mkspecs/${OE_QMAKE_PLATFORM} | ||
29 | for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do | ||
30 | if [ -L $f ]; then | ||
31 | lnk=`readlink $f` | ||
32 | if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then | ||
33 | ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f` | ||
34 | else | ||
35 | cp $f mkspecs/${OE_QMAKE_PLATFORM}/ | ||
36 | fi | ||
37 | else | ||
38 | cp $f mkspecs/${OE_QMAKE_PLATFORM}/ | ||
39 | fi | ||
40 | done | ||
41 | } | ||
42 | |||
diff --git a/openembedded/classes/qmake.bbclass b/openembedded/classes/qmake.bbclass new file mode 100644 index 0000000000..10aa8c9f7d --- /dev/null +++ b/openembedded/classes/qmake.bbclass | |||
@@ -0,0 +1,57 @@ | |||
1 | inherit qmake-base | ||
2 | |||
3 | qmake_do_configure() { | ||
4 | case ${QMAKESPEC} in | ||
5 | *linux-oe-g++|*linux-uclibc-oe-g++) | ||
6 | ;; | ||
7 | *-oe-g++) | ||
8 | die Unsupported target ${TARGET_OS} for oe-g++ qmake spec | ||
9 | ;; | ||
10 | *) | ||
11 | oenote Searching for qmake spec file | ||
12 | paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-${TARGET_ARCH}-g++" | ||
13 | paths="${QMAKE_MKSPEC_PATH}/${TARGET_OS}-g++ $paths" | ||
14 | |||
15 | if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then | ||
16 | paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-x86-g++ $paths" | ||
17 | fi | ||
18 | for i in $paths; do | ||
19 | if test -e $i; then | ||
20 | export QMAKESPEC=$i | ||
21 | break | ||
22 | fi | ||
23 | done | ||
24 | ;; | ||
25 | esac | ||
26 | |||
27 | oenote "using qmake spec in ${QMAKESPEC}, using profiles '${QMAKE_PROFILES}'" | ||
28 | |||
29 | if [ -z "${QMAKE_PROFILES}" ]; then | ||
30 | PROFILES="`ls *.pro`" | ||
31 | else | ||
32 | PROFILES="${QMAKE_PROFILES}" | ||
33 | fi | ||
34 | |||
35 | if [ -z "$PROFILES" ]; then | ||
36 | die "QMAKE_PROFILES not set and no profiles found in $PWD" | ||
37 | fi | ||
38 | |||
39 | if [ ! -z "${EXTRA_QMAKEVARS_POST}" ]; then | ||
40 | AFTER="-after" | ||
41 | QMAKE_VARSUBST_POST="${EXTRA_QMAKEVARS_POST}" | ||
42 | oenote "qmake postvar substitution: ${EXTRA_QMAKEVARS_POST}" | ||
43 | fi | ||
44 | |||
45 | if [ ! -z "${EXTRA_QMAKEVARS_PRE}" ]; then | ||
46 | QMAKE_VARSUBST_PRE="${EXTRA_QMAKEVARS_PRE}" | ||
47 | oenote "qmake prevar substitution: ${EXTRA_QMAKEVARS_PRE}" | ||
48 | fi | ||
49 | |||
50 | #oenote "Calling 'qmake -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST'" | ||
51 | unset QMAKESPEC || true | ||
52 | qmake -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST || die "Error calling qmake on $PROFILES" | ||
53 | } | ||
54 | |||
55 | EXPORT_FUNCTIONS do_configure | ||
56 | |||
57 | addtask configure after do_unpack do_patch before do_compile | ||
diff --git a/openembedded/classes/qpf.bbclass b/openembedded/classes/qpf.bbclass new file mode 100644 index 0000000000..d6e58871d5 --- /dev/null +++ b/openembedded/classes/qpf.bbclass | |||
@@ -0,0 +1,36 @@ | |||
1 | PACKAGE_ARCH = "all" | ||
2 | |||
3 | do_configure() { | ||
4 | : | ||
5 | } | ||
6 | |||
7 | do_compile() { | ||
8 | : | ||
9 | } | ||
10 | |||
11 | pkg_postinst_fonts() { | ||
12 | #!/bin/sh | ||
13 | set -e | ||
14 | . /etc/profile | ||
15 | ${sbindir}/update-qtfontdir | ||
16 | } | ||
17 | |||
18 | pkg_postrm_fonts() { | ||
19 | #!/bin/sh | ||
20 | set -e | ||
21 | . /etc/profile | ||
22 | ${sbindir}/update-qtfontdir -f | ||
23 | } | ||
24 | |||
25 | python populate_packages_prepend() { | ||
26 | postinst = bb.data.getVar('pkg_postinst_fonts', d, 1) | ||
27 | postrm = bb.data.getVar('pkg_postrm_fonts', d, 1) | ||
28 | fontdir = bb.data.getVar('palmtopdir', d, 1) + '/lib/fonts' | ||
29 | pkgregex = "^([a-z-]*_[0-9]*).*.qpf$" | ||
30 | pkgpattern = bb.data.getVar('QPF_PKGPATTERN', d, 1) or 'qpf-%s' | ||
31 | pkgdescription = bb.data.getVar('QPF_DESCRIPTION', d, 1) or 'QPF font %s' | ||
32 | |||
33 | do_split_packages(d, root=fontdir, file_regex=pkgregex, output_pattern=pkgpattern, | ||
34 | description=pkgdescription, postinst=postinst, postrm=postrm, recursive=True, hook=None, | ||
35 | extra_depends='qpf-font-common') | ||
36 | } | ||
diff --git a/openembedded/classes/qt3e.bbclass b/openembedded/classes/qt3e.bbclass new file mode 100644 index 0000000000..c34d7c04f5 --- /dev/null +++ b/openembedded/classes/qt3e.bbclass | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # override variables set by qmake-base to compile Qt/X11 apps | ||
3 | # | ||
4 | export QTDIR="${STAGING_DIR}/${HOST_SYS}/qte3" | ||
5 | export QTEDIR="${STAGING_DIR}/${HOST_SYS}/qte3" | ||
6 | export OE_QMAKE_UIC="${STAGING_BINDIR}/uic3" | ||
7 | export OE_QMAKE_MOC="${STAGING_BINDIR}/moc3" | ||
8 | export OE_QMAKE_CXXFLAGS="${CXXFLAGS} " | ||
9 | export OE_QMAKE_INCDIR_QT="${QTEDIR}/include" | ||
10 | export OE_QMAKE_LIBDIR_QT="${QTEDIR}/lib" | ||
11 | export OE_QMAKE_LIBS_QT="qte" | ||
diff --git a/openembedded/classes/qt3x11.bbclass b/openembedded/classes/qt3x11.bbclass new file mode 100644 index 0000000000..09b9cbac96 --- /dev/null +++ b/openembedded/classes/qt3x11.bbclass | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # override variables set by qmake-base to compile Qt/X11 apps | ||
3 | # | ||
4 | export QTDIR="${STAGING_DIR}/${HOST_SYS}/qt3" | ||
5 | export OE_QMAKE_UIC="${STAGING_BINDIR}/uic3" | ||
6 | export OE_QMAKE_MOC="${STAGING_BINDIR}/moc3" | ||
7 | export OE_QMAKE_CXXFLAGS="${CXXFLAGS} -DQT_NO_XIM" | ||
8 | export OE_QMAKE_INCDIR_QT="${QTDIR}/include" | ||
9 | export OE_QMAKE_LIBDIR_QT="${QTDIR}/lib" | ||
10 | export OE_QMAKE_LIBS_QT="qt" | ||
11 | export OE_QMAKE_LIBS_X11="-lXext -lX11 -lm" | ||
diff --git a/openembedded/classes/qt4x11.bbclass b/openembedded/classes/qt4x11.bbclass new file mode 100644 index 0000000000..d4ca0073df --- /dev/null +++ b/openembedded/classes/qt4x11.bbclass | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # override variables set by qmake-base to compile Qt/X11 apps | ||
3 | # | ||
4 | export QTDIR="${STAGING_DIR}/${HOST_SYS}/qt4" | ||
5 | export OE_QMAKE_UIC="${STAGING_BINDIR}/uic4" | ||
6 | export OE_QMAKE_MOC="${STAGING_BINDIR}/moc4" | ||
7 | export OE_QMAKE_CXXFLAGS="${CXXFLAGS}" | ||
8 | export OE_QMAKE_INCDIR_QT="${QTDIR}/include" | ||
9 | export OE_QMAKE_LIBDIR_QT="${QTDIR}/lib" | ||
10 | export OE_QMAKE_LIBS_QT="qt" | ||
11 | export OE_QMAKE_LIBS_X11="-lXext -lX11 -lm" | ||
diff --git a/openembedded/classes/rm_work.bbclass b/openembedded/classes/rm_work.bbclass new file mode 100644 index 0000000000..340446917e --- /dev/null +++ b/openembedded/classes/rm_work.bbclass | |||
@@ -0,0 +1,22 @@ | |||
1 | # | ||
2 | # Removes source after build | ||
3 | # | ||
4 | # To use it add that line to conf/local.conf: | ||
5 | # | ||
6 | # INHERIT += "rm_work" | ||
7 | # | ||
8 | |||
9 | do_rm_work () { | ||
10 | cd ${WORKDIR} | ||
11 | for dir in * | ||
12 | do | ||
13 | if [ `basename ${S}` == $dir ]; then | ||
14 | rm -rf $dir/* | ||
15 | elif [ $dir != 'temp' ]; then | ||
16 | rm -rf $dir | ||
17 | fi | ||
18 | done | ||
19 | } | ||
20 | |||
21 | addtask rm_work before do_build | ||
22 | addtask rm_work after do_package | ||
diff --git a/openembedded/classes/rootfs_ipk.bbclass b/openembedded/classes/rootfs_ipk.bbclass new file mode 100644 index 0000000000..062c957359 --- /dev/null +++ b/openembedded/classes/rootfs_ipk.bbclass | |||
@@ -0,0 +1,136 @@ | |||
1 | # | ||
2 | # Creates a root filesystem out of IPKs | ||
3 | # | ||
4 | # This rootfs can be mounted via root-nfs or it can be put into an cramfs/jffs etc. | ||
5 | # See image_ipk.oeclass for a usage of this. | ||
6 | # | ||
7 | |||
8 | DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native " | ||
9 | DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}" | ||
10 | |||
11 | PACKAGES = "" | ||
12 | |||
13 | do_rootfs[nostamp] = 1 | ||
14 | do_rootfs[dirs] = ${TOPDIR} | ||
15 | do_build[nostamp] = 1 | ||
16 | |||
17 | IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}" | ||
18 | |||
19 | ROOTFS_POSTPROCESS_COMMAND ?= "" | ||
20 | |||
21 | PID = "${@os.getpid()}" | ||
22 | |||
23 | # some default locales | ||
24 | IMAGE_LINGUAS ?= "de-de fr-fr en-gb" | ||
25 | |||
26 | LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" | ||
27 | |||
28 | real_do_rootfs () { | ||
29 | set -x | ||
30 | |||
31 | mkdir -p ${IMAGE_ROOTFS}/dev | ||
32 | |||
33 | if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then | ||
34 | rm -f ${DEPLOY_DIR_IPK}/Packages | ||
35 | touch ${DEPLOY_DIR_IPK}/Packages | ||
36 | ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK} | ||
37 | fi | ||
38 | mkdir -p ${T} | ||
39 | echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf | ||
40 | ipkgarchs="all any noarch ${TARGET_ARCH} ${IPKG_ARCHS} ${MACHINE}" | ||
41 | priority=1 | ||
42 | for arch in $ipkgarchs; do | ||
43 | echo "arch $arch $priority" >> ${T}/ipkg.conf | ||
44 | priority=$(expr $priority + 5) | ||
45 | done | ||
46 | ipkg-cl ${IPKG_ARGS} update | ||
47 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
48 | ipkg-cl ${IPKG_ARGS} install glibc-localedata-i18n | ||
49 | for i in ${LINGUAS_INSTALL}; do | ||
50 | ipkg-cl ${IPKG_ARGS} install $i | ||
51 | done | ||
52 | fi | ||
53 | if [ ! -z "${IPKG_INSTALL}" ]; then | ||
54 | ipkg-cl ${IPKG_ARGS} install ${IPKG_INSTALL} | ||
55 | fi | ||
56 | |||
57 | export D=${IMAGE_ROOTFS} | ||
58 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
59 | mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/ | ||
60 | grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf | ||
61 | |||
62 | for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.preinst; do | ||
63 | if [ -f $i ] && ! sh $i; then | ||
64 | ipkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst` | ||
65 | fi | ||
66 | done | ||
67 | for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.postinst; do | ||
68 | if [ -f $i ] && ! sh $i configure; then | ||
69 | ipkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst` | ||
70 | fi | ||
71 | done | ||
72 | |||
73 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
74 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
75 | |||
76 | ${ROOTFS_POSTPROCESS_COMMAND} | ||
77 | |||
78 | log_check rootfs | ||
79 | } | ||
80 | |||
81 | log_check() { | ||
82 | set +x | ||
83 | for target in $* | ||
84 | do | ||
85 | lf_path="${WORKDIR}/temp/log.do_$target.${PID}" | ||
86 | |||
87 | echo "log_check: Using $lf_path as logfile" | ||
88 | |||
89 | if test -e "$lf_path" | ||
90 | then | ||
91 | lf_txt="`cat $lf_path`" | ||
92 | |||
93 | for keyword_die in "Cannot find package" "exit 1" ERR Fail | ||
94 | do | ||
95 | |||
96 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") &>/dev/null | ||
97 | then | ||
98 | echo "log_check: There were error messages in the logfile" | ||
99 | echo -e "log_check: Matched keyword: [$keyword_die]\n" | ||
100 | echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" | ||
101 | echo "" | ||
102 | do_exit=1 | ||
103 | fi | ||
104 | done | ||
105 | test "$do_exit" = 1 && exit 1 | ||
106 | else | ||
107 | echo "Cannot find logfile [$lf_path]" | ||
108 | fi | ||
109 | echo "Logfile is clean" | ||
110 | done | ||
111 | |||
112 | set -x | ||
113 | |||
114 | } | ||
115 | |||
116 | fakeroot do_rootfs () { | ||
117 | rm -rf ${IMAGE_ROOTFS} | ||
118 | real_do_rootfs | ||
119 | } | ||
120 | |||
121 | # set '*' as the rootpassword so the images | ||
122 | # can decide if they want it or not | ||
123 | |||
124 | zap_root_password () { | ||
125 | sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new | ||
126 | mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd | ||
127 | } | ||
128 | |||
129 | create_etc_timestamp() { | ||
130 | date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp | ||
131 | } | ||
132 | |||
133 | # export the zap_root_password and create_etc_timestamp | ||
134 | EXPORT_FUNCTIONS zap_root_password create_etc_timestamp | ||
135 | |||
136 | addtask rootfs before do_build after do_install | ||
diff --git a/openembedded/classes/rpm_core.bbclass b/openembedded/classes/rpm_core.bbclass new file mode 100644 index 0000000000..f28abbb1c3 --- /dev/null +++ b/openembedded/classes/rpm_core.bbclass | |||
@@ -0,0 +1,16 @@ | |||
1 | RPMBUILDPATH="${WORKDIR}/rpm" | ||
2 | |||
3 | RPMOPTS="--rcfile=${WORKDIR}/rpmrc" | ||
4 | RPMOPTS="--rcfile=${WORKDIR}/rpmrc --target ${TARGET_SYS}" | ||
5 | RPM="rpm ${RPMOPTS}" | ||
6 | RPMBUILD="rpmbuild --buildroot ${D} --short-circuit ${RPMOPTS}" | ||
7 | |||
8 | rpm_core_do_preprpm() { | ||
9 | mkdir -p ${RPMBUILDPATH}/{SPECS,RPMS/{i386,i586,i686,noarch,ppc,mips,mipsel,arm},SRPMS,SOURCES,BUILD} | ||
10 | echo 'macrofiles:/usr/lib/rpm/macros:${WORKDIR}/macros' > ${WORKDIR}/rpmrc | ||
11 | echo '%_topdir ${RPMBUILDPATH}' > ${WORKDIR}/macros | ||
12 | echo '%_repackage_dir ${WORKDIR}' >> ${WORKDIR}/macros | ||
13 | } | ||
14 | |||
15 | EXPORT_FUNCTIONS do_preprpm | ||
16 | addtask preprpm before do_fetch | ||
diff --git a/openembedded/classes/scons.bbclass b/openembedded/classes/scons.bbclass new file mode 100644 index 0000000000..3160eca69a --- /dev/null +++ b/openembedded/classes/scons.bbclass | |||
@@ -0,0 +1,13 @@ | |||
1 | DEPENDS += "python-scons-native" | ||
2 | |||
3 | scons_do_compile() { | ||
4 | ${STAGING_BINDIR}/scons || \ | ||
5 | oefatal "scons build execution failed." | ||
6 | } | ||
7 | |||
8 | scons_do_install() { | ||
9 | ${STAGING_BINDIR}/scons install || \ | ||
10 | oefatal "scons install execution failed." | ||
11 | } | ||
12 | |||
13 | EXPORT_FUNCTIONS do_compile do_install | ||
diff --git a/openembedded/classes/sdk.bbclass b/openembedded/classes/sdk.bbclass new file mode 100644 index 0000000000..bd49c51225 --- /dev/null +++ b/openembedded/classes/sdk.bbclass | |||
@@ -0,0 +1,22 @@ | |||
1 | # SDK packages are built either explicitly by the user, | ||
2 | # or indirectly via dependency. No need to be in 'world'. | ||
3 | EXCLUDE_FROM_WORLD = "1" | ||
4 | |||
5 | SDK_NAME = "${TARGET_ARCH}/oe" | ||
6 | PACKAGE_ARCH = "${BUILD_ARCH}" | ||
7 | |||
8 | HOST_ARCH = "${BUILD_ARCH}" | ||
9 | HOST_VENDOR = "${BUILD_VENDOR}" | ||
10 | HOST_OS = "${BUILD_OS}" | ||
11 | HOST_PREFIX = "${BUILD_PREFIX}" | ||
12 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" | ||
13 | |||
14 | export CPPFLAGS = "${BUILD_CPPFLAGS}" | ||
15 | export CFLAGS = "${BUILD_CFLAGS}" | ||
16 | export CXXFLAGS = "${BUILD_CFLAGS}" | ||
17 | export LDFLAGS = "${BUILD_LDFLAGS}" | ||
18 | |||
19 | prefix = "/usr/local/${SDK_NAME}" | ||
20 | exec_prefix = "${prefix}" | ||
21 | |||
22 | FILES_${PN} = "${prefix}" | ||
diff --git a/openembedded/classes/sdl.bbclass b/openembedded/classes/sdl.bbclass new file mode 100644 index 0000000000..541812ed93 --- /dev/null +++ b/openembedded/classes/sdl.bbclass | |||
@@ -0,0 +1,27 @@ | |||
1 | FILES_${PN} += '${libdir}/perl5' | ||
2 | |||
3 | sdl_do_configure () { | ||
4 | if [ -x ${S}/configure ] ; then | ||
5 | cfgcmd="${S}/configure \ | ||
6 | -GL -GLU" | ||
7 | oenote "Running $cfgcmd..." | ||
8 | $cfgcmd || oefatal "oe_runconf failed" | ||
9 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then | ||
10 | . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh | ||
11 | sed -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:; s:\(SITEARCHEXP = \).*:\1${sitearchexp}:; s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5:; s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" < Makefile > Makefile.new | ||
12 | mv Makefile.new Makefile | ||
13 | fi | ||
14 | else | ||
15 | oefatal "no configure script found" | ||
16 | fi | ||
17 | } | ||
18 | |||
19 | sdl_do_compile () { | ||
20 | oe_runmake PASTHRU_INC="${CFLAGS}" | ||
21 | } | ||
22 | |||
23 | sdl_do_install () { | ||
24 | oe_runmake install_vendor | ||
25 | } | ||
26 | |||
27 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
diff --git a/openembedded/classes/sip.bbclass b/openembedded/classes/sip.bbclass new file mode 100644 index 0000000000..7e049bc65a --- /dev/null +++ b/openembedded/classes/sip.bbclass | |||
@@ -0,0 +1,53 @@ | |||
1 | DEPENDS_prepend = "sip-native python-sip " | ||
2 | |||
3 | #EXTRA_SIPTAGS = "-tWS_QWS -tQtPE_1_6_0 -tQt_2_3_1" | ||
4 | |||
5 | sip_do_generate() { | ||
6 | if [ -z "${SIP_MODULES}" ]; then | ||
7 | MODULES="`ls sip/*mod.sip`" | ||
8 | else | ||
9 | MODULES="${SIP_MODULES}" | ||
10 | fi | ||
11 | |||
12 | if [ -z "$MODULES" ]; then | ||
13 | die "SIP_MODULES not set and no modules found in $PWD" | ||
14 | else | ||
15 | oenote "using modules '${SIP_MODULES}' and tags '${EXTRA_SIPTAGS}'" | ||
16 | fi | ||
17 | |||
18 | if [ -z "${EXTRA_SIPTAGS}" ]; then | ||
19 | die "EXTRA_SIPTAGS needs to be set!" | ||
20 | else | ||
21 | SIPTAGS="${EXTRA_SIPTAGS}" | ||
22 | fi | ||
23 | |||
24 | if [ ! -z "${SIP_FEATURES}" ]; then | ||
25 | FEATURES="-z ${SIP_FEATURES}" | ||
26 | oenote "sip feature file: ${SIP_FEATURES}" | ||
27 | fi | ||
28 | |||
29 | for module in $MODULES | ||
30 | do | ||
31 | install -d ${module}/ | ||
32 | oenote "calling 'sip -I sip -I ${STAGING_SIPDIR} ${SIPTAGS} ${FEATURES} -c ${module} -b ${module}/${module}.pro.in sip/${module}/${module}mod.sip'" | ||
33 | sip -I ${STAGING_SIPDIR} -I sip ${SIPTAGS} ${FEATURES} -c ${module} -b ${module}/${module}.sbf sip/${module}/${module}mod.sip \ | ||
34 | || die "Error calling sip on ${module}" | ||
35 | cat ${module}/${module}.sbf | sed s,target,TARGET, \ | ||
36 | | sed s,sources,SOURCES, \ | ||
37 | | sed s,headers,HEADERS, \ | ||
38 | | sed s,"moc_HEADERS =","HEADERS +=", \ | ||
39 | >${module}/${module}.pro | ||
40 | echo "TEMPLATE=lib" >>${module}/${module}.pro | ||
41 | [ "${module}" = "qt" ] && echo "" >>${module}/${module}.pro | ||
42 | [ "${module}" = "qtcanvas" ] && echo "" >>${module}/${module}.pro | ||
43 | [ "${module}" = "qttable" ] && echo "" >>${module}/${module}.pro | ||
44 | [ "${module}" = "qwt" ] && echo "" >>${module}/${module}.pro | ||
45 | [ "${module}" = "qtpe" ] && echo "" >>${module}/${module}.pro | ||
46 | [ "${module}" = "qtpe" ] && echo "LIBS+=-lqpe" >>${module}/${module}.pro | ||
47 | true | ||
48 | done | ||
49 | } | ||
50 | |||
51 | EXPORT_FUNCTIONS do_generate | ||
52 | |||
53 | addtask generate after do_unpack do_patch before do_configure | ||
diff --git a/openembedded/classes/sourcepkg.bbclass b/openembedded/classes/sourcepkg.bbclass new file mode 100644 index 0000000000..ee022c99d2 --- /dev/null +++ b/openembedded/classes/sourcepkg.bbclass | |||
@@ -0,0 +1,111 @@ | |||
1 | DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/source" | ||
2 | EXCLUDE_FROM ?= ".pc" | ||
3 | |||
4 | # used as part of a path. make sure it's set | ||
5 | DISTRO ?= "openembedded" | ||
6 | |||
7 | def get_src_tree(d): | ||
8 | import bb | ||
9 | import os, os.path | ||
10 | |||
11 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
12 | if not workdir: | ||
13 | bb.error("WORKDIR not defined, unable to find source tree.") | ||
14 | return | ||
15 | |||
16 | s = bb.data.getVar('S', d, 0) | ||
17 | if not s: | ||
18 | bb.error("S not defined, unable to find source tree.") | ||
19 | return | ||
20 | |||
21 | s_tree_raw = s.split('/')[1] | ||
22 | s_tree = bb.data.expand(s_tree_raw, d) | ||
23 | |||
24 | src_tree_path = os.path.join(workdir, s_tree) | ||
25 | try: | ||
26 | os.listdir(src_tree_path) | ||
27 | except OSError: | ||
28 | bb.fatal("Expected to find source tree in '%s' which doesn't exist." % src_tree_path) | ||
29 | bb.debug("Assuming source tree is '%s'" % src_tree_path) | ||
30 | |||
31 | return s_tree | ||
32 | |||
33 | sourcepkg_do_create_orig_tgz(){ | ||
34 | |||
35 | mkdir -p ${DEPLOY_DIR_SRC} | ||
36 | cd ${WORKDIR} | ||
37 | for i in ${EXCLUDE_FROM}; do | ||
38 | echo $i >> temp/exclude-from-file | ||
39 | done | ||
40 | |||
41 | src_tree=${@get_src_tree(d)} | ||
42 | |||
43 | echo $src_tree | ||
44 | oenote "Creating .orig.tar.gz in ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz" | ||
45 | tar cvzf ${DEPLOY_DIR_SRC}/${P}.orig.tar.gz $src_tree --exclude-from temp/exclude-from-file | ||
46 | cp -a $src_tree $src_tree.orig | ||
47 | } | ||
48 | |||
49 | sourcepkg_do_archive_bb() { | ||
50 | |||
51 | src_tree=${@get_src_tree(d)} | ||
52 | dest=${WORKDIR}/$src_tree/${DISTRO} | ||
53 | mkdir -p $dest | ||
54 | |||
55 | cp ${FILE} $dest | ||
56 | } | ||
57 | |||
58 | python sourcepkg_do_dumpdata() { | ||
59 | import os | ||
60 | import os.path | ||
61 | |||
62 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
63 | distro = bb.data.getVar('DISTRO', d, 1) | ||
64 | s_tree = get_src_tree(d) | ||
65 | openembeddeddir = os.path.join(workdir, s_tree, distro) | ||
66 | dumpfile = os.path.join(openembeddeddir, bb.data.expand("${P}-${PR}.showdata.dump",d)) | ||
67 | |||
68 | try: | ||
69 | os.mkdir(openembeddeddir) | ||
70 | except OSError: | ||
71 | # dir exists | ||
72 | pass | ||
73 | |||
74 | bb.note("Dumping metadata into '%s'" % dumpfile) | ||
75 | f = open(dumpfile, "w") | ||
76 | # emit variables and shell functions | ||
77 | bb.data.emit_env(f, d, True) | ||
78 | # emit the metadata which isnt valid shell | ||
79 | for e in d.keys(): | ||
80 | if bb.data.getVarFlag(e, 'python', d): | ||
81 | f.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1))) | ||
82 | f.close() | ||
83 | } | ||
84 | |||
85 | sourcepkg_do_create_diff_gz(){ | ||
86 | |||
87 | cd ${WORKDIR} | ||
88 | for i in ${EXCLUDE_FROM}; do | ||
89 | echo $i >> temp/exclude-from-file | ||
90 | done | ||
91 | |||
92 | |||
93 | src_tree=${@get_src_tree(d)} | ||
94 | |||
95 | for i in `find . -maxdepth 1 -type f`; do | ||
96 | mkdir -p $src_tree/${DISTRO}/files | ||
97 | cp $i $src_tree/${DISTRO}/files | ||
98 | done | ||
99 | |||
100 | oenote "Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz" | ||
101 | LC_ALL=C TZ=UTC0 diff --exclude-from=temp/exclude-from-file -Naur $src_tree.orig $src_tree | gzip -c > ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz | ||
102 | rm -rf $src_tree.orig | ||
103 | } | ||
104 | |||
105 | EXPORT_FUNCTIONS do_create_orig_tgz do_archive_bb do_dumpdata do_create_diff_gz | ||
106 | |||
107 | addtask create_orig_tgz after do_unpack before do_patch | ||
108 | addtask archive_bb after do_patch before do_dumpdata | ||
109 | addtask dumpdata after archive_bb before do_create_diff_gz | ||
110 | addtask create_diff_gz after do_dump_data before do_configure | ||
111 | |||
diff --git a/openembedded/classes/src_distribute.bbclass b/openembedded/classes/src_distribute.bbclass new file mode 100644 index 0000000000..5daf526018 --- /dev/null +++ b/openembedded/classes/src_distribute.bbclass | |||
@@ -0,0 +1,40 @@ | |||
1 | include conf/licenses.conf | ||
2 | |||
3 | SRC_DISTRIBUTECOMMAND[func] = "1" | ||
4 | python do_distribute_sources () { | ||
5 | l = bb.data.createCopy(d) | ||
6 | bb.data.update_data(l) | ||
7 | licenses = (bb.data.getVar('LICENSE', d, 1) or "").split() | ||
8 | if not licenses: | ||
9 | bb.note("LICENSE not defined") | ||
10 | src_distribute_licenses = (bb.data.getVar('SRC_DISTRIBUTE_LICENSES', d, 1) or "").split() | ||
11 | # Explanation: | ||
12 | # Space seperated items in LICENSE must *all* be distributable | ||
13 | # Each space seperated item may be used under any number of | seperated licenses. | ||
14 | # If any of those | seperated licenses are distributable, then that component is. | ||
15 | # i.e. LICENSE = "GPL LGPL" | ||
16 | # In this case, both components are distributable. | ||
17 | # LICENSE = "GPL|QPL|Proprietary" | ||
18 | # In this case, GPL is distributable, so the component is. | ||
19 | valid = 1 | ||
20 | for l in licenses: | ||
21 | lvalid = 0 | ||
22 | for i in l.split("|"): | ||
23 | if i in src_distribute_licenses: | ||
24 | lvalid = 1 | ||
25 | if lvalid != 1: | ||
26 | valid = 0 | ||
27 | if valid == 0: | ||
28 | bb.note("Licenses (%s) are not all listed in SRC_DISTRIBUTE_LICENSES, skipping source distribution" % licenses) | ||
29 | return | ||
30 | import re | ||
31 | for s in (bb.data.getVar('A', d, 1) or "").split(): | ||
32 | s = re.sub(';.*$', '', s) | ||
33 | cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1) | ||
34 | if not cmd: | ||
35 | raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not defined") | ||
36 | bb.data.setVar('SRC', s, d) | ||
37 | bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d) | ||
38 | } | ||
39 | |||
40 | addtask distribute_sources before do_build after do_fetch | ||
diff --git a/openembedded/classes/src_distribute_local.bbclass b/openembedded/classes/src_distribute_local.bbclass new file mode 100644 index 0000000000..5f0cef5bec --- /dev/null +++ b/openembedded/classes/src_distribute_local.bbclass | |||
@@ -0,0 +1,31 @@ | |||
1 | inherit src_distribute | ||
2 | |||
3 | # SRC_DIST_LOCAL possible values: | ||
4 | # copy copies the files from ${A} to the distributedir | ||
5 | # symlink symlinks the files from ${A} to the distributedir | ||
6 | # move+symlink moves the files into distributedir, and symlinks them back | ||
7 | SRC_DIST_LOCAL ?= "move+symlink" | ||
8 | SRC_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/sources" | ||
9 | SRC_DISTRIBUTECOMMAND () { | ||
10 | s="${SRC}" | ||
11 | if [ ! -L "$s" ] && (echo "$s"|grep "^${DL_DIR}"); then | ||
12 | : | ||
13 | else | ||
14 | exit 0; | ||
15 | fi | ||
16 | mkdir -p ${SRC_DISTRIBUTEDIR} | ||
17 | case "${SRC_DIST_LOCAL}" in | ||
18 | copy) | ||
19 | test -e $s.md5 && cp -f $s.md5 ${SRC_DISTRIBUTEDIR}/ | ||
20 | cp -f $s ${SRC_DISTRIBUTEDIR}/ | ||
21 | ;; | ||
22 | symlink) | ||
23 | test -e $s.md5 && ln -sf $s.md5 ${SRC_DISTRIBUTEDIR}/ | ||
24 | ln -sf $s ${SRC_DISTRIBUTEDIR}/ | ||
25 | ;; | ||
26 | move+symlink) | ||
27 | mv $s ${SRC_DISTRIBUTEDIR}/ | ||
28 | ln -sf ${SRC_DISTRIBUTEDIR}/`basename $s` $s | ||
29 | ;; | ||
30 | esac | ||
31 | } | ||
diff --git a/openembedded/classes/srec.bbclass b/openembedded/classes/srec.bbclass new file mode 100644 index 0000000000..ae46a407fe --- /dev/null +++ b/openembedded/classes/srec.bbclass | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # Creates .srec files from images. | ||
3 | # | ||
4 | # Useful for loading with Yamon. | ||
5 | |||
6 | # Define SREC_VMAADDR in your machine.conf. | ||
7 | |||
8 | SREC_CMD = "${TARGET_PREFIX}objcopy -O srec -I binary --adjust-vma ${SREC_VMAADDR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.${type}.srec" | ||
9 | |||
10 | # Do not build srec files for these types of images: | ||
11 | SREC_SKIP = "tar" | ||
12 | |||
13 | do_srec () { | ||
14 | if [ ${SREC_VMAADDR} = "" ] ; then | ||
15 | oefatal Cannot do_srec without SREC_VMAADDR defined. | ||
16 | fi | ||
17 | for type in ${IMAGE_FSTYPES}; do | ||
18 | for skiptype in ${SREC_SKIP}; do | ||
19 | if [ $type = $skiptype ] ; then continue 2 ; fi | ||
20 | done | ||
21 | ${SREC_CMD} | ||
22 | done | ||
23 | return 0 | ||
24 | } | ||
25 | |||
26 | addtask srec after do_rootfs before do_build | ||
diff --git a/openembedded/classes/tinderclient.bbclass b/openembedded/classes/tinderclient.bbclass new file mode 100644 index 0000000000..290166bb03 --- /dev/null +++ b/openembedded/classes/tinderclient.bbclass | |||
@@ -0,0 +1,158 @@ | |||
1 | def tinder_tz_offset(off): | ||
2 | # get the offset.n minutes Either it is a number like | ||
3 | # +200 or -300 | ||
4 | try: | ||
5 | return int(off) | ||
6 | except ValueError: | ||
7 | if off == "Europe/Berlin": | ||
8 | return 120 | ||
9 | else: | ||
10 | return 0 | ||
11 | |||
12 | def tinder_tinder_time(offset): | ||
13 | import datetime | ||
14 | td = datetime.timedelta(minutes=tinder_tz_offset(offset)) | ||
15 | time = datetime.datetime.utcnow() + td | ||
16 | return time.strftime('%m/%d/%Y %H:%M:%S') | ||
17 | |||
18 | def tinder_tinder_start(date,offset): | ||
19 | import datetime, time | ||
20 | td = datetime.timedelta(minutes=tinder_tz_offset(offset)) | ||
21 | ti = time.strptime(date, "%m/%d/%Y %H:%M:%S") | ||
22 | time = datetime.datetime(*ti[0:7])+td | ||
23 | return time.strftime('%m/%d/%Y %H:%M:%S') | ||
24 | |||
25 | def tinder_send_email(da, header, log): | ||
26 | import smtplib | ||
27 | from bb import data | ||
28 | from email.MIMEText import MIMEText | ||
29 | msg = MIMEText(header +'\n' + log) | ||
30 | msg['Subject'] = data.getVar('TINDER_SUBJECT',da, True) or "Tinder-Client build log" | ||
31 | msg['To'] = data.getVar('TINDER_MAILTO' ,da, True) | ||
32 | msg['From'] = data.getVar('TINDER_FROM', da, True) | ||
33 | |||
34 | |||
35 | s = smtplib.SMTP() | ||
36 | s.connect() | ||
37 | s.sendmail(data.getVar('TINDER_FROM', da, True), [data.getVar('TINDER_MAILTO', da, True)], msg.as_string()) | ||
38 | s.close() | ||
39 | |||
40 | def tinder_send_http(da, header, log): | ||
41 | from bb import data | ||
42 | import httplib, urllib | ||
43 | cont = "\n%s\n%s" % ( header, log) | ||
44 | headers = {"Content-type": "multipart/form-data" } | ||
45 | |||
46 | conn = httplib.HTTPConnection(data.getVar('TINDER_HOST',da, True)) | ||
47 | conn.request("POST", data.getVar('TINDER_URL',da,True), cont, headers) | ||
48 | conn.close() | ||
49 | |||
50 | |||
51 | # Prepare tinderbox mail header | ||
52 | def tinder_prepare_mail_header(da, status): | ||
53 | from bb import data | ||
54 | |||
55 | str = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True) | ||
56 | str += "tinderbox: starttime: %s\n" % tinder_tinder_start(data.getVar('TINDER_START', da, True) or data.getVar('BUILDSTART', da, True), data.getVar('TINDER_TZ', da, True)) | ||
57 | str += "tinderbox: buildname: %s\n" % data.getVar('TINDER_BUILD', da, True) | ||
58 | str += "tinderbox: errorparser: %s\n" % data.getVar('TINDER_ERROR', da, True) | ||
59 | str += "tinderbox: status: %s\n" % status | ||
60 | str += "tinderbox: timenow: %s\n" % tinder_tinder_time(data.getVar('TINDER_TZ', da, True)) | ||
61 | str += "tinderbox: tree: %s\n" % data.getVar('TINDER_TREE', da, True) | ||
62 | str += "tinderbox: buildfamily: %s\n" % "unix" | ||
63 | str += "tinderbox: END" | ||
64 | |||
65 | return str | ||
66 | |||
67 | def tinder_do_tinder_report(event): | ||
68 | """ | ||
69 | Report to the tinderbox. Either we will report every step | ||
70 | (depending on TINDER_VERBOSE_REPORT) at the end we will send the | ||
71 | tinderclient.log | ||
72 | """ | ||
73 | from bb.event import getName | ||
74 | from bb import data, mkdirhier | ||
75 | import os, glob | ||
76 | |||
77 | # variables | ||
78 | name = getName(event) | ||
79 | log = "" | ||
80 | header = "" | ||
81 | verbose = data.getVar('TINDER_VERBOSE_REPORT', event.data, True) == "1" | ||
82 | |||
83 | # Check what we need to do Build* shows we start or are done | ||
84 | if name == "BuildStarted": | ||
85 | header = tinder_prepare_mail_header(event.data, 'building') | ||
86 | # generate | ||
87 | for var in os.environ: | ||
88 | log += "%s=%s\n" % (var, os.environ[var]) | ||
89 | |||
90 | mkdirhier(data.getVar('TMPDIR', event.data, True)) | ||
91 | file = open(data.getVar('TINDER_LOG', event.data, True), 'w') | ||
92 | file.write(log) | ||
93 | |||
94 | if not verbose: | ||
95 | header = "" | ||
96 | |||
97 | if name == "PkgFailed" or name == "BuildCompleted": | ||
98 | status = 'build_failed' | ||
99 | if name == "BuildCompleted": | ||
100 | status = "success" | ||
101 | header = tinder_prepare_mail_header(event.data, status) | ||
102 | # append the log | ||
103 | log_file = data.getVar('TINDER_LOG', event.data, True) | ||
104 | file = open(log_file, 'r') | ||
105 | for line in file.readlines(): | ||
106 | log += line | ||
107 | |||
108 | if verbose and name == "TaskStarted": | ||
109 | header = tinder_prepare_mail_header(event.data, 'building') | ||
110 | log = "Task %s started" % event.task | ||
111 | |||
112 | if verbose and name == "PkgStarted": | ||
113 | header = tinder_prepare_mail_header(event.data, 'building') | ||
114 | log = "Package %s started" % data.getVar('P', event.data, True) | ||
115 | |||
116 | if verbose and name == "PkgSucceeded": | ||
117 | header = tinder_prepare_mail_header(event.data, 'building') | ||
118 | log = "Package %s done" % data.getVar('P', event.data, True) | ||
119 | |||
120 | # Append the Task Log | ||
121 | if name == "TaskSucceeded" or name == "TaskFailed": | ||
122 | log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) | ||
123 | |||
124 | if len(log_file) != 0: | ||
125 | to_file = data.getVar('TINDER_LOG', event.data, True) | ||
126 | log_txt = open(log_file[0], 'r').readlines() | ||
127 | to_file = open(to_file, 'a') | ||
128 | |||
129 | to_file.writelines(log_txt) | ||
130 | |||
131 | # append to the log | ||
132 | if verbose: | ||
133 | header = tinder_prepare_mail_header(event.data, 'building') | ||
134 | for line in log_txt: | ||
135 | log += line | ||
136 | |||
137 | # now mail the log | ||
138 | if len(log) == 0 or len(header) == 0: | ||
139 | return | ||
140 | |||
141 | log_post_method = tinder_send_email | ||
142 | if data.getVar('TINDER_SENDLOG', event.data, True) == "http": | ||
143 | log_post_method = tinder_send_http | ||
144 | |||
145 | log_post_method(event.data, header, log) | ||
146 | |||
147 | |||
148 | addhandler tinderclient_eventhandler | ||
149 | python tinderclient_eventhandler() { | ||
150 | from bb import note, error, data | ||
151 | from bb.event import NotHandled | ||
152 | |||
153 | do_tinder_report = data.getVar('TINDER_REPORT', e.data, True) | ||
154 | if do_tinder_report and do_tinder_report == "1": | ||
155 | tinder_do_tinder_report(e) | ||
156 | |||
157 | return NotHandled | ||
158 | } | ||
diff --git a/openembedded/classes/tmake.bbclass b/openembedded/classes/tmake.bbclass new file mode 100644 index 0000000000..05b82e496d --- /dev/null +++ b/openembedded/classes/tmake.bbclass | |||
@@ -0,0 +1,77 @@ | |||
1 | DEPENDS_prepend="tmake " | ||
2 | |||
3 | python tmake_do_createpro() { | ||
4 | import glob, sys | ||
5 | from bb import note | ||
6 | out_vartranslate = { | ||
7 | "TMAKE_HEADERS": "HEADERS", | ||
8 | "TMAKE_INTERFACES": "INTERFACES", | ||
9 | "TMAKE_TEMPLATE": "TEMPLATE", | ||
10 | "TMAKE_CONFIG": "CONFIG", | ||
11 | "TMAKE_DESTDIR": "DESTDIR", | ||
12 | "TMAKE_SOURCES": "SOURCES", | ||
13 | "TMAKE_DEPENDPATH": "DEPENDPATH", | ||
14 | "TMAKE_INCLUDEPATH": "INCLUDEPATH", | ||
15 | "TMAKE_TARGET": "TARGET", | ||
16 | "TMAKE_LIBS": "LIBS", | ||
17 | } | ||
18 | s = data.getVar('S', d, 1) or "" | ||
19 | os.chdir(s) | ||
20 | profiles = (data.getVar('TMAKE_PROFILES', d, 1) or "").split() | ||
21 | if not profiles: | ||
22 | profiles = ["*.pro"] | ||
23 | for pro in profiles: | ||
24 | ppro = glob.glob(pro) | ||
25 | if ppro: | ||
26 | if ppro != [pro]: | ||
27 | del profiles[profiles.index(pro)] | ||
28 | profiles += ppro | ||
29 | continue | ||
30 | if ppro[0].find('*'): | ||
31 | del profiles[profiles.index(pro)] | ||
32 | continue | ||
33 | else: | ||
34 | del profiles[profiles.index(pro)] | ||
35 | if len(profiles) != 0: | ||
36 | return | ||
37 | |||
38 | # output .pro using this metadata store | ||
39 | try: | ||
40 | from __builtin__ import file | ||
41 | profile = file(data.expand('${PN}.pro', d), 'w') | ||
42 | except OSError: | ||
43 | raise FuncFailed("unable to open pro file for writing.") | ||
44 | |||
45 | # fd = sys.__stdout__ | ||
46 | fd = profile | ||
47 | for var in out_vartranslate.keys(): | ||
48 | val = data.getVar(var, d, 1) | ||
49 | if val: | ||
50 | fd.write("%s\t: %s\n" % (out_vartranslate[var], val)) | ||
51 | |||
52 | # if fd is not sys.__stdout__: | ||
53 | fd.close() | ||
54 | } | ||
55 | |||
56 | tmake_do_configure() { | ||
57 | paths="${STAGING_DATADIR}/tmake/qws/${TARGET_OS}-${TARGET_ARCH}-g++ $STAGING_DIR/share/tmake/$OS-g++" | ||
58 | if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then | ||
59 | paths="${STAGING_DATADIR}/tmake/qws/${TARGET_OS}-x86-g++ $paths" | ||
60 | fi | ||
61 | for i in $paths; do | ||
62 | if test -e $i; then | ||
63 | export TMAKEPATH=$i | ||
64 | break | ||
65 | fi | ||
66 | done | ||
67 | |||
68 | if [ -z "${TMAKE_PROFILES}" ]; then | ||
69 | TMAKE_PROFILES="`ls *.pro`" | ||
70 | fi | ||
71 | tmake -o Makefile $TMAKE_PROFILES || die "Error calling tmake on ${TMAKE_PROFILES}" | ||
72 | } | ||
73 | |||
74 | EXPORT_FUNCTIONS do_configure do_createpro | ||
75 | |||
76 | addtask configure after do_unpack do_patch before do_compile | ||
77 | addtask createpro before do_configure after do_unpack do_patch | ||
diff --git a/openembedded/classes/update-alternatives.bbclass b/openembedded/classes/update-alternatives.bbclass new file mode 100644 index 0000000000..6b2b547d5f --- /dev/null +++ b/openembedded/classes/update-alternatives.bbclass | |||
@@ -0,0 +1,33 @@ | |||
1 | # defaults | ||
2 | ALTERNATIVE_PRIORITY = "10" | ||
3 | ALTERNATIVE_LINK = "${bindir}/${ALTERNATIVE_NAME}" | ||
4 | |||
5 | update_alternatives_postinst() { | ||
6 | update-alternatives --install ${ALTERNATIVE_LINK} ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY} | ||
7 | } | ||
8 | |||
9 | update_alternatives_postrm() { | ||
10 | update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} | ||
11 | } | ||
12 | |||
13 | python __anonymous() { | ||
14 | if bb.data.getVar('ALTERNATIVE_NAME', d) == None: | ||
15 | raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d) | ||
16 | if bb.data.getVar('ALTERNATIVE_PATH', d) == None: | ||
17 | raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d) | ||
18 | } | ||
19 | |||
20 | python populate_packages_prepend () { | ||
21 | pkg = bb.data.getVar('PN', d, 1) | ||
22 | bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg) | ||
23 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
24 | if not postinst: | ||
25 | postinst = '#!/bin/sh\n' | ||
26 | postinst += bb.data.getVar('update_alternatives_postinst', d, 1) | ||
27 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
28 | postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) | ||
29 | if not postrm: | ||
30 | postrm = '#!/bin/sh\n' | ||
31 | postrm += bb.data.getVar('update_alternatives_postrm', d, 1) | ||
32 | bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) | ||
33 | } | ||
diff --git a/openembedded/classes/update-rc.d.bbclass b/openembedded/classes/update-rc.d.bbclass new file mode 100644 index 0000000000..0bfba467c1 --- /dev/null +++ b/openembedded/classes/update-rc.d.bbclass | |||
@@ -0,0 +1,69 @@ | |||
1 | DEPENDS_append = " update-rc.d" | ||
2 | RDEPENDS_append = " update-rc.d" | ||
3 | |||
4 | INITSCRIPT_PARAMS ?= "defaults" | ||
5 | |||
6 | INIT_D_DIR = "${sysconfdir}/init.d" | ||
7 | |||
8 | updatercd_postinst() { | ||
9 | if test "x$D" != "x"; then | ||
10 | D="-r $D" | ||
11 | else | ||
12 | D="-s" | ||
13 | fi | ||
14 | update-rc.d $D ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} | ||
15 | } | ||
16 | |||
17 | updatercd_prerm() { | ||
18 | if test "x$D" != "x"; then | ||
19 | D="-r $D" | ||
20 | else | ||
21 | ${INIT_D_DIR}/${INITSCRIPT_NAME} stop | ||
22 | fi | ||
23 | } | ||
24 | |||
25 | updatercd_postrm() { | ||
26 | update-rc.d $D ${INITSCRIPT_NAME} remove | ||
27 | } | ||
28 | |||
29 | python __anonymous() { | ||
30 | if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None: | ||
31 | if bb.data.getVar('INITSCRIPT_NAME', d) == None: | ||
32 | raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d) | ||
33 | if bb.data.getVar('INITSCRIPT_PARAMS', d) == None: | ||
34 | raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d) | ||
35 | } | ||
36 | |||
37 | python populate_packages_prepend () { | ||
38 | def update_rcd_package(pkg): | ||
39 | bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg) | ||
40 | localdata = bb.data.createCopy(d) | ||
41 | overrides = bb.data.getVar("OVERRIDES", localdata, 1) | ||
42 | bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata) | ||
43 | bb.data.update_data(localdata) | ||
44 | |||
45 | postinst = bb.data.getVar('pkg_postinst', localdata, 1) | ||
46 | if not postinst: | ||
47 | postinst = '#!/bin/sh\n' | ||
48 | postinst += bb.data.getVar('updatercd_postinst', localdata, 1) | ||
49 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
50 | prerm = bb.data.getVar('pkg_prerm', localdata, 1) | ||
51 | if not prerm: | ||
52 | prerm = '#!/bin/sh\n' | ||
53 | prerm += bb.data.getVar('updatercd_prerm', localdata, 1) | ||
54 | bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) | ||
55 | postrm = bb.data.getVar('pkg_postrm', localdata, 1) | ||
56 | if not postrm: | ||
57 | postrm = '#!/bin/sh\n' | ||
58 | postrm += bb.data.getVar('updatercd_postrm', localdata, 1) | ||
59 | bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) | ||
60 | |||
61 | pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1) | ||
62 | if pkgs == None: | ||
63 | pkgs = bb.data.getVar('PN', d, 1) | ||
64 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | ||
65 | if not pkgs in packages and packages != []: | ||
66 | pkgs = packages[0] | ||
67 | for pkg in pkgs.split(): | ||
68 | update_rcd_package(pkg) | ||
69 | } | ||
diff --git a/openembedded/classes/wrt-image.bbclass b/openembedded/classes/wrt-image.bbclass new file mode 100644 index 0000000000..ba1163a719 --- /dev/null +++ b/openembedded/classes/wrt-image.bbclass | |||
@@ -0,0 +1,33 @@ | |||
1 | # we dont need the kernel in the image | ||
2 | ROOTFS_POSTPROCESS_COMMAND += "rm -f ${IMAGE_ROOTFS}/boot/zImage*" | ||
3 | |||
4 | def wrt_get_kernel_version(d): | ||
5 | import bb | ||
6 | if bb.data.inherits_class('image_ipk', d): | ||
7 | skd = bb.data.getVar('STAGING_KERNEL_DIR', d, 1) | ||
8 | return base_read_file(skd+'/kernel-abiversion') | ||
9 | return "-no kernel version for available-" | ||
10 | |||
11 | wrt_create_images() { | ||
12 | I=${DEPLOY_DIR}/images | ||
13 | KERNEL_VERSION="${@wrt_get_kernel_version(d)}" | ||
14 | |||
15 | for type in ${IMAGE_FSTYPES}; do | ||
16 | # generic | ||
17 | trx -o ${I}/wrt-generic-${type}.trx ${I}/loader.gz \ | ||
18 | ${I}/wrt-kernel-${KERNEL_VERSION}.lzma -a 0x10000 ${I}/${IMAGE_NAME}.rootfs.${type} | ||
19 | |||
20 | # WRT54GS | ||
21 | addpattern -2 -i ${I}/wrt-generic-${type}.trx -o ${I}/wrt54gs-${type}.trx -g | ||
22 | |||
23 | # WRT54G | ||
24 | sed "1s,^W54S,W54G," ${I}/wrt54gs-${type}.trx > ${I}/wrt54g-${type}.trx | ||
25 | |||
26 | # motorola | ||
27 | motorola-bin ${I}/wrt-generic-${type}.trx ${I}/motorola-${type}.bin | ||
28 | done; | ||
29 | } | ||
30 | |||
31 | IMAGE_POSTPROCESS_COMMAND += "wrt_create_images;" | ||
32 | |||
33 | DEPENDS_prepend = "${@["wrt-imagetools-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" \ No newline at end of file | ||
diff --git a/openembedded/classes/xfce.bbclass b/openembedded/classes/xfce.bbclass new file mode 100644 index 0000000000..793348597f --- /dev/null +++ b/openembedded/classes/xfce.bbclass | |||
@@ -0,0 +1,19 @@ | |||
1 | # xfce.oeclass | ||
2 | # Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved | ||
3 | # Released under the MIT license (see packages/COPYING) | ||
4 | |||
5 | # Global class to make it easier to maintain XFCE packages | ||
6 | |||
7 | HOMEPAGE = "http://www.xfce.org" | ||
8 | LICENSE = "LGPL-2" | ||
9 | |||
10 | SRC_URI = "http://www.us.xfce.org/archive/xfce-${PV}/src/${PN}-${PV}.tar.gz" | ||
11 | |||
12 | inherit autotools | ||
13 | |||
14 | EXTRA_OECONF += "--with-pluginsdir=${libdir}/xfce4/panel-plugins/" | ||
15 | |||
16 | # FIXME: Put icons in their own package too? | ||
17 | |||
18 | FILES_${PN} += "${datadir}/icons/* ${datadir}/applications/* ${libdir}/xfce4/modules/*.so*" | ||
19 | FILES_${PN}-doc += "${datadir}/xfce4/doc" | ||
diff --git a/openembedded/classes/xlibs.bbclass b/openembedded/classes/xlibs.bbclass new file mode 100644 index 0000000000..f9a1195663 --- /dev/null +++ b/openembedded/classes/xlibs.bbclass | |||
@@ -0,0 +1,15 @@ | |||
1 | LICENSE= "BSD-X" | ||
2 | SECTION = "x11/libs" | ||
3 | |||
4 | XLIBS_CVS = "cvs://anoncvs:anoncvs@pdx.freedesktop.org/cvs/xlibs" | ||
5 | |||
6 | inherit autotools pkgconfig | ||
7 | |||
8 | do_stage() { | ||
9 | oe_runmake install prefix=${STAGING_DIR} \ | ||
10 | bindir=${STAGING_BINDIR} \ | ||
11 | includedir=${STAGING_INCDIR} \ | ||
12 | libdir=${STAGING_LIBDIR} \ | ||
13 | datadir=${STAGING_DATADIR} \ | ||
14 | mandir=${STAGING_DATADIR}/man | ||
15 | } | ||