Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # Note: Due to the bitbake wrapper script, making changes to pseudo can be |
| 2 | # difficult. To work around the current version of the wrapper use: |
| 3 | # BBFETCH2=True PSEUDO_BUILD=1 ../bitbake/bin/bitbake pseudo-native [-c CMD] |
| 4 | |
| 5 | SUMMARY = "Pseudo gives fake root capabilities to a normal user" |
| 6 | HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo" |
| 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad" |
| 8 | SECTION = "base" |
| 9 | LICENSE = "LGPL2.1" |
| 10 | DEPENDS = "sqlite3 attr" |
| 11 | |
| 12 | FILES_${PN} = "${prefix}/lib/pseudo/lib*/libpseudo.so ${bindir}/* ${localstatedir}/pseudo ${prefix}/var/pseudo" |
| 13 | FILES_${PN}-dbg += "${prefix}/lib/pseudo/lib*/.debug" |
| 14 | INSANE_SKIP_${PN} += "libdir" |
| 15 | INSANE_SKIP_${PN}-dbg += "libdir" |
| 16 | |
| 17 | PROVIDES += "virtual/fakeroot" |
| 18 | |
| 19 | MAKEOPTS = "" |
| 20 | |
| 21 | inherit siteinfo |
| 22 | |
| 23 | do_configure () { |
| 24 | : |
| 25 | } |
| 26 | |
| 27 | NO32LIBS ??= "1" |
| 28 | NO32LIBS_class-nativesdk = "1" |
| 29 | |
| 30 | # Compile for the local machine arch... |
| 31 | do_compile () { |
| 32 | if [ "${SITEINFO_BITS}" = "64" ]; then |
| 33 | ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib${SITEINFO_BITS} --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --enable-static-sqlite --without-rpath |
| 34 | else |
| 35 | ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --enable-static-sqlite --without-rpath |
| 36 | fi |
| 37 | oe_runmake ${MAKEOPTS} |
| 38 | } |
| 39 | do_compile[vardepsexclude] = "SITEINFO_BITS" |
| 40 | |
| 41 | maybe_make32() { |
| 42 | # We probably don't need to build 32-bit binaries. |
| 43 | make32=false |
| 44 | if [ "${SITEINFO_BITS}" = "64" ]; then |
| 45 | case "${NO32LIBS}" in |
| 46 | 0) make32=true |
| 47 | ;; |
| 48 | 1) make32=false |
| 49 | ;; |
| 50 | *) # If unset, build 32-bit if we think we can. |
| 51 | if [ -e "/usr/include/gnu/stubs-32.h" ]; then |
| 52 | make32=true |
| 53 | fi |
| 54 | ;; |
| 55 | esac |
| 56 | fi |
| 57 | if $make32; then |
| 58 | if ! [ -e "/usr/include/gnu/stubs-32.h" ]; then |
| 59 | warn_32bit_missing |
| 60 | else |
| 61 | bbnote "Attempting to build 32-bit libpseudo.so for ${PN}." |
| 62 | fi |
| 63 | else |
| 64 | bbnote "Building/installing only 64-bit libpseudo.so for ${PN}." |
| 65 | bbnote "If you need to run 32-bit executables, ensure that NO32LIBS is set to 0." |
| 66 | fi |
| 67 | } |
| 68 | maybe_make32[vardepsexclude] = "SITEINFO_BITS" |
| 69 | |
| 70 | warn_32bit_missing() { |
| 71 | bbwarn "Can't find stubs-32.h, but usually need it to build 32-bit libpseudo." |
| 72 | bbwarn "If the build fails, install 32-bit developer packages." |
| 73 | bbwarn "If you are using 32-bit binaries, the 32-bit libpseudo is NOT optional." |
| 74 | } |
| 75 | |
| 76 | # Two below are the same |
| 77 | # If necessary compile for the alternative machine arch. This is only |
| 78 | # necessary in a native build. |
| 79 | do_compile_prepend_class-native () { |
| 80 | maybe_make32 |
| 81 | if $make32; then |
| 82 | # We need the 32-bit libpseudo on a 64-bit machine... |
| 83 | # Note that this is not well-tested outside of x86/x86_64. |
| 84 | |
| 85 | # if we're being rebuilt due to a dependency change, we need to make sure |
| 86 | # everything is clean before we configure and build -- if we haven't previously |
| 87 | # built this will fail and be ignored. |
| 88 | make ${MAKEOPTS} distclean || : |
| 89 | |
| 90 | ./configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=32 --without-rpath |
| 91 | save_traps=$(trap) |
| 92 | trap 'warn_32bit_missing' 0 |
| 93 | oe_runmake ${MAKEOPTS} libpseudo |
| 94 | eval "$save_traps" |
| 95 | # prevent it from removing the lib, but remove everything else |
| 96 | make 'LIB=foo' ${MAKEOPTS} distclean |
| 97 | fi |
| 98 | } |
| 99 | |
| 100 | do_compile_prepend_class-nativesdk () { |
| 101 | maybe_make32 |
| 102 | if $make32; then |
| 103 | # We need the 32-bit libpseudo on a 64-bit machine. |
| 104 | # Note that this is not well-tested outside of x86/x86_64. |
| 105 | ./configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --bits=32 --without-rpath |
| 106 | oe_runmake ${MAKEOPTS} libpseudo |
| 107 | # prevent it from removing the lib, but remove everything else |
| 108 | make 'LIB=foo' ${MAKEOPTS} distclean |
| 109 | fi |
| 110 | } |
| 111 | |
| 112 | do_install () { |
| 113 | oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install |
| 114 | } |
| 115 | |
| 116 | # Two below are the same |
| 117 | # If necessary install for the alternative machine arch. This is only |
| 118 | # necessary in a native build. |
| 119 | do_install_append_class-native () { |
| 120 | maybe_make32 |
| 121 | if $make32; then |
| 122 | mkdir -p ${D}${prefix}/lib/pseudo/lib |
| 123 | cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/. |
| 124 | fi |
| 125 | } |
| 126 | |
| 127 | do_install_append_class-nativesdk () { |
| 128 | maybe_make32 |
| 129 | if $make32; then |
| 130 | mkdir -p ${D}${prefix}/lib/pseudo/lib |
| 131 | cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/. |
| 132 | fi |
| 133 | } |
| 134 | |
| 135 | BBCLASSEXTEND = "native nativesdk" |