summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/emacs/emacs.inc
blob: fa554ed738248888b2e1e494943ab3f1c2a6e98b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
DESCRIPTION = "Emacs"
HOMEPAGE = "http://www.gnu.org/software/emacs/"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
SECTION = "editor"
# and it needs to run some generated binaries..
DEPENDS += "qemu-native"

DEPENDS +=" liblockfile"

X11DEPENDS = " \
    libice libsm atk cairo dbus expat libffi fontconfig freetype gconf giflib \
    jpeg xz pixman libpng librsvg tiff libcroco \
    libx11 libxau libxcomposite libxcursor libxdamage libxdmcp libxext libxfixes \
    libxft libxpm libxrandr libxrender \
    gdk-pixbuf glib-2.0 gtk+ pango libxcb harfbuzz icu \
" 

EXTRA_OECONF =  "--without-sound --with-crt-dir=${STAGING_LIBDIR} "

PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
PACKAGECONFIG[x11] = "--with-x-toolkit=gtk,--without-x,${X11DEPENDS}"

inherit autotools

PACKAGES =+ "${PN}-el"

FILES_${PN}-el = "${datadir}/emacs/*/*/*.el.gz \
                  ${datadir}/emacs/*/*/*/*.el.gz"

FILES_${PN} += "${datadir}/emacs ${datadir}/icons"

FILES_${PN}-dbg += "${libexecdir}/emacs/*/*/.debug ${datadir}/emacs/*/*/.debug"

TREEDIR = "${WORKDIR}/qemu-treedir"

QEMUARCH= "${TARGET_ARCH}"
QEMUARCH_i486 = "i386"
QEMUARCH_i586 = "i386"
QEMUARCH_i686 = "i386"

# Large stack is required at least on x86_64 host, otherwise random segfaults appear:
QEMU = "qemu-${QEMUARCH} ${QEMU_OPTIONS} -s 1048576 -L ${TREEDIR} "

export LOGNAME = "$(whoami)"

do_compile_prepend() {
    sed -i ':1;s:\(START.* \|LIB_STANDARD.* \|LIBES.* \)/usr/lib:\1${STAGING_LIBDIR}:;t1' ${S}/src/s/gnu-linux.h `find "${S}" -name Makefile`
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${TOOLCHAIN_PATH}/${TARGET_SYS}/lib"
# Ugly hack, see files/use-qemu.patch for more:
    ln -sf ../src/emacs lisp/emacs
    ln -sf ../src/emacs lib-src/emacs
    ln -sf ../src/emacs leim/emacs
#copy STAGING_DIR_TARGET and libgcc_s.so* to WORKDIR/qemu-treedir #copied code from glibc-package.bbclass
    treedir=${TREEDIR}
    if [ -e $treedir ];then
        rm -rf $treedir
    fi
    
    mkdir -p $treedir/${base_libdir}

    if [ -f ${TOOLCHAIN_PATH}/${TARGET_SYS}/${base_libdir}/libgcc_s.so ]; then
        cp -pPR ${TOOLCHAIN_PATH}/${TARGET_SYS}/${base_libdir}/libgcc_s.so $treedir/${base_libdir}
    fi
    if [ -f ${TOOLCHAIN_PATH}/${TARGET_SYS}/${base_libdir}/libgcc_s.so.* ]; then
        cp -pPR ${TOOLCHAIN_PATH}/${TARGET_SYS}/${base_libdir}/libgcc_s.so.* $treedir/${base_libdir}
    fi
    # stupid hack, but without it, it tries to use /usr/lib/libc.so from host and fails
    # temacs: error while loading shared libraries: /usr/lib/libc.so: ELF file version does not match current one
    if [ ! -f $treedir/${base_libdir}/libc.so ]; then
        ln -s libc.so.6 $treedir/${base_libdir}/libc.so
    fi

    # copy only as much stuff as we need
    # before: 5.5G   ../../qemu-treedir/
    # after:   17M   ../../qemu-treedir/
    cp -pPR \
    ${STAGING_DIR_TARGET}/${base_libdir}/ld-* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libc.* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libc-* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libm-* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libm.* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libtinfo.so.* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libresolv* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libdl* \
    ${STAGING_DIR_TARGET}/${base_libdir}/librt* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libgcc_s.so.* \
    ${STAGING_DIR_TARGET}/${base_libdir}/libpthread* $treedir/${base_libdir}/

    if [ ! -z "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" ] ; then
        echo "X11 build enabled"
        # copy only as much stuff as we need
        # before: 5.5G   ../../qemu-treedir/
        # after:   86M   ../../qemu-treedir/
        cp -pPR \
        ${STAGING_DIR_TARGET}/${base_libdir}/libuuid.so.* \
        ${STAGING_DIR_TARGET}/${base_libdir}/libz.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libICE.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libSM.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libatk-1.0.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libcairo.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libdbus-1.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libdbus-glib-1.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libexpat.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libffi.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libfontconfig.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libfreetype.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libgconf-2.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libgif.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libjpeg.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/liblzma.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libpixman-1.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libpng1*.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/librsvg-2.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libstdc++.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libtiff.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libxml2.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libcroco-0.6.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libharfbuzz.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libicule.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libicuuc.so.* \
        ${STAGING_DIR_TARGET}/${libdir}/libicudata.so.* $treedir/${base_libdir}/

        # X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes Xft Xpm Xrandr Xrender
        cp -pPR ${STAGING_DIR_TARGET}/${libdir}/libX*.so.* $treedir/${base_libdir}/

        # gdk-x11 gdk_pixbuf gio glib gmodule gobject gthread gtk-x11
        cp -pPR ${STAGING_DIR_TARGET}/${libdir}/libg*-2.0.so.* $treedir/${base_libdir}/

        # pango pangocairo pangoft2
        cp -pPR ${STAGING_DIR_TARGET}/${libdir}/libpango*-1.0.so.* $treedir/${base_libdir}/

        # xcb-render xcb-shm xcb
        cp -pPR ${STAGING_DIR_TARGET}/${libdir}/libxcb*.so.* $treedir/${base_libdir}/
    fi
}

do_install_append() {
    # freaks package.bbclass and whole bitbake call returns error code
    # ERROR: runstrip: ''arm-oe-linux-gnueabi-strip'  '/var/lib/jenkins/jobs/shr-core-branches/workspace/shr-core/tmp-eglibc/work/armv4t-oe-linux-gnueabi/emacs-23.4-r0/package/usr/share/emacs/23.4/etc/tutorials/TUTORIAL.ko'' strip command failed
    mv ${D}${datadir}/${BPN}/${PV}/etc/tutorials/TUTORIAL.ko ${D}${datadir}/${BPN}/${PV}/etc/tutorials/TUTORIAL.KO
}

EXTRA_OEMAKE += 'QEMU="${QEMU}"'