From bea72c2fecde175add169bb55df1922b048030c8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 30 Oct 2009 21:48:21 +0000 Subject: Start removal of layout_* variables and replace these with new mechanisms to allow nextgen SDK generation (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 9de2c67af1..3f610ac384 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -977,8 +977,8 @@ base_do_stage () { : } -do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${layout_bindir} ${STAGING_DIR_TARGET}/${layout_libdir} \ - ${STAGING_DIR_TARGET}/${layout_includedir} \ +do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ + ${STAGING_DIR_TARGET}/${includedir} \ ${STAGING_BINDIR_NATIVE} ${STAGING_LIBDIR_NATIVE} \ ${STAGING_INCDIR_NATIVE} \ ${STAGING_DATADIR} \ -- cgit v1.2.3 From b66fa6b32686ef5a750de1bb2fb317448c682863 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:23:05 +0000 Subject: autotools.bbclass: Separate out useful staging functions into base.bbclass and call from autotools classes (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 3f610ac384..8404a07025 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -973,6 +973,70 @@ base_do_compile() { fi } + +sysroot_stage_dir() { + src="$1" + dest="$2" + # This will remove empty directories so we can ignore them + rmdir "$src" 2> /dev/null || true + if [ -d "$src" ]; then + mkdir -p "$dest" + cp -fpPR "$src"/* "$dest" + fi +} + +sysroot_stage_libdir() { + src="$1" + dest="$2" + + olddir=`pwd` + cd $src + las=$(find . -name \*.la -type f) + cd $olddir + echo "Found la files: $las" + for i in $las + do + sed -e 's/^installed=yes$/installed=no/' \ + -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \ + -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \ + -i $src/$i + done + sysroot_stage_dir $src $dest +} + +sysroot_stage_dirs() { + from="$1" + to="$2" + + sysroot_stage_dir $from${includedir} $to${STAGING_INCDIR} + if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then + sysroot_stage_dir $from${bindir} $to${STAGING_DIR_HOST}${bindir} + sysroot_stage_dir $from${sbindir} $to${STAGING_DIR_HOST}${sbindir} + sysroot_stage_dir $from${base_bindir} $to${STAGING_DIR_HOST}${base_bindir} + sysroot_stage_dir $from${base_sbindir} $to${STAGING_DIR_HOST}${base_sbindir} + sysroot_stage_dir $from${libexecdir} $to${STAGING_DIR_HOST}${libexecdir} + if [ "${prefix}/lib" != "${libdir}" ]; then + # python puts its files in here, make sure they are staged as well + autotools_stage_dir $from/${prefix}/lib $to${STAGING_DIR_HOST}${prefix}/lib + fi + fi + if [ -d $from${libdir} ] + then + sysroot_stage_libdir $from/${libdir} $to${STAGING_LIBDIR} + fi + if [ -d $from${base_libdir} ] + then + sysroot_stage_libdir $from${base_libdir} $to${STAGING_DIR_HOST}${base_libdir} + fi + sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} +} + + +sysroot_stage_all() { + sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} +} + + base_do_stage () { : } -- cgit v1.2.3 From bf755f0c721a91a3067fdac9f936a72e11f99cbc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:30:32 +0000 Subject: binconfig/pkgconfig.bbclass: Convert staging functions into SYSROOT_PREPROCESS_FUNCS operating on SYSROOT_DESTDIR Signed-off-by: Richard Purdie --- classes/base.bbclass | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 8404a07025..024f8227bc 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1051,8 +1051,13 @@ do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGE # Could be compile but populate_staging and do_install shouldn't run at the same time addtask populate_staging after do_install +SYSROOT_PREPROCESS_FUNCS ?= "" +SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" + python do_populate_staging () { bb.build.exec_func('do_stage', d) + for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) } addtask install after do_compile -- cgit v1.2.3 From 5c7d389a900e2c821a5e5572f7a1bc568f86be18 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:38:29 +0000 Subject: packaged-staging.bbclass: Use a variable for the location of the staging lock file (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 1 + 1 file changed, 1 insertion(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 024f8227bc..a75324b48e 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1053,6 +1053,7 @@ addtask populate_staging after do_install SYSROOT_PREPROCESS_FUNCS ?= "" SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" +SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" python do_populate_staging () { bb.build.exec_func('do_stage', d) -- cgit v1.2.3 From 5b28d571177ba2c9d16c89a03f7c645a0e7050fb Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 20:40:34 +0000 Subject: base.bbclass: Rework staging function to use a DESTDIR style configuration based on the data from the do_install step (from Poky). This falls back to any standard do_stage function if defined, see the mailing list for more info. Signed-off-by: Richard Purdie --- classes/base.bbclass | 59 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index a75324b48e..583679d887 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1031,15 +1031,23 @@ sysroot_stage_dirs() { sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} } - sysroot_stage_all() { sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} } - -base_do_stage () { - : -} +def is_legacy_staging(d): + import bb + stagefunc = bb.data.getVar('do_stage', d, True) + legacy = True + if stagefunc is None: + legacy = False + elif stagefunc.strip() == "autotools_stage_all": + legacy = False + elif stagefunc.strip() == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": + legacy = False + if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": + legacy = True + return legacy do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ ${STAGING_DIR_TARGET}/${includedir} \ @@ -1056,9 +1064,42 @@ SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" python do_populate_staging () { - bb.build.exec_func('do_stage', d) - for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): - bb.build.exec_func(f, d) + # + # if do_stage exists, we're legacy. In that case run the do_stage, + # modify the SYSROOT_DESTDIR variable and then run the staging preprocess + # functions against staging directly. + # + # Otherwise setup a destdir, copy the results from do_install + # and run the staging preprocess against that + # + pstageactive = (bb.data.getVar("PSTAGING_ACTIVE", d, True) == "1") + lockfile = bb.data.getVar("SYSROOT_LOCK", d, True) + stagefunc = bb.data.getVar('do_stage', d, True) + legacy = is_legacy_staging(d) + if legacy: + bb.data.setVar("SYSROOT_DESTDIR", "", d) + bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) + lock = bb.utils.lockfile(lockfile) + bb.build.exec_func('do_stage', d) + bb.build.exec_func('populate_staging_prehook', d) + for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) + bb.build.exec_func('populate_staging_posthook', d) + bb.utils.unlockfile(lock) + else: + dest = bb.data.getVar('D', d, True) + sysrootdest = bb.data.expand('${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}', d) + bb.mkdirhier(sysrootdest) + + bb.build.exec_func("sysroot_stage_all", d) + #os.system('cp -pPR %s/* %s/' % (dest, sysrootdest)) + for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) + bb.build.exec_func("packagedstageing_fastpath", d) + + lock = bb.utils.lockfile(lockfile) + os.system('cp -pPR %s/* /' % (sysrootdest)) + bb.utils.unlockfile(lock) } addtask install after do_compile @@ -1228,7 +1269,7 @@ inherit patch # Move to autotools.bbclass? inherit siteinfo -EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_distclean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall +EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_distclean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_rebuild do_fetchall MIRRORS[func] = "0" MIRRORS () { -- cgit v1.2.3 From 97c8212d54950b70cd955f94bdd66822ce3f2ba4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 20:42:28 +0000 Subject: base.bbclass: Note legacy staging packages in debug output Signed-off-by: Richard Purdie --- classes/base.bbclass | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 583679d887..5ae8b6130f 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1240,6 +1240,8 @@ def base_after_parse(d): python () { base_after_parse(d) + if is_legacy_staging(d): + bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) } def check_app_exists(app, d): -- cgit v1.2.3 From 0c0889223c330b8a3c9e122581805e2c3d9a7bd4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 22:34:50 +0000 Subject: base.bbclass: Add stubs for functions when package-staging isn't active and fix a typo Signed-off-by: Richard Purdie --- classes/base.bbclass | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 5ae8b6130f..d33ef343c7 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1063,6 +1063,18 @@ SYSROOT_PREPROCESS_FUNCS ?= "" SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" +python populate_staging_prehook () { + return +} + +python populate_staging_posthook () { + return +} + +packagedstaging_fastpath () { + : +} + python do_populate_staging () { # # if do_stage exists, we're legacy. In that case run the do_stage, @@ -1095,7 +1107,7 @@ python do_populate_staging () { #os.system('cp -pPR %s/* %s/' % (dest, sysrootdest)) for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): bb.build.exec_func(f, d) - bb.build.exec_func("packagedstageing_fastpath", d) + bb.build.exec_func("packagedstaging_fastpath", d) lock = bb.utils.lockfile(lockfile) os.system('cp -pPR %s/* /' % (sysrootdest)) -- cgit v1.2.3 From ab35aa34f3de37365d46692555c8a2ec3667da56 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 3 Nov 2009 00:38:53 +0000 Subject: base.bbclass: Fix staging for native and non-native packages Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index d33ef343c7..49bb8144d2 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1045,6 +1045,8 @@ def is_legacy_staging(d): legacy = False elif stagefunc.strip() == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": legacy = False + elif bb.data.getVar('NATIVE_INSTALL_WORKS', d, 1) == "1": + legacy = False if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": legacy = True return legacy @@ -1110,7 +1112,7 @@ python do_populate_staging () { bb.build.exec_func("packagedstaging_fastpath", d) lock = bb.utils.lockfile(lockfile) - os.system('cp -pPR %s/* /' % (sysrootdest)) + os.system(bb.data.expand('cp -pPR ${SYSROOT_DESTDIR}${TMPDIR}/* ${TMPDIR}/', d)) bb.utils.unlockfile(lock) } -- cgit v1.2.3 From 4ecbf17b161b54780c26af2c6e90333f8825b013 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Nov 2009 13:53:17 +0000 Subject: native.bbclass: Add BBCLASSEXTEND support (from poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 49bb8144d2..dd48d9229e 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -199,6 +199,8 @@ def base_both_contain(variable1, variable2, checkvalue, d): return "" DEPENDS_prepend="${@base_dep_prepend(d)} " +DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} " +DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} " # Returns PN with various suffixes removed # or PN if no matching suffix was found. -- cgit v1.2.3 From 539d1d9592ca0cde57ce94e227b63fd1104bb9d5 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Nov 2009 13:58:46 +0000 Subject: base.bbclass: Replace the base_package_name function with the base_prune_suffix() function from Poky and extend the number of special suffixes Signed-off-by: Richard Purdie --- classes/base.bbclass | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index dd48d9229e..aa1037e472 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -202,23 +202,13 @@ DEPENDS_prepend="${@base_dep_prepend(d)} " DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} " DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} " -# Returns PN with various suffixes removed -# or PN if no matching suffix was found. -def base_package_name(d): - pn = bb.data.getVar('PN', d, 1) - if pn.endswith("-native"): - pn = pn[0:-7] - elif pn.endswith("-cross"): - pn = pn[0:-6] - elif pn.endswith("-initial"): - pn = pn[0:-8] - elif pn.endswith("-intermediate"): - pn = pn[0:-13] - elif pn.endswith("-sdk"): - pn = pn[0:-4] - - - return pn +def base_prune_suffix(var, suffixes, d): + # See if var ends with any of the suffixes listed and + # remove it if found + for suffix in suffixes: + if var.endswith(suffix): + return var.replace(suffix, "") + return var def base_set_filespath(path, d): bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1)) -- cgit v1.2.3