1 python populate_sysroot_prehook () {
5 python populate_sysroot_posthook () {
9 packagedstaging_fastpath () {
13 def package_stagefile(file, d):
14 if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1":
15 destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1))
16 bb.mkdirhier(os.path.dirname(destfile))
17 #print "%s to %s" % (file, destfile)
18 bb.copyfile(file, destfile)
20 package_stagefile_shell() {
21 if [ "$PSTAGING_ACTIVE" = "1" ]; then
23 destfile=`echo $srcfile | sed s#${TMPDIR}#${PSTAGE_TMPDIR_STAGE}#`
24 destdir=`dirname $destfile`
26 cp -dp $srcfile $destfile
33 # This will remove empty directories so we can ignore them
34 rmdir "$src" 2> /dev/null || true
35 if [ -d "$src" ]; then
37 cp -fpPR "$src"/* "$dest"
41 SYSROOTEXTRALIBDIRSED ?= ""
42 sysroot_stage_libdir() {
48 las=$(find . -name \*.la -type f)
50 echo "Found la files: $las"
53 sed -e 's/^installed=yes$/installed=no/' \
54 -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \
55 -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
56 ${SYSROOTEXTRALIBDIRSED} \
59 sysroot_stage_dir $src $dest
62 sysroot_stage_dirs() {
66 sysroot_stage_dir $from${includedir} $to${STAGING_INCDIR}
67 if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
68 sysroot_stage_dir $from${bindir} $to${STAGING_DIR_HOST}${bindir}
69 sysroot_stage_dir $from${sbindir} $to${STAGING_DIR_HOST}${sbindir}
70 sysroot_stage_dir $from${base_bindir} $to${STAGING_DIR_HOST}${base_bindir}
71 sysroot_stage_dir $from${base_sbindir} $to${STAGING_DIR_HOST}${base_sbindir}
72 sysroot_stage_dir $from${libexecdir} $to${STAGING_DIR_HOST}${libexecdir}
73 sysroot_stage_dir $from${sysconfdir} $to${STAGING_DIR_HOST}${sysconfdir}
74 if [ "${prefix}/lib" != "${libdir}" ]; then
75 # python puts its files in here, make sure they are staged as well
76 autotools_stage_dir $from/${prefix}/lib $to${STAGING_DIR_HOST}${prefix}/lib
79 if [ -d $from${libdir} ]
81 sysroot_stage_libdir $from/${libdir} $to${STAGING_LIBDIR}
83 if [ -d $from${base_libdir} ]
85 sysroot_stage_libdir $from${base_libdir} $to${STAGING_DIR_HOST}${base_libdir}
87 sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR}
88 sysroot_stage_dir $from${sysconfdir} $to${STAGING_ETCDIR}
92 sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR}
95 def is_legacy_staging(d):
96 stagefunc = bb.data.getVar('do_stage', d, True)
100 elif stagefunc.strip() == "use_do_install_for_stage":
102 elif stagefunc.strip() == "autotools_stage_all":
104 elif stagefunc.strip() == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1":
106 elif bb.data.getVar('NATIVE_INSTALL_WORKS', d, 1) == "1":
108 if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1":
110 if bb.data.getVar('FORCE_LEGACY_STAGING', d, 1) == "1":
114 do_populate_sysroot[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \
115 ${STAGING_DIR_TARGET}/${includedir} \
116 ${STAGING_BINDIR_NATIVE} ${STAGING_LIBDIR_NATIVE} \
117 ${STAGING_INCDIR_NATIVE} \
121 # Could be compile but populate_sysroot and do_install shouldn't run at the same time
122 addtask populate_sysroot after do_install
124 SYSROOT_PREPROCESS_FUNCS ?= ""
125 SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/"
126 SYSROOT_LOCK = "${STAGING_DIR}/staging.lock"
129 python do_populate_sysroot () {
131 # if do_stage exists, we're legacy. In that case run the do_stage,
132 # modify the SYSROOT_DESTDIR variable and then run the staging preprocess
133 # functions against staging directly.
135 # Otherwise setup a destdir, copy the results from do_install
136 # and run the staging preprocess against that
138 pstageactive = (bb.data.getVar("PSTAGING_ACTIVE", d, True) == "1")
139 lockfile = bb.data.getVar("SYSROOT_LOCK", d, True)
140 stagefunc = bb.data.getVar('do_stage', d, True)
141 legacy = is_legacy_staging(d)
143 bb.data.setVar("SYSROOT_DESTDIR", "", d)
144 bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True))
147 file = open("%s/legacy-staging.log" % bb.data.getVar("TMPDIR", d, 1), "a")
148 file.write("%s\n" % bb.data.getVar("FILE", d, True))
153 if bb.data.getVarFlags('do_stage', d) is None:
154 bb.fatal("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True))
155 lock = bb.utils.lockfile(lockfile)
156 bb.build.exec_func('populate_sysroot_prehook', d)
157 bb.build.exec_func('do_stage', d)
158 for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split():
159 bb.build.exec_func(f, d)
160 bb.build.exec_func('populate_sysroot_posthook', d)
161 bb.utils.unlockfile(lock)
163 dest = bb.data.getVar('D', d, True)
164 sysrootdest = bb.data.expand('${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}', d)
165 bb.mkdirhier(sysrootdest)
167 bb.build.exec_func("sysroot_stage_all", d)
168 #os.system('cp -pPR %s/* %s/' % (dest, sysrootdest))
169 for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split():
170 bb.build.exec_func(f, d)
171 bb.build.exec_func("packagedstaging_fastpath", d)
173 lock = bb.utils.lockfile(lockfile)
174 os.system(bb.data.expand('cp -pPR ${SYSROOT_DESTDIR}${TMPDIR}/* ${TMPDIR}/', d))
175 bb.utils.unlockfile(lock)
179 if is_legacy_staging(d):
180 bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True))
181 if bb.data.getVarFlags('do_stage', d) is None:
182 bb.error("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True))