summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/pseudo.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/pseudo/pseudo.inc')
-rw-r--r--meta/recipes-devtools/pseudo/pseudo.inc133
1 files changed, 133 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/pseudo.inc b/meta/recipes-devtools/pseudo/pseudo.inc
new file mode 100644
index 0000000000..11a8514675
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/pseudo.inc
@@ -0,0 +1,133 @@
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
5SUMMARY = "Pseudo gives fake root capabilities to a normal user"
6HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo"
7LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad"
8SECTION = "base"
9LICENSE = "LGPL2.1"
10DEPENDS = "sqlite3 attr"
11
12FILES_${PN} = "${prefix}/lib/pseudo/lib*/libpseudo.so ${bindir}/* ${localstatedir}/pseudo ${prefix}/var/pseudo"
13FILES_${PN}-dbg += "${prefix}/lib/pseudo/lib*/.debug"
14INSANE_SKIP_${PN} += "libdir"
15INSANE_SKIP_${PN}-dbg += "libdir"
16
17PROVIDES += "virtual/fakeroot"
18
19MAKEOPTS = ""
20
21inherit siteinfo
22
23do_configure () {
24 :
25}
26
27NO32LIBS ??= "1"
28NO32LIBS_class-nativesdk = "1"
29
30# Compile for the local machine arch...
31do_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
40maybe_make32() {
41 # We probably don't need to build 32-bit binaries.
42 make32=false
43 if [ "${SITEINFO_BITS}" = "64" ]; then
44 case "${NO32LIBS}" in
45 0) make32=true
46 ;;
47 1) make32=false
48 ;;
49 *) # If unset, build 32-bit if we think we can.
50 if [ -e "/usr/include/gnu/stubs-32.h" ]; then
51 make32=true
52 fi
53 ;;
54 esac
55 fi
56 if $make32; then
57 if ! [ -e "/usr/include/gnu/stubs-32.h" ]; then
58 warn_32bit_missing
59 else
60 bbnote "Attempting to build 32-bit libpseudo.so for ${PN}."
61 fi
62 else
63 bbnote "Building/installing only 64-bit libpseudo.so for ${PN}."
64 bbnote "If you need to run 32-bit executables, ensure that NO32LIBS is set to 0."
65 fi
66}
67
68warn_32bit_missing() {
69 bbwarn "Can't find stubs-32.h, but usually need it to build 32-bit libpseudo."
70 bbwarn "If the build fails, install 32-bit developer packages."
71 bbwarn "If you are using 32-bit binaries, the 32-bit libpseudo is NOT optional."
72}
73
74# Two below are the same
75# If necessary compile for the alternative machine arch. This is only
76# necessary in a native build.
77do_compile_prepend_class-native () {
78 maybe_make32
79 if $make32; then
80 # We need the 32-bit libpseudo on a 64-bit machine...
81 # Note that this is not well-tested outside of x86/x86_64.
82
83 # if we're being rebuilt due to a dependency change, we need to make sure
84 # everything is clean before we configure and build -- if we haven't previously
85 # built this will fail and be ignored.
86 make ${MAKEOPTS} distclean || :
87
88 ./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
89 save_traps=$(trap)
90 trap 'warn_32bit_missing' 0
91 oe_runmake ${MAKEOPTS} libpseudo
92 eval "$save_traps"
93 # prevent it from removing the lib, but remove everything else
94 make 'LIB=foo' ${MAKEOPTS} distclean
95 fi
96}
97
98do_compile_prepend_class-nativesdk () {
99 maybe_make32
100 if $make32; then
101 # We need the 32-bit libpseudo on a 64-bit machine.
102 # Note that this is not well-tested outside of x86/x86_64.
103 ./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
104 oe_runmake ${MAKEOPTS} libpseudo
105 # prevent it from removing the lib, but remove everything else
106 make 'LIB=foo' ${MAKEOPTS} distclean
107 fi
108}
109
110do_install () {
111 oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install
112}
113
114# Two below are the same
115# If necessary install for the alternative machine arch. This is only
116# necessary in a native build.
117do_install_append_class-native () {
118 maybe_make32
119 if $make32; then
120 mkdir -p ${D}${prefix}/lib/pseudo/lib
121 cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
122 fi
123}
124
125do_install_append_class-nativesdk () {
126 maybe_make32
127 if $make32; then
128 mkdir -p ${D}${prefix}/lib/pseudo/lib
129 cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
130 fi
131}
132
133BBCLASSEXTEND = "native nativesdk"