973c8eba1fb633bdcb855eaab380601bfab63987
[vuplus_openembedded] / uclibc / uclibc_0.9.26.oe
1 DESCRIPTION = "C library for embedded systems"
2 LICENSE = "LGPL"
3 SECTION = "libs"
4 PRIORITY = "required"
5 MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
6
7 #
8 # For now, we will skip building of a gcc package if it is a uclibc one
9 # and our build is not a uclibc one, and we skip a glibc one if our build
10 # is a uclibc build.
11 #
12 # See the note in gcc/gcc_3.4.0.oe
13 #
14
15 python __anonymous () {
16     import oe, re
17     uc_os = (re.match('.*uclibc$', oe.data.getVar('TARGET_OS', d, 1)) != None)
18     if not uc_os:
19         raise oe.parse.SkipPackage("incompatible with target %s" %
20                                    oe.data.getVar('TARGET_OS', d, 1))
21 }
22
23 #
24 # We can only work currently with a predefined .config, this ensures we have
25 # one.  In the future, this may want to respect ${MACHINE} as well.
26 #
27
28 python __anonymous () {
29     import oe, os;
30     conf = (oe.data.getVar('FILESDIR', d, 1) + "/uClibc.config." +
31             oe.data.getVar('TARGET_ARCH', d, 1))
32     if not os.access(conf, os.R_OK):
33         raise oe.parse.SkipPackage("no available .config for target %s" %
34                                    oe.data.getVar('TARGET_OS', d, 1))
35 }
36
37 PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
38 DEPENDS = "patcher-native virtual/${TARGET_PREFIX}binutils \
39            virtual/${TARGET_PREFIX}gcc-initial"
40 INHIBIT_DEFAULT_DEPS = "1"
41
42 #
43 # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to
44 # build, it does not need to be unpacked, but we can't inhibit the unpacking
45 # in the current build system.
46 #
47 UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz"
48 FILESDIR = "${@os.path.dirname(oe.data.getVar('FILE',d,1))}/uclibc-${PV}"
49 SRC_URI = "http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2 \
50            http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE} \
51            http://www.uclibc.org/downloads/toolchain/kernel-headers-2.4.21.tar.bz2"
52
53 S = "${WORKDIR}/uClibc-${PV}"
54
55 UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}"
56 UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}"
57
58 EXTRA_OEMAKE = ""
59
60 uclibcbuild_do_patch() {
61         rm -f ${WORKDIR}/linux/include/asm
62         ln -sf asm-${TARGET_ARCH} ${WORKDIR}/linux/include/asm
63
64         touch ${WORKDIR}/linux/include/linux/autoconf.h
65
66         echo "#define UTS_RELEASE \"2.4.21\"" > ${WORKDIR}/linux/include/linux/version.h
67         echo "#define LINUX_VERSION_CODE 132117" >> ${WORKDIR}/linux/include/linux/version.h
68         echo "#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" \
69                 >> ${WORKDIR}/linux/include/linux/version.h
70
71         if [ -f ${FILESDIR}/uClibc.config.${TARGET_ARCH} ]; then
72                 cp ${FILESDIR}/uClibc.config.${TARGET_ARCH} ${S}/.config
73         else
74                 echo ERROR: No target specific config for ${TARGET_ARCH}
75                 return 1
76         fi
77
78         perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak
79         perl -i -p -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"${WORKDIR}/linux\",g' ${S}/.config
80         perl -i -p -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' ${S}/.config
81         perl -i -p -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/${prefix}\",g' ${S}/.config
82         perl -i -p -e 's,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH=\"/lib\",g' ${S}/.config
83         perl -i -p -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' ${S}/.config
84
85         cp ${DL_DIR}/${UCLIBC_LOCALE_FILE} extra/locale
86
87         make oldconfig
88 }
89
90 python do_patch () {
91         oe.build.exec_func('base_do_patch', d)
92         oe.build.exec_func('uclibcbuild_do_patch', d)
93 }
94
95 do_stage() {
96         # Install into the cross dir (this MUST be done first because we
97         # will install crt1.o in the install_dev stage and gcc needs it)
98         make PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
99                 RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
100                 install_dev install_runtime install_utils
101
102         # We don't really need this
103         rm -f ${UCLIBC_PREFIX}/include/.cvsignore
104
105         # Fixup shared lib symlinks
106         ( cd ${UCLIBC_PREFIX}/lib
107                 for f in c crypt dl m nsl pthread resolv thread_db util; do
108                         ln -sf lib${f}.so.? lib${f}.so
109                 done
110         )
111
112         # This conflicts with the c++ version of this header
113         rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h
114
115         # Install into the staging dir
116         make PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
117                 RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \
118                 install_dev install_runtime install_utils
119
120         # We don't really need this
121         rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore
122
123         # Fixup shared lib symlinks
124         ( cd ${UCLIBC_STAGE_PREFIX}/lib
125                 for f in c crypt dl m nsl pthread resolv thread_db util; do
126                         ln -sf lib${f}.so.? lib${f}.so
127                 done
128         )
129
130         # This conflicts with the c++ version of this header
131         rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h
132 }
133
134 do_install() {
135         make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
136                 install_dev install_runtime install_utils
137
138         # We don't really need this in /usr/include
139         rm -f ${D}/${prefix}/include/.cvsignore
140
141         # This conflicts with the c++ version of this header
142         rm -f ${D}/${prefix}/include/bits/atomicity.h
143 }
144