diff options
author | Richard Purdie <richard@openedhand.com> | 2007-05-28 22:46:34 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-05-28 22:46:34 +0000 |
commit | 9babe4ce77e8957c357306c35d854726a45e88c8 (patch) | |
tree | 9457f6a2794dfbb1b0c4611e92c4c4c12e98672f /meta/packages/uclibc/uclibc.inc | |
parent | ce8bd8caeb2053ffa2b7fcceaad0fdf8a9b58804 (diff) | |
download | poky-9babe4ce77e8957c357306c35d854726a45e88c8.tar.gz |
Add uclibc (from OE)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1799 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/uclibc/uclibc.inc')
-rw-r--r-- | meta/packages/uclibc/uclibc.inc | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/meta/packages/uclibc/uclibc.inc b/meta/packages/uclibc/uclibc.inc new file mode 100644 index 0000000000..bae3f2d042 --- /dev/null +++ b/meta/packages/uclibc/uclibc.inc | |||
@@ -0,0 +1,213 @@ | |||
1 | DESCRIPTION = "C library for embedded systems" | ||
2 | LICENSE = "LGPL" | ||
3 | SECTION = "libs" | ||
4 | PRIORITY = "required" | ||
5 | |||
6 | # | ||
7 | # For now, we will skip building of a gcc package if it is a uclibc one | ||
8 | # and our build is not a uclibc one, and we skip a glibc one if our build | ||
9 | # is a uclibc build. | ||
10 | # | ||
11 | # See the note in gcc/gcc_3.4.0.oe | ||
12 | # | ||
13 | |||
14 | python __anonymous () { | ||
15 | import bb, re | ||
16 | uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None) | ||
17 | if not uc_os: | ||
18 | raise bb.parse.SkipPackage("incompatible with target %s" % | ||
19 | bb.data.getVar('TARGET_OS', d, 1)) | ||
20 | } | ||
21 | |||
22 | PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" | ||
23 | PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}" | ||
24 | DEPENDS = "virtual/${TARGET_PREFIX}binutils \ | ||
25 | virtual/${TARGET_PREFIX}gcc-initial linux-libc-headers" | ||
26 | INHIBIT_DEFAULT_DEPS = "1" | ||
27 | PARALLEL_MAKE = "" | ||
28 | |||
29 | PACKAGES =+ "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db" | ||
30 | |||
31 | uclibc_baselibs = "/lib/libcrypt*.so* /lib/libdl*.so \ | ||
32 | /lib/libintl*.so* /lib/libm*.so \ | ||
33 | /lib/libnsl*.so* /lib/libpthread*.so \ | ||
34 | /lib/libresolv*.so* /lib/libutil*.so \ | ||
35 | /lib/libuClibc*.so* /lib/ld*.so* \ | ||
36 | /lib/libc*.so* /lib/libdl*.so* \ | ||
37 | /lib/libm*.so* /lib/libutil*.so* \ | ||
38 | /lib/libpthread*.so* /lib/librt*.so*" | ||
39 | FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \ | ||
40 | ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale" | ||
41 | FILES_ldd = "${bindir}/ldd" | ||
42 | FILES_uclibc-dev += "${libdir}/*.o" | ||
43 | FILES_uclibc-utils = "${bindir} ${sbindir}" | ||
44 | FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug" | ||
45 | FILES_uclibc-gconv = "${libdir}/gconv" | ||
46 | FILES_uclibc-thread-db = "/lib/libthread_db*" | ||
47 | RPROVIDES_uclibc-dev += "libc-dev" | ||
48 | |||
49 | # | ||
50 | # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to | ||
51 | # build, it does not need to be unpacked, but we can't inhibit the unpacking | ||
52 | # in the current build system. | ||
53 | # | ||
54 | UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz" | ||
55 | UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz" | ||
56 | UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}" | ||
57 | UCLIBC_LOCALE_URI_arm = "http://openembedded.org/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}" | ||
58 | |||
59 | SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \ | ||
60 | file://uClibc.config" | ||
61 | |||
62 | UCLIBC_PREFIX = "${CROSS_DIR}/${TARGET_SYS}" | ||
63 | UCLIBC_STAGE_PREFIX = "${STAGING_DIR}/${HOST_SYS}" | ||
64 | |||
65 | # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in | ||
66 | # the CFLAGS (for when building the utils). | ||
67 | OEMAKE_NO_CC = "'OPTIMIZATION=' 'CPU_CFLAGS=${CFLAGS}' 'STRIPTOOL=true' 'LD=${LD}' \ | ||
68 | 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'" | ||
69 | EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}'" | ||
70 | EXTRA_OEMAKE_task_do_populate_staging = "${OEMAKE_NO_CC}" | ||
71 | EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}" | ||
72 | |||
73 | KERNEL_SOURCE = "${CROSS_DIR}/${TARGET_SYS}/include" | ||
74 | KERNEL_HEADERS = "${CROSS_DIR}/${TARGET_SYS}/include" | ||
75 | |||
76 | # Lets munge this via siteinfo.bbclass as well: | ||
77 | # ARCH_BIG_ENDIAN=y | ||
78 | # ARCH_WANTS_BIG_ENDIAN=y | ||
79 | # ARCH_WANTS_LITTLE_ENDIAN is not set | ||
80 | |||
81 | configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \ | ||
82 | s,^KERNEL_HEADERS=.*,KERNEL_HEADERS="${KERNEL_HEADERS}",g; \ | ||
83 | s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \ | ||
84 | s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \ | ||
85 | s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \ | ||
86 | s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \ | ||
87 | s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \ | ||
88 | ${@["s,.*UCLIBC_HAS_LOCALE.*,# UCLIBC_HAS_LOCALE is not set,;", ""][bb.data.getVar("USE_NLS", d, 1) == "yes"]}' | ||
89 | CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}" | ||
90 | |||
91 | python () { | ||
92 | if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]: | ||
93 | bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d) | ||
94 | } | ||
95 | |||
96 | uclibcbuild_do_patch() { | ||
97 | ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux | ||
98 | ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm | ||
99 | |||
100 | ${@['cp %s/%s extra/locale' % (bb.data.getVar('DL_DIR', d, 1) or '', bb.data.getVar('UCLIBC_LOCALE_FILE', d, 1) or ''), ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} | ||
101 | } | ||
102 | |||
103 | python do_patch () { | ||
104 | bb.build.exec_func('base_do_patch', d) | ||
105 | bb.build.exec_func('uclibcbuild_do_patch', d) | ||
106 | } | ||
107 | |||
108 | do_configure() { | ||
109 | rm -f ${S}/.config | ||
110 | |||
111 | # For uClibc 0.9.29, OpenEmbedded splits the uClibc.config in two parts: | ||
112 | # uClibc.machine and uClibc.distro. So, if they exist use them, otherwise | ||
113 | # use a uClibc.config | ||
114 | if [ -f ${WORKDIR}/uClibc.machine -a -f ${WORKDIR}/uClibc.distro ]; then | ||
115 | echo "### uClibc.machine ###" >${S}/merged.config | ||
116 | cat ${WORKDIR}/uClibc.machine >>${S}/merged.config | ||
117 | echo "### uClibc.distro ###" >>${S}/merged.config | ||
118 | cat ${WORKDIR}/uClibc.distro >>${S}/merged.config | ||
119 | else | ||
120 | echo "### uClibc.config ###" >${S}/merged.config | ||
121 | cat ${WORKDIR}/uClibc.config >>${S}/merged.config | ||
122 | fi | ||
123 | cp ${S}/merged.config ${S}/.config | ||
124 | |||
125 | # Mangle the resulting .config depending on OE variables | ||
126 | perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak | ||
127 | perl -i -p -e '${configmangle}' ${S}/.config | ||
128 | |||
129 | sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config | ||
130 | |||
131 | if [ "${TARGET_OS}" == "linux-gnueabi" -o "${TARGET_OS}" == "linux-uclibcgnueabi" ]; then | ||
132 | echo "CONFIG_ARM_EABI=y" >> ${S}/.config | ||
133 | else | ||
134 | echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config | ||
135 | fi | ||
136 | |||
137 | oe_runmake oldconfig | ||
138 | } | ||
139 | |||
140 | do_stage() { | ||
141 | # Install into the cross dir (this MUST be done first because we | ||
142 | # will install crt1.o in the install_dev stage and gcc needs it) | ||
143 | oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \ | ||
144 | RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \ | ||
145 | install_dev install_runtime | ||
146 | |||
147 | oe_runmake utils | ||
148 | oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \ | ||
149 | RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \ | ||
150 | install_utils | ||
151 | |||
152 | # We don't really need this | ||
153 | rm -f ${UCLIBC_PREFIX}/include/.cvsignore | ||
154 | |||
155 | # Fixup shared lib symlinks | ||
156 | ( cd ${UCLIBC_PREFIX}/lib | ||
157 | for f in c crypt dl m nsl pthread resolv thread_db util; do | ||
158 | ln -sf lib${f}.so.? lib${f}.so | ||
159 | done | ||
160 | ) | ||
161 | |||
162 | # This conflicts with the c++ version of this header | ||
163 | rm -f ${UCLIBC_PREFIX}/include/bits/atomicity.h | ||
164 | |||
165 | # Install into the staging dir | ||
166 | oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_STAGE_PREFIX}/ \ | ||
167 | RUNTIME_PREFIX=${UCLIBC_STAGE_PREFIX}/ \ | ||
168 | install_dev install_runtime install_utils | ||
169 | |||
170 | # We don't really need this | ||
171 | rm -f ${UCLIBC_STAGE_PREFIX}/include/.cvsignore | ||
172 | |||
173 | # Fixup shared lib symlinks | ||
174 | ( cd ${UCLIBC_STAGE_PREFIX}/lib | ||
175 | for f in c crypt dl m nsl pthread resolv thread_db util; do | ||
176 | ln -sf lib${f}.so.? lib${f}.so | ||
177 | done | ||
178 | ) | ||
179 | |||
180 | # This conflicts with the c++ version of this header | ||
181 | rm -f ${UCLIBC_STAGE_PREFIX}/include/bits/atomicity.h | ||
182 | } | ||
183 | |||
184 | do_install() { | ||
185 | oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | ||
186 | install_dev install_runtime install_utils | ||
187 | |||
188 | # We don't really need this in ${includedir} | ||
189 | rm -f ${D}${prefix}/include/.cvsignore | ||
190 | |||
191 | # This conflicts with the c++ version of this header | ||
192 | rm -f ${D}${prefix}/include/bits/atomicity.h | ||
193 | |||
194 | # ugh.. uclibc doesn't like obeying our path variables. | ||
195 | if [ "${includedir}" != "${prefix}/include" ]; then | ||
196 | install -d ${D}${includedir} | ||
197 | mv ${D}${prefix}/include/* ${D}${includedir}/ | ||
198 | rmdir ${D}${prefix}/include | ||
199 | fi | ||
200 | |||
201 | if [ "${libdir}" != "${prefix}/lib" ]; then | ||
202 | install -d ${D}${libdir} | ||
203 | mv ${D}${prefix}/lib/* ${D}${libdir}/ | ||
204 | rmdir ${D}${prefix}/lib | ||
205 | fi | ||
206 | |||
207 | if [ "${bindir}" != "/usr/bin" ]; then | ||
208 | install -d ${D}${bindir} | ||
209 | mv ${D}/usr/bin/* ${D}${bindir}/ | ||
210 | rmdir ${D}/usr/bin | ||
211 | fi | ||
212 | } | ||
213 | |||