blob: 0de7b3615f95affcc841361774e1e788ff9feb01 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# 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"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013INSANE_SKIP_${PN} += "libdir"
14INSANE_SKIP_${PN}-dbg += "libdir"
15
16PROVIDES += "virtual/fakeroot"
17
18MAKEOPTS = ""
19
20inherit siteinfo
21
22do_configure () {
23 :
24}
25
26NO32LIBS ??= "1"
27NO32LIBS_class-nativesdk = "1"
28
29# Compile for the local machine arch...
30do_compile () {
31 if [ "${SITEINFO_BITS}" = "64" ]; then
32 ${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
33 else
34 ${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
35 fi
36 oe_runmake ${MAKEOPTS}
37}
38do_compile[vardepsexclude] = "SITEINFO_BITS"
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}
67maybe_make32[vardepsexclude] = "SITEINFO_BITS"
68
69warn_32bit_missing() {
70 bbwarn "Can't find stubs-32.h, but usually need it to build 32-bit libpseudo."
71 bbwarn "If the build fails, install 32-bit developer packages."
72 bbwarn "If you are using 32-bit binaries, the 32-bit libpseudo is NOT optional."
73}
74
75# Two below are the same
76# If necessary compile for the alternative machine arch. This is only
77# necessary in a native build.
78do_compile_prepend_class-native () {
79 maybe_make32
80 if $make32; then
81 # We need the 32-bit libpseudo on a 64-bit machine...
82 # Note that this is not well-tested outside of x86/x86_64.
83
84 # if we're being rebuilt due to a dependency change, we need to make sure
85 # everything is clean before we configure and build -- if we haven't previously
86 # built this will fail and be ignored.
87 make ${MAKEOPTS} distclean || :
88
89 ./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
90 save_traps=$(trap)
91 trap 'warn_32bit_missing' 0
92 oe_runmake ${MAKEOPTS} libpseudo
93 eval "$save_traps"
94 # prevent it from removing the lib, but remove everything else
95 make 'LIB=foo' ${MAKEOPTS} distclean
96 fi
97}
98
99do_compile_prepend_class-nativesdk () {
100 maybe_make32
101 if $make32; then
102 # We need the 32-bit libpseudo on a 64-bit machine.
103 # Note that this is not well-tested outside of x86/x86_64.
104 ./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
105 oe_runmake ${MAKEOPTS} libpseudo
106 # prevent it from removing the lib, but remove everything else
107 make 'LIB=foo' ${MAKEOPTS} distclean
108 fi
109}
110
111do_install () {
112 oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install
113}
114
115# Two below are the same
116# If necessary install for the alternative machine arch. This is only
117# necessary in a native build.
118do_install_append_class-native () {
119 maybe_make32
120 if $make32; then
121 mkdir -p ${D}${prefix}/lib/pseudo/lib
122 cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
123 fi
124}
125
126do_install_append_class-nativesdk () {
127 maybe_make32
128 if $make32; then
129 mkdir -p ${D}${prefix}/lib/pseudo/lib
130 cp lib/pseudo/lib/libpseudo.so ${D}${prefix}/lib/pseudo/lib/.
131 fi
132}
133
134BBCLASSEXTEND = "native nativesdk"